Physics › Kinematics ›
acceleration
Average and instantaneous acceleration of an object
Controller: CodeCogs
Contents
Dependents
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_avg( | double | vf | |
double | tf | ||
double | v0 = 0 | ||
double | t0 = 0 | )[inline] |
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; }
OutputFinal 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] |
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; }
OutputVelocity = 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::vector<double>acceleration_ins( | double | (*v)(double)[function pointer] | |
std::vector<double>& | t | ||
double | eps = 1E-6 | )[inline] |
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; }
OutputTime = 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] |
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; }
OutputPosition = 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::vector<double>acceleration_ins_space( | double | (*x)(double)[function pointer] | |
std::vector<double>& | t | ||
double | eps = 1E-5 | )[inline] |
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; }
OutputTime = 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.