I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com

acceleration

Average and instantaneous acceleration of an object
Controller: CodeCogs

Dependents

Info

Interface

C++
Excel

Overview

This module computes the average and instantaneous acceleration of a moving object at given moments of time.

Authors

Lucian Bentea (July 2007)

Acceleration Avg

 
doubleacceleration_avgdoublevf
doubletf
doublev0 = 0
doublet0 = 0 )[inline]
This function computes the average acceleration of a moving object, given the initial and final velocities, and also the total time spent. Considering \inline  v_0 is the initial velocity at time \inline  t_0 and \inline  v_f is the final velocity at time \inline  t_f, the average acceleration \inline \overline{a} is given by the following simple formula:

Example 1

#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream>
 
int main()
{
  // final velocity and time
  double v = 200, t = 15.7;
 
  std::cout << std::endl;
  std::cout << "      Final velocity = " << v << " m/s" << std::endl;
  std::cout << "          Time spent = " << t << " s" << std::endl;
  std::cout << std::endl;
 
  // assuming initial velocity and initial time are null,
  // display the average acceleration of the object
 
  std::cout << "Average acceleration = " << 
  Physics::Kinematics::acceleration_avg(v, t);
  std::cout << " m/s^2" << std::endl;
 
  return 0;
}
Output
Final velocity = 200 m/s
          Time spent = 15.7 s
 
Average acceleration = 12.7389 m/s^2

Parameters

vffinal velocity (meters per second)
tffinal time (seconds) [needs to be different from t0]
v0Default value = 0
t0Default value = 0

Returns

the average acceleration of the moving object (meters per sq. second)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Acceleration Ins

 
doubleacceleration_insdouble(*v)(double)[function pointer]
doublet
doubleeps = 1E-6 )[inline]
This function returns the instantaneous acceleration of a moving object at a certain moment of time t, given a function v which describes the velocity of the object at any moment of time. It is based on the fact that the instantaneous acceleration function \inline  a(t) is given by the derivative of the velocity function \inline  v(t) with respect to time, i.e.

Since this function uses numerical differentiation to compute the above derivative, an optional parameter eps is available to specify the precision of numerical computations.

Example 2

#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream>
 
// function defining the velocity at any moment of time t;
// in this case velocity(t) = t^2/2
 
double velocity(double t)
{
  return t*t/2;
}
 
int main()
{
  // time at which to calculate instantaneous acceleration
  double t = 11.43;
 
  std::cout << std::endl;
  std::cout << "Velocity = " << velocity(t);
  std::cout << " m/s" << std::endl;
  std::cout << "    Time = " << t;
  std::cout << " s" << std::endl;
  std::cout << std::endl;
 
  // display instantaneous acceleration at time t
 
  std::cout << "Instantaneous acceleration = " <<
  Physics::Kinematics::acceleration_ins(velocity, t);
  std::cout << " m/s^2" << std::endl;
 
  return 0;
}
Output
Velocity = 65.3225 m/s
    Time = 11.43 s
 
Instantaneous acceleration = 11.43 m/s^2

Parameters

vfunction defining the velocity of the object at any moment of time (meters per second)
tthe moment of time at which the instantaneous acceleration is to be evaluated (seconds)
epsDefault value = 1E-6

Returns

the instantaneous acceleration of the object at time t (meters per sq. second)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Acceleration Ins

 
std::vector<double>acceleration_insdouble(*v)(double)[function pointer]
std::vector<double>& t
doubleeps = 1E-6 )[inline]
This function is based on the same equation as the previous one, only that it is able to compute the instantaneous acceleration values at several moments of time and return the results in the form of an array.

Notice the example code below which shows exactly how this is a generalisation of the previous overloaded function.

Example 3

#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream>
 
// function defining the velocity at any moment of time t;
// in this case velocity(t) = t^2/2
 
double speed(double t)
{
  return t*t/2;
}
 
int main()
{
  // moments of time at which to evaluate 
  // the instantaneous acceleration of the object
 
  double t[10] = { 
  11.40, 11.41, 11.42, 11.43, 11.44, 
  11.45, 11.46, 11.47, 11.48, 11.49
  };
 
  // compute the instantaneous acceleration values
 
  std::vector<double> time(t, t+10),
  acceleration = Physics::Kinematics::acceleration_ins(speed, time);
 
  // display the time, the velocity
  // and the instantaneous acceleration
 
  std::cout << std::endl;
  for (int i = 0; i < 10; i++)
  {
    std::cout << "Time = " << time[i] << " s";
    std::cout << "\tVelocity = " << speed(time[i]) << " m/s";
    std::cout << "\tAcceleration = " << acceleration[i] << " m/s^2";
    std::cout << std::endl;
  }
 
  return 0;
}
Output
Time = 11.4 s   Velocity = 64.98 m/s    Acceleration = 11.4 m/s^2
Time = 11.41 s  Velocity = 65.094 m/s   Acceleration = 11.41 m/s^2
Time = 11.42 s  Velocity = 65.2082 m/s  Acceleration = 11.42 m/s^2
Time = 11.43 s  Velocity = 65.3225 m/s  Acceleration = 11.43 m/s^2
Time = 11.44 s  Velocity = 65.4368 m/s  Acceleration = 11.44 m/s^2
Time = 11.45 s  Velocity = 65.5512 m/s  Acceleration = 11.45 m/s^2
Time = 11.46 s  Velocity = 65.6658 m/s  Acceleration = 11.46 m/s^2
Time = 11.47 s  Velocity = 65.7805 m/s  Acceleration = 11.47 m/s^2
Time = 11.48 s  Velocity = 65.8952 m/s  Acceleration = 11.48 m/s^2
Time = 11.49 s  Velocity = 66.0101 m/s  Acceleration = 11.49 m/s^2

Parameters

vfunction defining the velocity at any moment of time (meters per second)
tarray containing the moments of time at which the instantaneous acceleration should be evaluated (seconds)
epsDefault value = 1E-6

Returns

array containing the instantaneous acceleration values at the moments of time given by t (meters per sq. second)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Acceleration Ins Space

 
doubleacceleration_ins_spacedouble(*x)(double)[function pointer]
doublet
doubleeps = 1E-5 )[inline]
This function returns the instantaneous acceleration of a moving object at a certain moment of time t, given a function x which determines the position of the object at any moment of time on a fixed axis. It is based on the fact that the instantaneous acceleration function \inline  a(t) is given by the second order derivative of the position function \inline  x(t) with respect to time, i.e.

Since this function uses numerical differentiation to compute the above second order derivative, an optional parameter eps is available to specify the precision of numerical computations.

Example 4

#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream>
 
// function defining the position at any moment of time t;
// in this case space(t) = t^3
 
double pos(double t)
{
  return t*t*t;
}
 
int main()
{
  // time at which to calculate instantaneous acceleration
  double t = 11.43;
 
  std::cout << std::endl;
  std::cout << "Position = " << space(t);
  std::cout << " m" << std::endl;
  std::cout << "    Time = " << t;
  std::cout << " s" << std::endl;
  std::cout << std::endl;
 
  // display instantaneous acceleration at time t
 
  std::cout << "Instantaneous acceleration = " <<
  Physics::Kinematics::acceleration_ins_space(space, t);
  std::cout << " m/s^2" << std::endl;
 
  return 0;
}
Output
Position = 1493.27 m
    Time = 11.43 s
 
Instantaneous acceleration = 68.5782 m/s^2

Parameters

xfunction defining the position of the object at any moment of time (meters)
tthe moment of time at which the instantaneous acceleration is to be evaluated (seconds)
epsDefault value = 1E-5

Returns

the instantaneous acceleration of the object at time t (meters per sq. second)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Acceleration Ins Space

 
std::vector<double>acceleration_ins_spacedouble(*x)(double)[function pointer]
std::vector<double>& t
doubleeps = 1E-5 )[inline]
This function is based on the same equation as the previous one, only that it is able to compute the instantaneous acceleration values at several moments of time and return the results in the form of an array.

Notice the example code below which shows how this is a generalisation of the previous overloaded function.

Example 5

#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream>
 
// function defining the position at any moment of time t;
// in this case pos(t) = t^3
 
double pos(double t)
{
  return t*t*t;
}
 
int main()
{
  // moments of time at which to evaluate 
  // the instantaneous acceleration of the object
 
  double t[10] = { 
  11.40, 11.41, 11.42, 11.43, 11.44, 
  11.45, 11.46, 11.47, 11.48, 11.49
  };
 
  // compute the instantaneous acceleration values
 
  std::vector<double> time(t, t+10),
  acceleration = Physics::Kinematics::acceleration_ins_space(distance, time);
 
  // display the time, the position
  // and the instantaneous acceleration values
 
  std::cout << std::endl;
  for (int i = 0; i < 10; i++)
  {
    std::cout << "Time = " << time[i] << " s";
    std::cout << "\tPosition = " << distance(time[i]) << " m";
    std::cout << "\tAcceleration = " << acceleration[i] << " m/s^2";
    std::cout << std::endl;
  }
 
  return 0;
}
Output
Time = 11.4 s   Position = 1481.54 m    Acceleration = 68.3985 m/s^2
Time = 11.41 s  Position = 1485.45 m    Acceleration = 68.4599 m/s^2
Time = 11.42 s  Position = 1489.36 m    Acceleration = 68.5168 m/s^2
Time = 11.43 s  Position = 1493.27 m    Acceleration = 68.5782 m/s^2
Time = 11.44 s  Position = 1497.19 m    Acceleration = 68.6396 m/s^2
Time = 11.45 s  Position = 1501.12 m    Acceleration = 68.6987 m/s^2
Time = 11.46 s  Position = 1505.06 m    Acceleration = 68.7601 m/s^2
Time = 11.47 s  Position = 1509 m       Acceleration = 68.8237 m/s^2
Time = 11.48 s  Position = 1512.95 m    Acceleration = 68.8829 m/s^2
Time = 11.49 s  Position = 1516.91 m    Acceleration = 68.9397 m/s^2

Parameters

xfunction defining the position at any moment of time (meters)
tarray containing the moments of time at which the instantaneous acceleration values should be evaluated (seconds)
epsDefault value = 1E-5

Returns

array containing the instantaneous acceleration values of the object at moments of time given by t (meters per sq. second)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.