autoemulate.simulations.projectile#

class ProjectileSimulator(param_ranges={'c': (-5.0, 1.0), 'v0': (0.0, 1000)})[source]#

Bases: Simulator

Simulator of projectile motion.

sample_forward(params)[source]#
Parameters:

params (dict[str, float]) – Dictionary of input parameter values to simulate: - c: the drag coefficient on a log scale - v0: velocity

Returns:

distance – Distance travelled by projectile.

Return type:

np.ndarray

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).

simulator_base(x)[source]#

Simulator to solve ODE system for projectile motion with drag. Returns distance projectile travels.

Parameters:

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

Returns:

results – Results of ODE integration.

Return type:

scipy.integrate.OdeResult

simulate_projectile(x)[source]#

Simulator to solve ODE system for projectile motion with drag. Returns distance projectile travels.

Parameters:

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

Returns:

distance – Distance travelled by projectile.

Return type:

float

simulate_projectile_multioutput(x)[source]#

Simulator to solve ODE system with multiple outputs.

Parameters:

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

Returns:

  • distance (float) – Distance travelled by projectile.

  • velocity (float) – Velocity of projectile at impact.

print_results(inputs, arg, var)[source]#

Convenience function for printing out generic results.

Parameters:
  • inputs (array) – Array of input values.

  • arg (array) – Array of mean values.

  • var (array) – Array of variance values.

Return type:

None.

print_predictions(inputs, pred, var)[source]#

Convenience function for printing predictions.

Parameters:
  • inputs (array) – Array of input values.

  • pred (array) – Array of mean values.

  • var (array) – Array of variance values.

print_errors(inputs, errors, var)[source]#

Convenience function for printing out results and computing mean square error.

Parameters:
  • inputs (array) – Array of input values.

  • errors (array) – Array of errors.

  • var (array) – Array of variance values.

Return type:

None.