This document uses the open source Jupyter Notebook and the Python programming language to demonstrate a finite difference numerical method for solving a differential equation.

The basic differential equation of the elastic curve for a simply supported, uniformly loaded beam (Fig. 1) is given as

\begin{equation} EI \frac{d^2y}{dx^2} = \frac{wLx}{2} - \frac{wx^2}{2} \tag{3} \end{equation}

where $E=$ the modulus of elasticity, and $I=$ the moment of inertia. The boundary conditions are $y(0)=y(L)=0$. Solve for the deflection of the beam using the finite-difference approach $(\Delta x = 0.6 m)$. The following parameter values apply: $E = 200$ GPa, $I = 30,000$ cm$^4$, $w = 15$ kN/m, and $L = 3$ m. Compare your numerical results to the analytical solution:

\begin{equation} y = \frac{wLx^3}{12EI} - \frac{wx^4}{24EI} - \frac{wL^3x}{24EI} \tag{4} \end{equation}