# Finite Difference Method

## November 26, 2015 - Engineering

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.

%matplotlib inline

# Required libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Seaborn aesthetics
sns.set_context("paper", font_scale=1.8,
rc={"lines.linewidth": 3, "figure.figsize": (10,6)})
sns.set_style("ticks")


## Beam Deflection Problem

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

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

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:

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