Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

florimondmanca/roller-coaster-loops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roller coaster loops

Applying calculus to real-world physics to compute the shape of a roller coaster loop.

Requirements

This program should work on Python 2.7.x and 3.x.

Install

pip install -r requirements.txt

Usage

python main.py [C1, C2, ...]

Example

python main.py 2 3 4 5

Derivation

The derivation of equations is based on [1]. Scipy's default non-linear ODE solver is used instead of Euler's method.

The loop shape is computed so that the centripetal force a_c stays constant along the track segment:

a_c = C * g  # (1)

where C is a non-dimensional parameter.

We then derive the expression of the radius r along the track section.

The centripetal acceleration is commonly express as:

a_c = v ** 2 / r  # (2)

Using (1) and (2) we get:

r = v ** 2 / (G * g)  # (3)

But the conservation of energy gives us:

v ** 2 = v_0 ** 2 - 2 * g * y

And so:

r = 1 / C * (v_0 ** 2 / g - 2 * y)

The relationship between r the curvilinear abscissa s is:

Θ/s = 1/r

Besides, s can be related to the abscissa x and the height y of a given point of the track section using:

x/s = cos(Θ)
∂y/s = sin(Θ)

This allows us to write the final system of non-linear ODEs:

Θ/s = C / (v_0 ** 2 / g - 2 * y)
∂x/s = cos(Θ)
∂y/s = sin(Θ)

This system can be rewritten as

dZ/ds = f(s, Z)

where Z = (Θ x y) and:

f(s, Z) = (C / (v_0 ** 2 / g - 2 * Z[2]), cos(Z[0]), sin(Z[1]))

We use this expression to integrate the system of ODEs using scipy.integrate.ode. The final results are dislayed using matplotlib.

Future work

  • Improve the CLI experience (hint: use Click).
  • Plot G against s: G = v ** 2 / (r * g) + cos(Θ).
  • Add other scenarios, e.g. circular loop, triangular/trapezoid centripetal accelaration, etc.

Bibliography

[1]: Art of Engineering, The Real Physics Of A Roller Coaster, published 2019-05-09.

Releases

No releases published

Packages

No packages published

Languages