Mechanics of slender structures
ME-411
Python: Shooting Method Algorithm Implementation
This page is part of the content downloaded from Python: Shooting Method Algorithm Implementation on Sunday, 25 January 2026, 01:23. Note that some content and any files larger than 50 MB are not downloaded.
Description
The goal of this code is to compute the equilibrium shape of an elastic
sheet deformed by its own distributed weight.
To compute this shape, we numerically solve the ODE:
theta''(s) = Delta * (1 - s) * cos(theta(s))
with the boundary conditions:
theta(s=0) = pi/2 and theta'(s=1) = 0
This Boundary Value Problem (BVP) is solved using a "shooting method".
It is converted into an Initial Value Problem (IVP) by guessing the
value of theta'(s=0). The scipy.optimize.fsolve function (a root-finder)
iteratively calls an ODE solver (scipy.integrate.solve_ivp) to adjust
the initial guess until the solution satisfies the boundary condition
at s=1 (i.e., theta'(s=1) = 0).
Finally, the resulting shape is plotted.
Library Requirements:
- numpy: for numerical operations (pi, arrays, trigonometric functions)
- scipy: for the ODE solver (solve_ivp) and the root-finder (fsolve)
- matplotlib: for plotting the results