autoemulate.simulations.projectile#

class Projectile(parameters_range=None, output_names=None, log_level='progress_bar')[source]#

Bases: Simulator

Simulator of projectile motion.

A projectile is launched from an initial height of 2 meters at an angle of 45 degrees and falls under the influence of gravity and air resistance. Drag is proportional to the square of the velocity. We would like to determine the distance travelled by the projectile as a function of the drag coefficient and the launch velocity.

class ProjectileMultioutput(parameters_range=None, output_names=None, log_level='progress_bar')[source]#

Bases: Simulator

Multi-output simulator of projectile motion.

Simulator of projectile motion that outputs both the distance travelled by the projectile and its velocity on impact.

f(t, y, c)[source]#

Compute RHS of system of differential equations, returning vector derivative.

Parameters:
  • t (float) – Time variable (not used).

  • y (array) – Array of dependent variables (vx, vy, x, y).

  • c (float) – Drag coefficient (non-negative).

event(t, y, c)[source]#

Event to trigger end of integration. Stops when projectile hits ground.

Parameters:
  • t (float) – Time variable (not used).

  • y (array) – Array of dependent variables (vx, vy, x, y).

  • c (float) – Drag coefficient (non-negative).

Returns:

The height of the projectile.

Return type:

float

simulator_base(x)[source]#

Simulate ODE system for projectile motion with drag.

Returns distance projectile travels.

Parameters:

x (NumpyLike) – Array of input parameters (c, v0).

Returns:

results – Results of ODE integration.

Return type:

scipy.integrate.OdeResult

simulate_projectile(x)[source]#

Return the distance travelled by the projectile.

Distance is obtained by solving the ODE system for projectile motion with drag.

Parameters:

x (NumpyLike) – Array of input parameters (c, v0).

Returns:

distance – Distance travelled by projectile.

Return type:

float

simulate_projectile_multioutput(x)[source]#

Return the distance travelled by the projectile and its impact velocity.

Simulator to solve ODE system with multiple outputs.

Parameters:

x (NumpyLike) – Array of input parameters (c, v0).

Returns:

Distance travelled by projectile and its velocity on impact.

Return type:

float, float