Skip to content

Commit

Permalink
nonlinear finite difference example
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleniemeyer committed Feb 20, 2020
1 parent 4510d61 commit 2700ee9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions content/bvps/finite-difference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,26 @@
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: nonlinear BVP\n",
"\n",
"So far we've seen how to handle a linear boundary value problem, but what if we have a **nonlinear** BVP? This is going to be trickier, because our work so far relies on using linear algebra to solve the system of (linear) equations.\n",
"\n",
"For example, consider the 2nd-order ODE\n",
"\\begin{equation}\n",
"y^{\\prime\\prime} = 3y + x^2 + 10 y^3 \n",
"\\end{equation}\n",
"with the boundary conditions $y(0) = y(1) = 0$. This is nonlinear, due to the $y^3$ term on the right-hand side.\n",
"\n",
"To solve this, let's first convert it into a discrete form, by replacing the second derivative with a finite difference and any $x$/$y$ present with $x_i$ and $y_i$:\n",
"\\begin{equation}\n",
"\\frac{y_{i-1} - 2y_i + y_{i+1}}{\\Delta x^2} - 3y_i = x_i^2 + 10 y_i^3\n",
"\\end{equation}\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 2700ee9

Please sign in to comment.