Documente Academic
Documente Profesional
Documente Cultură
physics › kinematics ›
#include <codecogs/physics/kinematics/velocity.h>
velocity Private Project #include <iostream>
average and instantaneous velocity of an object
int main()
{
Contents // final position and time
1. Interface double x = 100, t = 15.7;
2. Function Documentation
3. Page Comments std::cout << std::endl;
std::cout << " Final position = " << x << " m" << std::endl;
Private project under development, to help contact the author:
std::cout << " Time spent = " << t << " s" << std::endl;
Group Description
std::cout << std::endl;
This module computes the average and instantaneous velocity of a moving object at given moments of
// assuming initial position and initial time are null,
time.
// display the average velocity of the object
Authors:
Lucian Bentea (July 2007) std::cout << "Average velocity = " <<
Physics::Kinematics::velocity_avg(x, t);
Interface std::cout << " m/s" << std::endl;
#include <codecogs/physics/kinematics/velocity.h>
return 0;
}
using namespace Physics::Kinematics;
Output
double velocity_avg (double xf, double tf, double x0 = 0, double t0 = 0)
Final position = 100 m
[inline]
Time spent = 15.7 s
Average velocity of an object given its initial and final position,
and also the time spent
Average velocity = 6.36943 m/s
Real cc_velocity_avg (Real xf, Real tf, Real x0, Real t0)
This function is available as a Microsoft Excel add-in. Parameters:
double velocity_ins (double (*x)(double), double t, double eps = 1E-6) xf final position on the axis (meters)
[inline] tf final time (seconds) [needs to be different from t0]
Instantaneous velocity of an object at a certain moment of time, x0 Default value = 0
given the position function t0 Default value = 0
std::vector<double> velocity_ins (double (*x) Returns:
(double), std::vector<double> &t, double eps = 1E-6) [inline] the average velocity of the moving object (meters per second)
Instantaneous velocities of an object at several moments of time,
given the position function double velocity_ins( double (*x)(double) [function pointer]
double t
double eps = 1E-6 ) [inline]
Function Documentation
Add calculator to website or email
This function returns the instantaneous velocity of a moving object at a certain moment of time t, given a
double velocity_avg( double xf
function x which determines the position of the object at any moment of time. It is based on the fact that
double tf the instantaneous velocity function is given by the derivative of the position function with respect
double x0 = 0 to time, i.e.
double t0 = 0 ) [inline] (2)
This function computes the average velocity of a moving object, given its initial and final position on an Since this function uses numerical differentiation to compute the above derivative, an optional parameter
axis and also the total time spent to get to that final position. Considering is the initial position at time
eps is available to specify the precision of numerical computations.
and is the final position at time , the average velocity is given by the following simple formula:
(1) Example 2:
#include <codecogs/physics/kinematics/velocity.h>
#include <iostream>
Example 1:
Returns: Output
the instantaneous velocity of the object at time t (meters per second) Time = 11.4 s Position = 1481.54 m Velocity = 389.88 m/s
Time = 11.41 s Position = 1485.45 m Velocity = 390.564 m/s
std::vector<double> velocity_ins (*x)(double) [function
double Time = 11.42 s Position = 1489.36 m Velocity = 391.249 m/s
( pointer]
Time = 11.43 s Position = 1493.27 m Velocity = 391.935 m/s
std::vector<double> & t
Time = 11.44 s Position = 1497.19 m Velocity = 392.621 m/s
) Time = 11.45 s Position = 1501.12 m Velocity = 393.307 m/s
double eps = 1E-6
[inline] Time = 11.46 s Position = 1505.06 m Velocity = 393.995 m/s
Time = 11.47 s Position = 1509 m Velocity = 394.683 m/s
This function is based on the same equation as the previous one, only that it is able to compute the Time = 11.48 s Position = 1512.95 m Velocity = 395.371 m/s
instantaneous velocities at several moments of time and return the results in the form of an array. Time = 11.49 s Position = 1516.91 m Velocity = 396.06 m/s
Notice the example code below which shows exactly how this is a generalisation of the previous overloaded Parameters:
function. x function defining the position of the object at any moment of time (meters)
Example 3: t array containing the moments of time at which the instantaneous velocities should be
evaluated (seconds)
#include <codecogs/physics/kinematics/velocity.h>
eps Default value = 1E-6
physics › kinematics ›
Returns:
array containing the instantaneous velocities of the object at moments of time given by t (meters per position uniform Private Project
Page Comments
Contents
1. Interface
You must login to leave a messge
2. Function Documentation
3. Page Comments
Last Modified: 6 Nov 07 @ 16:42 Page Rendered: 2009-06-14 05:26:06
Private project under development, to help contact the author:
CodeCogs is a member of Zyba Ltd © 2004-2008 Home | Site Map | Contact Us Group Description
This module computes the position of an object moving uniformly (constant speed or constant
acceleration).
Authors:
Lucian Bentea (July 2007)
Interface
#include <codecogs/physics/kinematics/position_uniform.h>
Function Documentation
Add calculator to website or email
double position_const_velocity
double t
(
double v
x0 =
double
0
double t0 = 0 ) [inline]
This function determines the position of an object at time after moving uniformly at constant
velocity for a certain period of time. The formula relating the above quantities is
(1)
where is the initial position of the object at time .
Example 1:
#include <codecogs/physics/kinematics/position_uniform.h>
#include <iostream>
int main()
{
// the constant velocity and the current time // the constant velocity and the current time
double v = 5.7, t = 12; double a = 0.7, v0 = 4.33, t = 9.8;
double
x0 Page Comments
= 0
t0 ) You must login to leave a messge
double
= 0 [inline]
int main()
{
physics › kinematics ›
std::cout << std::endl;
position Private Project
std::cout << "Velocity = " << v << " m/s";
position of an object moving uniformly std::cout << std::endl;
std::cout << " Time = " << t << " s";
Contents std::cout << std::endl << std::endl;
1. Interface
// compute the current position
2. Function Documentation
// assuming the initial position and time are null
3. Page Comments
Private project under development, to help contact the author: std::cout << "Position = " <<
Group Description Physics::Kinematics::position_velocity(t, v);
std::cout << " m" << std::endl;
This module computes the position of an object moving uniformly (constant speed or constant
acceleration). return 0;
}
Authors:
Lucian Bentea (July 2007) Output:
Velocity = 5.7 m/s
Interface Time = 12 s
This function determines the position of an object at time after moving uniformly at constant where is the initial position of the object at time .
velocity for a certain period of time. The formula relating the above quantities is Example 2:
(1)
#include <codecogs/physics/kinematics/position.h>
where is the initial position of the object at time . #include <iostream>
Example 1:
int main()
#include <codecogs/physics/kinematics/position.h>
{
#include <iostream>
// the constant velocity and the current time
double a = 0.7, v0 = 4.33, t = 9.8;
int main()
{
std::cout << std::endl;
// the constant velocity and the current time
std::cout << " Acceleration = " << a << " m/s^2";
double v = 5.7, t = 12;
return 0; This module computes the average and instantaneous acceleration of a moving object at given moments
} of time.
Output: Authors:
Lucian Bentea (July 2007)
Acceleration = 0.7 m/s^2
Init. velocity = 4.33 m/s
Time = 9.8 s Interface
t0 Default value = 0 Real cc_acceleration_avg (Real vf, Real tf, Real v0, Real t0)
This function is available as a Microsoft Excel add-in.
Returns:
double acceleration_ins (double (*v)(double), double t, double eps = 1E-6)
the position of the object after moving uniformly at constant acceleration for t seconds (meters)
[inline]
Instantaneous acceleration of an object at a certain moment of time,
Page Comments given the velocity function
CodeCogs is a member of Zyba Ltd © 2004-2008 Home | Site Map | Contact Us double acceleration_ins_space (double (*x)
(double), double t, double eps = 1E-5) [inline]
Instantaneous acceleration of an object at a certain moment of time,
given the position function
Function Documentation
Add calculator to website or email
double acceleration_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 is the initial velocity at time and is the final velocity at
Since this function uses numerical differentiation to compute the above derivative, an optional parameter
time , the average acceleration is given by the following simple formula:
eps is available to specify the precision of numerical computations.
(1)
Example 2:
#include <codecogs/physics/kinematics/acceleration.h>
Example 1: #include <iostream>
#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
int main()
{ double velocity(double t)
// final velocity and time {
double v = 200, t = 15.7; return t*t/2;
}
std::cout << std::endl;
std::cout << " Final velocity = " << v << " m/s" << std::endl; int main()
std::cout << " Time spent = " << t << " s" << std::endl; {
std::cout << std::endl; // time at which to calculate instantaneous acceleration
double t = 11.43;
// assuming initial velocity and initial time are null,
// display the average acceleration of the object std::cout << std::endl;
std::cout << "Velocity = " << velocity(t);
std::cout << "Average acceleration = " << std::cout << " m/s" << std::endl;
Physics::Kinematics::acceleration_avg(v, t); std::cout << " Time = " << t;
std::cout << " m/s^2" << std::endl; std::cout << " s" << std::endl;
std::cout << std::endl;
return 0;
} // display instantaneous acceleration at time t
double t[10] = {
11.40, 11.41, 11.42, 11.43, 11.44, Since this function uses numerical differentiation to compute the above second order derivative, an
11.45, 11.46, 11.47, 11.48, 11.49 optional parameter eps is available to specify the precision of numerical computations.
};
Example 4:
Physics::Kinematics::acceleration_ins_space(space, t);
std::cout << " m/s^2" << std::endl; std::vector<double> time(t, t+10),
acceleration = Physics::Kinematics::acceleration_ins_space(distance, time);
return 0;
} // display the time, the position
// and the instantaneous acceleration values
Output
Position = 1493.27 m std::cout << std::endl;
Time = 11.43 s for (int i = 0; i < 10; i++)
{
Instantaneous acceleration = 68.5782 m/s^2 std::cout << "Time = " << time[i] << " s";
std::cout << "\tPosition = " << distance(time[i]) << " m";
Parameters: std::cout << "\tAcceleration = " << acceleration[i] << " m/s^2";
x function defining the position of the object at any moment of time (meters) std::cout << std::endl;
t the moment of time at which the instantaneous acceleration is to be evaluated (seconds) }
eps Default value = 1E-5
return 0;
Returns: }
the instantaneous acceleration of the object at time t (meters per sq. second)
Output
(*x)(double)
std::vector<double> acceleration_ins_space Time = 11.4 s Position = 1481.54 m Acceleration = 68.3985 m/s^2
double [function
( Time = 11.41 s Position = 1485.45 m Acceleration = 68.4599 m/s^2
pointer]
Time = 11.42 s Position = 1489.36 m Acceleration = 68.5168 m/s^2
std::vector<double> & t
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
double eps = 1E-5
[inline] 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
This function is based on the same equation as the previous one, only that it is able to compute the Time = 11.47 s Position = 1509 m Acceleration = 68.8237 m/s^2
instantaneous acceleration values at several moments of time and return the results in the form of an Time = 11.48 s Position = 1512.95 m Acceleration = 68.8829 m/s^2
array. Time = 11.49 s Position = 1516.91 m Acceleration = 68.9397 m/s^2
Notice the example code below which shows how this is a generalisation of the previous overloaded Parameters:
function. x function defining the position at any moment of time (meters)
Example 5: t array containing the moments of time at which the instantaneous acceleration values should
be evaluated (seconds)
#include <codecogs/physics/kinematics/acceleration.h>
#include <iostream> eps Default value = 1E-5
Returns:
// function defining the position at any moment of time t; array containing the instantaneous acceleration values of the object at moments of time given by t
// in this case pos(t) = t^3 (meters per sq. second)
double pos(double t)
Page Comments
{
return t*t*t;
You must login to leave a messge
}
int main() Last Modified: 5 Nov 07 @ 14:37 Page Rendered: 2009-06-15 06:45:53
{
// moments of time at which to evaluate CodeCogs is a member of Zyba Ltd © 2004-2008 Home | Site Map | Contact Us
double t[10] = {
11.40, 11.41, 11.42, 11.43, 11.44,
11.45, 11.46, 11.47, 11.48, 11.49
};