using System;
namespace Science.Physics.GeneralPhysics
{
///
/// In the non-relativistic limit, acceleration is defined
/// as the derivative of velocity, and is therefore given
/// by the expression. Newton's second law is a very famous
/// observation which expressed the force F on a body
/// in terms of its acceleration a and mass m.
///
public class Acceleration : Vector
{
private void SetDim()
{
this.DimensionMass = 0;
this.DimensionLength = 1;
this.DimensionTime = -2;
}
public Acceleration()
{
SetDim();
}
public Acceleration(Vector.FunctionOfTime func)
: base(func)
{
SetDim();
}
public Acceleration(Velocity final, Velocity initial, Time t)
{
SetDim();
this.X = (final.X - initial.X) / t.s;
this.Y = (final.Y - initial.Y) / t.s;
this.Z = (final.Z - initial.Z) / t.s;
}
public Acceleration(Mass m, TotalForce f)
{
SetDim();
this.X = f.X/m.kg;
this.Y = f.Y/m.kg;
this.Z = f.Z/m.kg;
}
private Velocity w;
private int component;
public Acceleration(Velocity v, Time t)
{
SetDim();
w = v;
double time = t.s;
Calculus.Function del
= new Calculus.Function(Func);
component = 0;
this.X = Calculus.Differentiation(del, time);
component = 1;
this.Y = Calculus.Differentiation(del, time);
component = 2;
this.Z = Calculus.Differentiation(del, time);
}
private double Func(double t)
{
Time time = new Time();
time.s = t;
w.Set(time);
if(component==0) return w.X;
else if(component==1) return w.Y;
else return w.Z;
}
public double mPERsSQUARE
{
get{return this.Norm;}
}
public override string ToString()
{
return base.ToString() + "(m/s^2)";
}
}
}