position of an object moving uniformly

View versions (1)

Interface

Overview

This module computes the position of an object moving uniformly (constant speed or constant acceleration).

GPL Licence — free for non commercial use. See Licence details.

FUNCTION

position_const_velocity

This function determines the position x(t) of an object at time t after moving uniformly at constant velocity v for a certain period of time. The formula relating the above quantities is

x(t) = x_0 + v \left(t - t_0\right),
(1)

where x_0 is the initial position of the object at time t_0.

Example 1

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

int main()
{
  // the constant velocity and the current time
  double v = 5.7, t = 12;

  std::cout << std::endl;
  std::cout << "Velocity = " << v << " m/s";
  std::cout << std::endl;
  std::cout << "    Time = " << t << " s";
  std::cout << std::endl << std::endl;
  
  // compute the current position
  // assuming the initial position and time are null

  std::cout << "Position = " << 
  Physics::Kinematics::position_const_velocity(t, v);
  std::cout << " m" << std::endl;

  return 0;
}

Output

Velocity = 5.7 m/s
    Time = 12 s

Position = 68.4 m

Parameters

t
the current time (seconds)
v
the value of the constant velocity (meters per second)
x0
Default value = 0
t0
Default value = 0

Returns

the position of the object after moving uniformly at constant velocity for t seconds (meters)

Interactive Calculator

t
v
x0
t0
Result

FUNCTION

position_const_acceleration

This function determines the position x(t) of an object at time t after moving uniformly at constant acceleration a for a certain period of time, with initial velocity given by v_0. The formula relating the above quantities is

x(t) = x_0 + v_0 \left(t - t_0\right) + \frac{1}{2} a \left(t - t_0\right)^2,
(2)

where x_0 is the initial position of the object at time t_0.

Example 1

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

int main()
{
  // the constant velocity and the current time
  double a = 0.7, v0 = 4.33, t = 9.8;

  std::cout << std::endl;
  std::cout << "  Acceleration = " << a << " m/s^2";
  std::cout << std::endl;
  std::cout << "Init. velocity = " << v0 << " m/s";
  std::cout << std::endl;
  std::cout << "          Time = " << t << " s";
  std::cout << std::endl << std::endl;
  
  // compute the current position
  // assuming the initial position and time are null

  std::cout << "      Position = " << 
  Physics::Kinematics::position_const_acceleration(t, a, v0);
  std::cout << " m" << std::endl;

  return 0;
}

Output

Acceleration = 0.7 m/s^2
Init. velocity = 4.33 m/s
          Time = 9.8 s

      Position = 76.048 m

Parameters

t
the current time (seconds)
a
the value of the constant acceleration (meters per sq. second)
v0
the initial velocity of the object at time t0 (meters per second)
x0
Default value = 0
t0
Default value = 0

Returns

the position of the object after moving uniformly at constant acceleration for t seconds (meters)

Interactive Calculator

t
a
v0
x0
t0
Result