• https://me.yahoo.com

# acceleration

Average and instantaneous acceleration of an object
Controller: CodeCogs
Private project under development, to help contact the author:

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_avg( double vf double tf double v0 = 0 double t0 = 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&space;&space;v_0$ is the initial velocity at time $\inline&space;&space;t_0$ and $\inline&space;&space;v_f$ is the final velocity at time $\inline&space;&space;t_f$, the average acceleration $\inline&space;\overline{a}$ is given by the following simple formula:
$\overline{a}&space;=&space;\frac{\Delta&space;v}{\Delta&space;t}&space;=&space;\frac{v_f&space;-&space;v_0}{t_f&space;-&space;t_0}.$

### 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

 vf final velocity (meters per second) tf final time (seconds) [needs to be different from t0] v0 Default value = 0 t0 Default 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_ins( double (*v)(double)[function pointer] double t double eps = 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&space;&space;a(t)$ is given by the derivative of the velocity function $\inline&space;&space;v(t)$ with respect to time, i.e.
$a(t)&space;=&space;\frac{\mathrm{d}v}{\mathrm{d}t}(t).$

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

 v function defining the velocity of the object at any moment of time (meters per second) t the moment of time at which the instantaneous acceleration is to be evaluated (seconds) eps Default 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::vectoracceleration_ins( double (*v)(double)[function pointer] std::vector& t double eps = 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

 v function defining the velocity at any moment of time (meters per second) t array containing the moments of time at which the instantaneous acceleration should be evaluated (seconds) eps Default 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_space( double (*x)(double)[function pointer] double t double eps = 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&space;&space;a(t)$ is given by the second order derivative of the position function $\inline&space;&space;x(t)$ with respect to time, i.e.
$a(t)&space;=&space;\frac{\mathrm{d}^2x}{\mathrm{d}t^2}(t).$

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

 x function defining the position of the object at any moment of time (meters) t the moment of time at which the instantaneous acceleration is to be evaluated (seconds) eps Default 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::vectoracceleration_ins_space( double (*x)(double)[function pointer] std::vector& t double eps = 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

 x function defining the position at any moment of time (meters) t array containing the moments of time at which the instantaneous acceleration values should be evaluated (seconds) eps Default 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.