Sunteți pe pagina 1din 9

velocity - Kinematics - Physics Code in C, C++ and Excel Page 1 of 5 velocity - Kinematics - Physics Code in C, C++ and Excel

velocity - Kinematics - Physics Code in C, C++ and Excel Page 2 of 5

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:

http://www.codecogs.com/d-ox/physics/kinematics/velocity.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/velocity.php 15/6/2552


velocity - Kinematics - Physics Code in C, C++ and Excel Page 3 of 5 velocity - Kinematics - Physics Code in C, C++ and Excel Page 4 of 5

// function defining the position at any moment of time t; #include <iostream>


// in this case pos(t) = t^3
// function defining the position at any moment of time t;
double pos(double t) // in this case pos(t) = t^3
{
return t*t*t; double pos(double t)
} {
return t*t*t;
int main() }
{
// time at which to calculate instantaneous velocity int main()
double t = 11.43; {
// moments of time at which to evaluate
std::cout << std::endl; // the instantaneous velocity of the object
std::cout << "Position = " << pos(t);
std::cout << " m" << std::endl; double t[10] = {
std::cout << " Time = " << t; 11.40, 11.41, 11.42, 11.43, 11.44,
std::cout << " s" << std::endl; 11.45, 11.46, 11.47, 11.48, 11.49
std::cout << std::endl; };

// display instantaneous velocity at time t // compute the instantaneous velocities

std::cout << "Instantaneous velocity = " << std::vector<double> time(t, t+10),


Physics::Kinematics::velocity_ins(space, t); velocities = Physics::Kinematics::velocity_ins(distance, time);
std::cout << " m/s" << std::endl;
// display the time, the position
return 0; // and the instantaneous velocities
}
std::cout << std::endl;
Output
for (int i = 0; i < 10; i++)
Position = 1493.27 m {
Time = 11.43 s std::cout << "Time = " << time[i] << " s";
std::cout << "\tPosition = " << pos(time[i]) << " m";
Instantaneous velocity = 391.935 m/s std::cout << "\tVelocity = " << velocities[i] << " m/s";
std::cout << std::endl;
Parameters: }
x function defining the position of the object at any moment of time (meters)
t the moment of time at which the instantaneous velocity is to be evaluated (seconds) return 0;
eps Default value = 1E-6 }

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

http://www.codecogs.com/d-ox/physics/kinematics/velocity.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/velocity.php 15/6/2552


velocity - Kinematics - Physics Code in C, C++ and Excel Page 5 of 5 position uniform - Kinematics - Physics Code in C, C++ and Excel Page 1 of 3

physics › kinematics ›
Returns:
array containing the instantaneous velocities of the object at moments of time given by t (meters per position uniform Private Project

second) position of an object moving uniformly

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>

using namespace Physics::Kinematics;

double position_const_velocity (double t, double v, double x0 = 0, double t0 = 0) [inline]


Position of an object moving at constant velocity

Real cc_position_const_velocity (Real t, Real v, Real x0, Real t0)


This function is available as a Microsoft Excel add-in.
double position_const_acceleration (double t, double a, double v0, double x0 = 0, double t0 = 0)
[inline]
Position of an object moving at constant acceleration
Real cc_position_const_acceleration (Real t, Real a, Real v0, Real x0, Real t0)
This function is available as a Microsoft Excel add-in.

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()
{

http://www.codecogs.com/d-ox/physics/kinematics/velocity.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/position_uniform.php 15/6/2552


position uniform - Kinematics - Physics Code in C, C++ and Excel Page 2 of 3 position uniform - Kinematics - Physics Code in C, C++ and Excel Page 3 of 3

// 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;

std::cout << std::endl; std::cout << std::endl;


std::cout << "Velocity = " << v << " m/s"; std::cout << " Acceleration = " << a << " m/s^2";
std::cout << std::endl; std::cout << std::endl;
std::cout << " Time = " << t << " s"; std::cout << "Init. velocity = " << v0 << " m/s";
std::cout << std::endl << std::endl; std::cout << std::endl;
std::cout << " Time = " << t << " s";
// compute the current position std::cout << std::endl << std::endl;
// assuming the initial position and time are null
// compute the current position
std::cout << "Position = " << // assuming the initial position and time are null
Physics::Kinematics::position_const_velocity(t, v);
std::cout << " m" << std::endl; std::cout << " Position = " <<
Physics::Kinematics::position_const_acceleration(t, a, v0);
return 0; std::cout << " m" << std::endl;
}
return 0;
Output: }
Velocity = 5.7 m/s
Output:
Time = 12 s
Acceleration = 0.7 m/s^2
Position = 68.4 m Init. velocity = 4.33 m/s
Time = 9.8 s
Parameters:
t the current time (seconds) Position = 76.048 m
v the value of the constant velocity (meters per second)
Parameters:
x0 Default value = 0
t0 Default value = 0 t the current time (seconds)
a the value of the constant acceleration (meters per sq. second)
Returns:
v0 the initial velocity of the object at time t0 (meters per second)
the position of the object after moving uniformly at constant velocity for t seconds (meters)
Add calculator to website or email x0 Default value = 0
double position_const_acceleration t0 Default value = 0
double t
(
Returns:
double a
the position of the object after moving uniformly at constant acceleration for t seconds (meters)
double v0

double
x0 Page Comments
= 0
t0 ) You must login to leave a messge
double
= 0 [inline]

Last Modified: 18 Oct 07 @ 17:07 Page Rendered: 2009-06-15 06:46:40


This function determines the position of an object at time after moving uniformly at constant
acceleration for a certain period of time, with initial velocity given by . The formula relating the above CodeCogs is a member of Zyba Ltd © 2004-2008 Home | Site Map | Contact Us
quantities is
(2)

where is the initial position of the object at time .


Example 2:
#include <codecogs/physics/kinematics/position_uniform.h>
#include <iostream>

int main()
{

http://www.codecogs.com/d-ox/physics/kinematics/position_uniform.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/position_uniform.php 15/6/2552


position - Kinematics - Physics Code in C, C++ and Excel Page 1 of 3 position - Kinematics - Physics Code in C, C++ and Excel Page 2 of 3

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

#include <codecogs/physics/kinematics/position.h> Position = 68.4 m


using namespace Physics::Kinematics;
Parameters:
double position_velocity (double t, double v, double x0 = 0, double t0 = 0) [inline] t the current time (seconds)
Position of an object moving at constant velocity v the value of the constant velocity (meters per second)
Real cc_position_velocity (Real t, Real v, Real x0, Real t0) x0 Default value = 0
This function is available as a Microsoft Excel add-in. t0 Default value = 0
double position_acceleration (double t, double a, double v0, double x0 = 0, double t0 = 0) Returns:
[inline] the position of the object after moving uniformly at constant velocity for t seconds (meters)
Add calculator to website or email
Position of an object moving at constant acceleration
double position_acceleration( double t
Real cc_position_acceleration (Real t, Real a, Real v0, Real x0, Real t0)
double a
This function is available as a Microsoft Excel add-in.
double v0
double x0 = 0
Function Documentation
double t0 = 0 ) [inline]
Add calculator to website or email
double position_velocity( double t
This function determines the position of an object at time after moving uniformly at constant
double v acceleration for a certain period of time, with initial velocity given by . The formula relating the above
double x0 = 0 quantities is
double t0 = 0 ) [inline] (2)

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;

http://www.codecogs.com/d-ox/physics/kinematics/position.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/position.php 15/6/2552


position - Kinematics - Physics Code in C, C++ and Excel Page 3 of 3 acceleration - Kinematics - Physics Code in C, C++ and Excel Page 1 of 7

std::cout << std::endl; physics › kinematics ›


std::cout << "Init. velocity = " << v0 << " m/s";
acceleration Private Project
std::cout << std::endl;
std::cout << " Time = " << t << " s"; average and instantaneous acceleration of an object
std::cout << std::endl << std::endl;
Contents
// compute the current position
1. Interface
// assuming the initial position and time are null
2. Function Documentation
3. Page Comments
std::cout << " Position = " <<
Physics::Kinematics::position_acceleration(t, a, v0); Private project under development, to help contact the author:
std::cout << " m" << std::endl; Group Description

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

Position = 76.048 m #include <codecogs/physics/kinematics/acceleration.h>

using namespace Physics::Kinematics;


Parameters:
t the current time (seconds) double acceleration_avg (double vf, double tf, double v0 = 0, double t0 = 0)
a the value of the constant acceleration (meters per sq. second) [inline]
v0 the initial velocity of the object at time t0 (meters per second) Average acceleration of an object given the initial and final velocities,
x0 Default value = 0 and also the time spent

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

std::vector<double> acceleration_ins (double (*v)


You must login to leave a messge
(double), std::vector<double> &t, double eps = 1E-6) [inline]
Instantaneous acceleration values of an object at several moments of
Last Modified: 18 Oct 07 @ 17:07 Page Rendered: 2009-06-15 06:46:24 time, 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

std::vector<double> acceleration_ins_space (double (*x)


(double), std::vector<double> &t, double eps = 1E-5) [inline]
Instantaneous acceleration values of an object at several moments 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]

http://www.codecogs.com/d-ox/physics/kinematics/position.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552


acceleration - Kinematics - Physics Code in C, C++ and Excel Page 2 of 7 acceleration - Kinematics - Physics Code in C, C++ and Excel Page 3 of 7

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

Output std::cout << "Instantaneous acceleration = " <<


Final velocity = 200 m/s Physics::Kinematics::acceleration_ins(velocity, t);
Time spent = 15.7 s std::cout << " m/s^2" << std::endl;

Average acceleration = 12.7389 m/s^2 return 0;


}
Parameters:
Output
vf final velocity (meters per second)
Velocity = 65.3225 m/s
tf final time (seconds) [needs to be different from t0]
Time = 11.43 s
v0 Default value = 0
t0 Default value = 0
Instantaneous acceleration = 11.43 m/s^2
Returns:
Parameters:
the average acceleration of the moving object (meters per sq. second)
v function defining the velocity of the object at any moment of time (meters per second)
double acceleration_ins( double (*v)(double) [function pointer]
t the moment of time at which the instantaneous acceleration is to be evaluated (seconds)
double t eps Default value = 1E-6
double eps = 1E-6 ) [inline]
Returns:
the instantaneous acceleration of the object at time t (meters per sq. second)
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 std::vector<double> acceleration_ins (*v)(double)
double
that the instantaneous acceleration function is given by the derivative of the velocity function ( [function pointer]
with respect to time, i.e. std::vector<double> & t
(2)
double eps = 1E-6
)

http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552


acceleration - Kinematics - Physics Code in C, C++ and Excel Page 4 of 7 acceleration - Kinematics - Physics Code in C, C++ and Excel Page 5 of 7

[inline] 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
This function is based on the same equation as the previous one, only that it is able to compute the Time = 11.48 s Velocity = 65.8952 m/s Acceleration = 11.48 m/s^2
instantaneous acceleration values at several moments of time and return the results in the form of an Time = 11.49 s Velocity = 66.0101 m/s Acceleration = 11.49 m/s^2
array.
Parameters:
Notice the example code below which shows exactly how this is a generalisation of the previous overloaded
function. 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
Example 3:
evaluated (seconds)
#include <codecogs/physics/kinematics/acceleration.h> eps Default value = 1E-6
#include <iostream>
Returns:
// function defining the velocity at any moment of time t; array containing the instantaneous acceleration values at the moments of time given by t (meters per
// in this case velocity(t) = t^2/2 sq. second)

double acceleration_ins_space( double (*x)(double) [function pointer]


double speed(double t)
double t
{
return t*t/2; double eps = 1E-5 ) [inline]
}
This function returns the instantaneous acceleration of a moving object at a certain moment of time t,
int main() 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 is given by the second order derivative
// moments of time at which to evaluate of the position function with respect to time, i.e.
// the instantaneous acceleration of the object (3)

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:

// compute the instantaneous acceleration values #include <codecogs/physics/kinematics/acceleration.h>


#include <iostream>
std::vector<double> time(t, t+10),
acceleration = Physics::Kinematics::acceleration_ins(speed, time); // function defining the position at any moment of time t;
// in this case space(t) = t^3
// display the time, the velocity
// and the instantaneous acceleration double pos(double t)
{
std::cout << std::endl; return t*t*t;
for (int i = 0; i < 10; i++) }
{
std::cout << "Time = " << time[i] << " s"; int main()
std::cout << "\tVelocity = " << speed(time[i]) << " m/s"; {
std::cout << "\tAcceleration = " << acceleration[i] << " m/s^2"; // time at which to calculate instantaneous acceleration
std::cout << std::endl; double t = 11.43;
}
std::cout << std::endl;
return 0; std::cout << "Position = " << space(t);
} std::cout << " m" << std::endl;
std::cout << " Time = " << t;
Output std::cout << " s" << std::endl;
Time = 11.4 s Velocity = 64.98 m/s Acceleration = 11.4 m/s^2 std::cout << std::endl;
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 // display instantaneous acceleration at time t
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 std::cout << "Instantaneous acceleration = " <<

http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552


acceleration - Kinematics - Physics Code in C, C++ and Excel Page 6 of 7 acceleration - Kinematics - Physics Code in C, C++ and Excel Page 7 of 7

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

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

http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552 http://www.codecogs.com/d-ox/physics/kinematics/acceleration.php 15/6/2552

S-ar putea să vă placă și