{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
},
"colab": {
"name": "Week7_1_python.ipynb",
"provenance": [],
"collapsed_sections": [
"3rAVOakk8kFo",
"NyxXxJYb8kF2"
]
}
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "XNOS8Boi8kE3"
},
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "KCmCOlV-8gjz"
},
"source": [
"# Week 7 Lecture 1: Finite Differences\n",
"\n",
"This week we will begin discussing the concept of numerical differentiation. That is, we will be trying to numerically approximate the derivative(s) of a given function. we will look at this concept from two slightly different angles. One possibility is that we are given some function $f(x)$ and a point $x_0$ and we want to compute the derivative of $f$ at $x_0$. That is, we want to find $f'(x_0)$. If $f$ is relatively simple, then we already know how to do this from calculus, so we will generally assume that $f$ is either very complicated or that we do not have access to the formula. (For instance, we might be given a MATLAB function but not be able to read the code.) The other possibility is that we are given a set of data points $(x_0, y_0)$, $(x_1, y_1)$, $\\dotsc$, $(x_N, y_N)$ and we want to find out how fast the data points are changing at one of the points $(x_k, y_k)$. \n",
"\n",
"These two situations are not as different as they might sound, and it is easy to convert back and forth between them. If you are given a function $f(x)$, then you can simply plug in the numbers $x_0$, $x_1$, $\\dotsc$, $x_N$ to obtain all the necessary $y$-values and then forget about the function. Likewise, if you have a set of data, you can simply pretend that all of the $y$-values arose from some function $f(x)$, even if you don't know the formula. \n",
"\n",
"Both approaches are useful, but for different reasons. From a theoretical point of view, it really only makes sense to talk about the derivative of a function. There is no good rigorous definition of a derivative on a discrete set of points. We will therefore always assume that we have a function $f(x)$ when working by hand. However, in real world applications we almost never have access to the true formula that produced our data. Instead, we have a set of data points and it is either expensive or impossible to collect any more. When writing code, we will therefore almost always assume that we have a fixed set of $x$ and $y$ values, even if we really do know the function involved. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "T0OVrvFL8gj9"
},
"source": [
"## Forward difference scheme\n",
"Remember from your calculus class that the definition of a derivative is \n",
"\n",
"$f'(x) = \\displaystyle\\lim_{\\Delta x\\to 0}\\frac{f(x + \\Delta x) - f(x)}{\\Delta x}. \\hspace{1in}$ (1)\n",
"\n",
"This presents a problem for us because computing a limit requires infinitely many points. To find $f'(x)$ exactly, it is not enough to know $f(x + 0.1)$ or $f(x + 0.01)$ or $f(x + 0.001)$; we need to know $y$ values infinitely close to $f(x)$. Of course, finding infinitely many points or points that are infinitely close together is not possible on a computer, so we will have to settle for some sort of approximation. \n",
"\n",
"Equation (1) suggests a simple method of approximating the derivative. If $f'(x)$ is the limit of that difference quotient as $\\Delta x$ becomes arbitrarilly small, perhaps we can choose a small but fixed value for $\\Delta x$ and get a good approximation. That is, if we fix some small number $\\Delta x$ then we should have \n",
"\n",
"$f'(x) \\approx \\frac{f(x + \\Delta x) - f(x)}{\\Delta x}. \\hspace{1in}$ (2)\n",
"\n",
"It should be obvious from the definition of a limit that this is a valid approach. If we choose too large a $\\Delta x$ then we may get a bad approximation, but as we shrink $\\Delta x$ we will necessarily get closer and closer to the true value of $f'(x)$. Approximations of this form are called *difference schemes*, and this particular one is a *forward difference scheme*. The word \"forward\" refers to the fact that we are evaluating $f$ at the point $x$ that we care about and another point $x + \\Delta x$ ahead of that point. If you were standing on the number line at $x$, then you would have to look forward to see $x + \\Delta x$. \n",
"\n",
"A very important question to ask about any difference scheme is: \"How quickly do we converge to the true value $f'(x)$ as we shrink $\\Delta x$?\" That is, if we choose some small $\\Delta x$ then there will be some error between our approximation and the real $f'(x)$. If we choose a $\\Delta x$ that is ten times smaller, what will happen to our error? Will it also be ten times smaller? One hundred times smaller? Something else? We can analyze the error of all difference schemes in a systematic way using Taylor expansions. Remember that \n",
"\n",
"$f(x + \\Delta x) = f(x) + \\Delta x f'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{3!}f'''(x) + ... + \\frac{(\\Delta x)^n}{n!}f^{(n)}(x) + ...$\n",
"\n",
"For this equation to be an equality, we need infinitely many terms. Of course, the whole point of using a difference scheme was so that we could avoid doing something infinitely many times. Fortunately, when $\\Delta x$ is small, $(\\Delta x)^2$ or $(\\Delta x)^3$ or $(\\Delta x)^n$ will be *much* smaller. This means that, as long as $\\Delta x$ is small enough, we can safely ignore the terms with higher powers because they are very close to zero. We will use the notation $\\mathcal{O}(\\Delta x^n)$ to indicate which terms we are ignoring. We have already encountered this notation before, when counting the number of instructions required to solve a linear system. The idea here is the same: $\\mathcal{O}(\\Delta x^n)$ represents a polynomial in $\\Delta x$ where the largest term has a power of $n$. Notice that in the section on linear systems, the largest term was the one with the largest exponent because we were dealing with a variable $N$ that was very large. In this case, the largest term is the one with the smallest exponent because $\\Delta x$ is very small. This means that $\\mathcal{O}(\\Delta x^n)$ represents a polynomial where the smallest power of $\\Delta x$ is $n$. We can therefore rewrite our Taylor expansion as\n",
"\n",
"$f(x + \\Delta x) = f(x) + \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$. \n",
"\n",
"If we substitute this into the formula from (2), we get \n",
"\n",
"$f'(x) \\approx \\frac{1}{\\Delta x}\\left[f(x + \\Delta x) - f(x)\\right]$\n",
"\n",
"$\\approx \\frac{1}{\\Delta x}\\left[f(x) + \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4) - f(x)\\right]$\n",
"\n",
"$= \\frac{1}{\\Delta x}\\left[\\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right]$\n",
"\n",
"$= f'(x) + \\frac{\\Delta x}{2}f''(x) + \\frac{(\\Delta x)^2}{6}f'''(x) + \\mathcal{O}(\\Delta x^3)$. \n",
"\n",
"Notice that when $\\Delta x$ goes all the way to zero, everything but the first term goes away and we are just left with $f'(x)$. This is what we were trying to approximate in the first place, which is a good sign. We say that the difference scheme is *consistent*, because in the limit as $\\Delta x$ approaches zero it gives the correct value. \n",
"\n",
"Also note that when $\\Delta x$ is very small, raising it to a power makes it even smaller. In particular, $\\Delta x^2$ and $\\Delta x^3$ are much, much closer to zero than $\\Delta x$. This means that once $\\Delta x$ is sufficiently small, we don't really need to worry about any of the higher powers of $\\Delta x$. We can therefore write (for sufficiently small $\\Delta x$): \n",
"\n",
"$\\frac{f(x + \\Delta x) - f(x)}{\\Delta x} \\approx f'(x) + \\frac{\\Delta x}{2}f''(x)$. \n",
"\n",
"We call the second term in this equation the *leading error term*. It tells us approximately how far off our approximation is from the true value of $f'(x)$. Of course, we don't actually know $f''(x)$, so we don't know exactly what the error is. However, we do know that the error is proportional to $\\Delta x$ raised to the first power. This means that if we shrink $\\Delta x$ by a factor of ten, then the error will also shrink by a factor of ten. Likewise, if we shrink $\\Delta x$ by a factor of one hundred, then the error will also shrink by a factor of 100. Because of this, we say that our difference scheme is first order. We call equation (2) a *first order forward difference scheme* for $f'(x)$. It is important to remember that the phrase \"first order\" in this name refers to the power of $\\Delta x$ in the error, not to the fact that we are approximating a first derivative. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "gBQTjqDk8gj_"
},
"source": [
"## Backward difference scheme\n",
"In general, we like to keep $\\Delta x$ positive in these equations, but the definition of a limit makes no such assumptions. It therefore makes sense to consider negative $\\Delta x$'s as well. Instead of allowing $\\Delta x$ to change sign, we will make a small modification to our difference scheme and just replace every $\\Delta x$ in equation (2) with $-\\Delta x$. We obtain \n",
"\n",
"$f'(x) \\approx \\frac{f(x) - f(x - \\Delta x)}{\\Delta x}. \\hspace{1in}$ (3)\n",
"\n",
"This is called a *backward difference scheme* because it involves the point $x$ and a point behind $x$. (Again, if you imagine standing on the number line at $x$ then you would have to look backwards to see the point $x - \\Delta x$.) We can analyze the error properties of this scheme just like we did with the forward difference scheme. To do so, we need to adjust our Taylor expansion by replacing every $\\Delta x$ with a $-\\Delta x$. We get \n",
"\n",
"$f(x - \\Delta x) = f(x) - \\Delta x f'(x) + \\frac{(\\Delta x)^2}{2}f''(x) - \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$. \n",
"\n",
"(Notice that the notation $\\mathcal{O}(\\Delta x^4)$ is already ignoring any constants in front of the $\\Delta x^4$ term, so it does not matter if we say $+\\mathcal{O}(\\Delta x^4)$ or $-\\mathcal{O}(\\Delta x^4)$. By convention, we always use a + sign.)\n",
"\n",
"If we substitute this into formula (3), we obtain \n",
"\n",
"$f'(x) \\approx \\frac{1}{\\Delta x}\\left[f(x) - \\left(f(x) - \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) - \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right)\\right]$\n",
"\n",
"$= \\frac{1}{\\Delta x}\\left[\\Delta xf'(x) - \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right]$\n",
"\n",
"$= f'(x) - \\frac{\\Delta x}{2}f''(x) + \\frac{(\\Delta x)^2}{6} + \\mathcal{O}(\\Delta x^4)$. \n",
"\n",
"Once again, if $\\Delta x$ goes all the way to zero then every term disappears except for the $f'(x)$, so this difference scheme is also consistent. If $\\Delta x$ is very small, but not actually zero, then all the terms after the first two are so small that they don't really matter, so we can say that \n",
"\n",
"$\\frac{f(x) - f(x - \\Delta x)}{\\Delta x} \\approx f'(x) - \\frac{\\Delta x}{2}f''(x)$. \n",
"\n",
"The leading error term is therefore $-\\frac{\\Delta x}{2}f''(x)$, which has a $\\Delta x^1$. We therefore know that our difference scheme is first order, and so we call it a *first order backward difference scheme*. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WuKY1evb8gkA"
},
"source": [
"## Central difference scheme\n",
"The leading error terms for these forward and backward difference schemes have an interesting relationship. They are the same except for their sign. This means that if $f''(x)$ is positive then the forward difference scheme will overestimate $f'(x)$ by some amount and the backward difference scheme will underestimate by almost exactly the same amount. (The \"almost\" is important - we threw away higher order terms in those approximations because they were much smaller than the leading term, but those terms aren't exactly zero and they probably don't cancel.) This suggests a better difference scheme: What if we calculate the forward and backward difference approximations and then average them together? This gives us the following scheme: \n",
"\n",
"$f'(x) \\approx \\frac{1}{2}\\left(\\frac{f(x + \\Delta x) - f(x)}{\\Delta x} + \\frac{f(x) - f(x - \\Delta x)}{\\Delta x}\\right) = \\frac{f(x + \\Delta x) - f(x - \\Delta x)}{2\\Delta x}.\\hspace{1in}$ (4)\n",
"\n",
"This is called a *central difference scheme* because $x$ is in between the other points that we use. From the above argument, we have reason to hope that this scheme has better error properties than either of the original schemes alone. We can check this using Taylor expansions, just as we did before. We get \n",
"\n",
"$f'(x) \\approx \\frac{f(x + \\Delta x) - f(x - \\Delta x)}{2\\Delta x}$\n",
"\n",
"$= \\frac{1}{2\\Delta x}\\left[f(x) + \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4) - \\left(f(x) - \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) - \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right)\\right]$\n",
"\n",
"$= \\frac{1}{2\\Delta x}\\left[2\\Delta xf'(x) + \\frac{(\\Delta x)^3}{3}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right]$\n",
"\n",
"$= f'(x) + \\frac{(\\Delta x)^2}{6}f'''(x) + \\mathcal{O}(\\Delta x^3)$. \n",
"\n",
"Notice that when $\\Delta x$ goes all the way to zero, we are just left with $f'(x)$. This means that our new scheme is still consistent. The leading error term, however, is quite different in this scheme. In particular, it has a $\\Delta x^2$ in it, so the error is second order or $\\mathcal{O}(\\Delta x^2)$. This means that if we shrink $\\Delta x$ by a factor of 10, the error of the forward and backward difference schemes from above only shrinks by a factor of 10, but the error for the central difference scheme shrinks by a factor of $10^2 = 100$. We call this scheme a *second order central difference scheme*. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ri_gWt6q8gkC"
},
"source": [
"## Why use higher order schemes?\n",
"We are usually not just interested in finding $f'(x)$ at one point. Instead, we have a collection of many data points and we want to find $f'$ at all of them so that we will have a good approximation to the function $f'(x)$. In order to get a good approximation to $f'$, we need the error at each of these points to be small, which means we need to know $y$ values at points very close to all of our original data points. In practice, this means that if you want to make $\\Delta x$ smaller, then you have to collect data at many more points. In particular, if you want to make $\\Delta x$ ten times smaller, then you will typically need to collect ten times as much data. Data collection is often the most expensive part of an experiment, so it is important to use methods that don't require any more data than necessary. This is why we place such an emphasis on the order of the error term. It is not uncommon to encounter a situation like this; You plan to do an experiment that will require (at some point in the analysis) the approximation of a derivative. You collect some data for the pilot study and find that the error in this approximation is so large that you can't use the results. For the full study to be useful, you will need 100 times less error in your approximation. If you use a first order difference scheme, then you will need 100 times more data for the full study, which probably means that the full study will be around 100 times more expensive than the pilot. If you instead used a second order difference scheme, you would only need 10 times more data, which would bring down the cost by a factor of 10. \n",
"\n",
"It is entirely possible to craft higher order difference schemes as well. For some applications this is entirely justified, but in practice it often turns out that second order schemes have a good balance between accuracy and efficiency. Each of our difference schemes in this lecture have required evaluating $f$ twice for each derivative. It turns out that higher order schemes require evaluating $f$ at more points. If you are using a set of pre-computed data points, then this is not really a problem, but if $f$ is some more complicated and slow function, then it is a good idea to avoid evaluating it any more than necessary. This means that more accurate schemes can often become substantially slower. For this reason, it is common to only use second order accurate schemes unless you have a compelling reason not to. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "rB3iFRUb8kFN"
},
"source": [
"# Confirming Order\n",
"In the last lecture, we discussed several difference schemes for approximating the derivative $f'(x)$. The forward and backward difference schemes that we discussed were first order accurate (i.e., the error was $\\mathcal{O}(\\Delta x)$), while the central difference scheme was second order accurate (i.e., the error was $\\mathcal{O}(\\Delta x^2)$). \n",
"\n",
"Let's try to confirm this analysis with an example. In particular, let's use $f(x) = \\sin(x)$ and try to calculate $f'(x_0)$ at $x_0 = 1$. This is a simple enough problem that we know how to do it by hand. We have $f'(x) = \\cos(x)$, and so the true value of $f'(x_0)$ is $\\cos(1)$. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "cKIvqWSr8kFO",
"outputId": "8718d125-60d8-4098-9a43-b7efa5868903"
},
"source": [
"true_solution = np.cos(1)\n",
"print(true_solution)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"0.5403023058681398\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BX15iZp48kFQ"
},
"source": [
"Let's try to approximate this derivative with several different schemes. First, let's use a forward scheme. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "IUKokMwq8kFR"
},
"source": [
"## Forward Scheme\n",
"We are trying to approximate the derivative of $f(x) = \\sin(x)$ at $x_0 = 1$. We know that the actual derivative is $f'(x) = \\cos(x)$, so we can determine exactly how far off our approximations are. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "OmBBhmxW8kFT"
},
"source": [
"We want to use the forward difference scheme\n",
"\n",
"$f'(x_0) \\approx \\frac{f(x_0 + \\Delta x) - f(x_0)}{\\Delta x}$\n",
"\n",
"for various choices of $\\Delta x$. For example, "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "yhQ3ybh-8kFU",
"outputId": "ff904ca8-7d86-4486-cee6-9ea2cf883af2"
},
"source": [
"x0 = 1\n",
"dx = 1\n",
"forward_approx = (np.sin(x0 + dx) - np.sin(x0)) / dx\n",
"print(forward_approx)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"0.0678264420177852\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MKxo89nX8kFV"
},
"source": [
"The true solution is roughly 0.5403, so this is not a particularly good approximation. That is to be expected. Remember that all of our analysis in the last class relied on the idea that $\\Delta x^n$ got very close to zero as the power of $n$ got larger. This is valid when $\\Delta x$ is small, but not true at all when $\\Delta x$ is large. This means that we have no reason to expect our approximation is any good when $\\Delta x$ is large. \n",
"\n",
"We could try the same thing with a smaller $\\Delta x$. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "otQrqZpN8kFV",
"outputId": "4bc1b712-d4bb-49be-cf48-c178228d5ac3"
},
"source": [
"dx = 0.1\n",
"forward_approx = (np.sin(x0 + dx) - np.sin(x0)) / dx\n",
"print(forward_approx)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"0.4973637525353891\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "25KmUcBg8kFW"
},
"source": [
"This is certainly a better approximation than before, but it is still not particularly close. Let's continue this process with smaller and smaller $\\Delta x$'s. To make our analysis more convenient, we will collect all of our approximations in an array named `forward_approx`. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IxsH1ipQ8kFW",
"outputId": "8508524b-6382-44f2-8d56-3c5ea256d792"
},
"source": [
"forward_approx = np.zeros(5)\n",
"for k in range(5):\n",
" dx = (1e-1)**k\n",
" forward_approx[k] = (np.sin(x0 + dx) - np.sin(x0)) / dx\n",
"print(forward_approx.reshape(-1,1))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[0.06782644]\n",
" [0.49736375]\n",
" [0.53608598]\n",
" [0.53988148]\n",
" [0.54026023]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0wJX2xMu8kFX"
},
"source": [
"At each step we reduced $\\Delta x$ by a factor of 10. As you can see, the approximations get closer and closer to the correct answer. By the time we get to $\\Delta x = 0.0001$, we have the correct answer to at least four decimal places. \n",
"\n",
"We are interested in how the error changes, so it will be more useful to look at the error between our approximations and the true solutions. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "z-l1TOEL8kFX",
"outputId": "1099acbc-721f-45d2-defc-bb6b1700e69f"
},
"source": [
"print(abs((forward_approx - true_solution).reshape(-1,1)))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[4.72475864e-01]\n",
" [4.29385533e-02]\n",
" [4.21632486e-03]\n",
" [4.20825508e-04]\n",
" [4.20744495e-05]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DDiorxKD8kFX"
},
"source": [
"Notice the pattern of the errors. At each step, the error gets divided by 10. We also know that we divided $\\Delta x$ by 10 at each step, so this really is a first order method. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "rcB0jtzD8kFX"
},
"source": [
"## Backward Scheme\n",
"Now we will do the same thing with the backward scheme\n",
"\n",
"$f'(x_0) \\approx \\frac{f(x_0) - f(x_0 - \\Delta x)}{\\Delta x}$. \n",
"\n",
"The code looks almost exactly the same as before. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "kPWqrdMN8kFY",
"outputId": "4941db80-d8e6-494d-82a4-b27728f7e8d1"
},
"source": [
"backward_approx = np.zeros(5)\n",
"for k in range(5):\n",
" dx = (1e-1)**k\n",
" backward_approx[k] = (np.sin(x0) - np.sin(x0 - dx)) / dx\n",
"print(backward_approx.reshape(-1,1))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[0.84147098]\n",
" [0.58144075]\n",
" [0.54450062]\n",
" [0.54072295]\n",
" [0.54034438]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XBw_kdiz8kFd"
},
"source": [
"Again, these appear to be converging to the true solution ($\\approx 0.5403$) as $\\Delta x$ gets smaller. We can also look at the error like before: "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "eEJrg1sL8kFe",
"outputId": "ac454a0c-19a2-4985-af01-a330eb05a6aa"
},
"source": [
"print((backward_approx - true_solution).reshape(-1,1))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[3.01168679e-01]\n",
" [4.11384459e-02]\n",
" [4.19831487e-03]\n",
" [4.20645407e-04]\n",
" [4.20726487e-05]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "H6kMx3VU8kFe"
},
"source": [
"Once again, it looks like the error goes down by a factor of 10 at each step. (Actually, that does not appear to be true at the first step, where we reduced $\\Delta x$ from 1 to 0.1. Remember, though, that our results are only really supposed to be valid for sufficiently small $\\Delta x$.) Once $\\Delta x$ drops below about 0.1, it looks like every time we reduce $\\Delta x$ by a factor of ten, the error also goes down by a factor of ten. This means that the backward difference scheme is also first order. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "8LCa7LhB8kFf"
},
"source": [
"## Central Scheme\n",
"Now we will do the same thing with the central scheme\n",
"\n",
"$f'(x) \\approx \\frac{f(x_0 + \\Delta x) - f(x_0 - \\Delta x)}{2\\Delta x}$.\n",
"\n",
"Once again, the code looks essentially the same. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "NWf20t5S8kFg",
"outputId": "1f5986ba-6c06-41ac-b77e-71c9cc606115"
},
"source": [
"central_approx = np.zeros(5)\n",
"for k in range(5):\n",
" dx = (1e-1)**k\n",
" central_approx[k] = (np.sin(x0 + dx) - np.sin(x0 - dx)) / (2 * dx)\n",
"print(central_approx.reshape(-1,1))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[0.45464871]\n",
" [0.53940225]\n",
" [0.5402933 ]\n",
" [0.54030222]\n",
" [0.5403023 ]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_lf3aSQf8kFg"
},
"source": [
"As with the other two schemes, it seems clear that these are approaching the true solution $0.5403$, but we need to look at the error values to see how fast we are approaching the correct answer. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "syPnsbFq8kFh",
"outputId": "86262919-aff5-4783-97ad-fb6125247339"
},
"source": [
"print((central_approx - true_solution).reshape(-1,1))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[[-8.56535925e-02]\n",
" [-9.00053698e-04]\n",
" [-9.00499341e-06]\n",
" [-9.00504503e-08]\n",
" [-9.00429620e-10]]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cyHkfSSi8kFj"
},
"source": [
"This time the error values look substantially different. In particular, they are decreasing by a factor of 100 every time we reduce $\\Delta x$ by a factor of 10. This means that the central difference scheme really is second order. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "wlxFKwn4FuQv"
},
"source": [
"## How good is our approximation?\n",
"\n",
"Lets compare the forward and central difference schemes"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 307
},
"id": "czLIS3xgGPQo",
"outputId": "e010d7ea-aba2-4d73-acd5-14a5d2fb902e"
},
"source": [
"dx = (1e-1)**np.array([0, 1, 2, 3, 4])\n",
"plt.loglog(dx, abs(forward_approx - true_solution), dx, abs(central_approx - true_solution), linewidth = 4)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[,\n",
" ]"
]
},
"metadata": {
"tags": []
},
"execution_count": 26
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEACAYAAACwB81wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0R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ERvXfxEvhrgZHGmKHGmDTgBuDtLu4pmul+hUb3KzS6Xx0X0XsXc4FvjHkdeBcYbYypNMZ83VrbAtwGLATKgDettZu6ss9oofsVGt2v0Oh+dVxX3LuYm5YpIiIdE3Pv8EVEpGMU+CIiCUKBLyKSIBT4IiIJQoEvIpIgFPgiIglCgS8ikiAU+CIiCUKBLyKSIP4P1JlX1+DriuUAAAAASUVORK5CYII=\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "7Vm3vIVZI9EQ",
"outputId": "1ecd0747-df3e-489d-d375-244fe4ad113f"
},
"source": [
"Slope1 = (np.log10(abs(forward_approx[-1] - true_solution))-np.log10(abs(forward_approx[0] - true_solution)))/(np.log10(dx[-1])-np.log10(dx[0]))\n",
"Slope2 = (np.log10(abs(central_approx[-1] - true_solution))-np.log10(abs(central_approx[0] - true_solution)))/(np.log10(dx[-1])-np.log10(dx[0]))\n",
"print('\\n Forward Slope = ', Slope1, '\\n Central Slope = ', Slope2)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"\n",
" Forward Slope = 1.0125902962860651 \n",
" Central Slope = 1.9945739524957418\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bw2Up5UFJ35l"
},
"source": [
"Notice that the second slope is twice that of the first. Since we are using log-log scale, the accuracy of central approximation will be the square of the first. To convince you lets do the following:"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ZMsLhw_WJ7FX",
"outputId": "7fd9d150-d18b-47ec-ea17-ce291afbd598"
},
"source": [
"print('\\n Central Slope with dx^2 = ', (np.log10(abs(central_approx[-1] - true_solution))-np.log10(abs(central_approx[1] - true_solution)))/(np.log10(dx[-1]**2)-np.log10(dx[1]**2)))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"\n",
" Central Slope with dx^2 = 0.9999697746748636\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lJyVJd_PKUqp"
},
"source": [
"Viola! After we square the timestep we see that this is the same value as forward differences. Actually this tells us for this particular case central differences is even more accurate than we theorized. We can also see this visually:"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 307
},
"id": "K83D8w8-KUZT",
"outputId": "10191b65-63d8-4f42-839e-fadfa9ee98a0"
},
"source": [
"plt.loglog(dx, abs(forward_approx - true_solution), dx**2, abs(central_approx - true_solution), linewidth = 4)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[,\n",
" ]"
]
},
"metadata": {
"tags": []
},
"execution_count": 29
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEACAYAAACwB81wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3dZ5xV1b3/8c86Uxl678MMvYyCgqAoVdChCGrijRpvNJoYTfTGGxULSFURS0zs+ldsN9EYY4E4dKSJBbDB0EHKIL0MZRimrf+DjfciZ4/MnH1mz5xzvu9ns3+Hs36v/Rq+HNZZey1jrUVERKJfoLIbEBERfyjwRURihAJfRCRGKPBFRGKEAl9EJEYo8EVEYoQCX0QkRijwRURiRLxfAxljqgPPAQXAAmvt3/waW0REPH7CN8ZMNcbsMcasOu16pjFmnTFmozHm3pOXrwTetdb+FhjhZVwRESk/r5/wXwOeAd744YIxJg54FhgM5ADLjDHTgBbAypMvKy7Lmzdo0MCmpaV5bFFEJLasWLFin7W24enXPQW+tXaRMSbttMs9gY3W2s0Axpi3gZE44d8C+Joy/s8iLS2N5cuXe2lRRCTmGGO2ul2viC9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uV/nofrnTskwRkRihT/giIjFCgS8iEiMU+CIiMUKBLyISIxT4IiIxQoEvIhIjFPgiIjFCgS8iEiMU+CIiMeL/AxUXBpOMV7BDAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jHOx9qWV8kFk"
},
"source": [
"## Approximating over entire intervals\n",
"Now let's consider a very common situation: We have a list of $x$ values $x_0 < x_1 < \\cdots < x_N$. We want to approximate $f'(x_k)$ at *every* point in this list. For example, suppose $f(x) = \\sin(x)$ as before and we have the $x$ values 0, 0.1, 0.2, $\\dotsc$, 5.9, 6. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "JELQDCuz8kFk"
},
"source": [
"x = np.arange(0, 6.1, 0.1)\n",
"n = x.size"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Au_4GEBz8kFl"
},
"source": [
"We will collect all of these approximations in a vector named `deriv`, so that the first entry of `deriv` corresponds to the derivative at the first $x$ value, etc. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "NWbNoVzR8kFl"
},
"source": [
"deriv = np.zeros(n)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "mrnUJDja8kFl"
},
"source": [
"We can use any of our difference schemes for this problem. For no particular reason, let's use the central difference scheme for each point. We have to choose some value for $\\Delta x$ as well, so let's start with $\\Delta x = 1$. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "7iVnqh8o8kFm"
},
"source": [
"dx = 1\n",
"for k in range(n):\n",
" deriv[k] = (np.sin(x[k] + dx) - np.sin(x[k] - dx)) / (2 * dx)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "gSvkIl6V8kFm"
},
"source": [
"We can see how good our approximation is in a couple of ways. To start, we could plot our approximation alongside the true solution $f'(x) = \\cos(x)$. "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 299
},
"id": "O1D-S2hA8kFm",
"outputId": "176a7380-fa21-4971-e941-55beeb5bcd3f"
},
"source": [
"plt.plot(x, np.cos(x), 'k', x, deriv, 'r--', linewidth = 4)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[,\n",
" ]"
]
},
"metadata": {
"tags": []
},
"execution_count": 33
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CAYAAADhNOGaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deZxN9f/A8dfHjLHv66Bs6SdCMaGI8k3pqxC+KYqvVFRKlrJmz5KKtEgklCzhW1ola5KyNGSpbCljG2QfZnv//jh3xj1z7zBj7twz99738/E4D/e8z+fc+74z5r7vOedzPh8jIiillApduZxOQCmllLO0ECilVIjTQqCUUiFOC4FSSoU4LQRKKRXiwp1O4GqULFlSKlWq5HQaSikVUDZt2nRMREqljQdkIahUqRIbN250Og2llAooxpj93uJ6akgppUKcFgKllApxWgiUUirEaSFQSqkQp4VAKaVCnE8KgTFmhjHmqDFmWzrbjTFmsjFmtzFmqzGmrtu2LsaYXa6liy/yUUoplXG+6j46E3gLmJ3O9nuBaq6lATAFaGCMKQ4MA6IAATYZY5aIyD8+yitV8+bNOXz4MJGRkR5LpUqVqFu3LuHhAdmbVimlssQnn3wissYYU+kyTVoDs8Ua83q9MaaoMSYSuANYJiInAIwxy4AWwFxf5OVu+/btHDp0iG3bvB60ULRoUe655x5atmxJixYtKFXK454LpZQKSv66RlAe+Ntt/YArll7cgzHmSWPMRmPMxtjY2Ey9eFJSEkeOHLlsm5MnTzJ//nw6d+5MmTJluPXWW5k5cyYJCQmZei2llAo0AXOx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1kGPunXrsmrVKr1zOMSlNwy1zkatQkaVKlVYunQpTZs25eTJk6nx3r17c+LECUaMGIHVkzmD0hum+dgxq6vpvn1WsUhPWJjV9bNWLahd2/r39ts9u69m0IULF+jQoQNL0gw3UblyZb788kstAipdWghUSKlduzZffPEFzZs3t421M2rUKGJjY3nrrbcICwvL2ouULQu7d0N8POzZA0eOWB/64eHWEhYGefNClSrWvz5w9uxZ2rRpw/Lly23xChUqsHTpUsqWLeuT11HBSU8NqZC0bNky2rRpw/nz9vEPH3zwQWbPnh1Q8/SePHmSli1bsm7dOlu8SpUqLF++nEpuU1Kq0KYzlCnlpnnz5ixfvpzixYvb4gsWLOC+++7j7NmzDmWWOXv37qVp06YeRaBGjRp8//33WgRUhmghUCGrYcOGfP/995QvX94W/+6772jQoAHbt293KLOM+eKLL6hXrx5bt261xevWrcvq1aspV66cQ5mpQKOFQIW0GjVq8MMPP3D99dfb4jt27OCWW27hgw8+IKedPk1KSmLIkCHcf//9toveAI0aNWLFihWULFnSoexUINJCoEJexYoVWbt2LfXq1bPF4+LieOyxx+jcuXOOOVUUGxvLPffcw8svv+yxrV27dixdupQiRYo4kJkKZFoIlAJKlSrFqlWrePTRRz22ffTRR9SrV4/169c7kJklOTmZWbNmUatWLY+eQWFhYbz22mt88sknFChQwKEMVSDTQqCUS8GCBZk1axYzZswgX5rhnP/44w9uvfVWHn74Yf708zSWmzdvpnHjxvz3v//lyJEjtm1ly5Zl5cqV9OnTJ3P3QCjlRguBUm6MMXTt2pWNGzdSs2ZNj+3z5s2jevXqDBgwgFOnTmVrLseOHaN79+5ERUXx448/emxv0qQJv/zyC7fffnu25qGCnxYCpbyoUaMGP//8M926dfPYdvHiRcaPH0+1atUYOnQou3fv9tnrigg//vgjXbp04ZprruG9997zuFidJ08ehg8fzvLly/VGMeUTekOZUlewYsUK+vbtS3R0dLptGjVqRJcuXXjwwQev6mLt0aNH+eSTT5g6dSq//vpruu3atGnD66+/TuXKlTP9Gkqld0NZlgqBMeY/wH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pYxJq8x5mdjzBbXexnhdE5ZYYwJM8b8Yoz5wulcssIY86cx5ldjTLQxJqBHqjTGFDXGLDTG/GaM2WmMudVnzx0q1wiMMWHAH0BzrGkxNwAPi8gORxO7CsaYJsBZYLaI3Oh0PlfLGBMJRIrIZmNMIWAT0CZAfycGKCAiZ40xuYG1QC8RWe9walfFGNMHiAIKi8h9TudztYwxfwJRIhLwN5MZY2YB34vIdNfcLvlF5KQvnjuUjgjqA7tFZK+IxAPzgNYO53RVRGQNcMLpPLJKRA6JyGbX4zNY81WkO291TiaWs67V3K4lIL9lGWMqAC2B6U7noizGmCJAE1xztohIvK+KAIRWISgP/O22foAA/dAJRsaYSsDNwE/OZnL1XKdTooGjwDIRCdT3Mgl4EUh2OhEfEOBbY8wmY8yTTieTBZWBWOAD1ym76caYAr568lAqBCqHMsYUBBYBz4vIaafzuVoikiQiN2HNv13fGBNwp+2MMfcBR0Vkk9O5+EhjEakL3As84zqtGojCgbrAFBG5GTgH+Ow6ZygVghjgGrf1Cq6YcpDrfPoiYI6ILHY6H19wHbKvBFo4nctVaAS0cp1bnwc0M8Z85GxKV09EYlz/HgX+h3WKOBAdAA64HWUuxCoMPhFKhWADUM0YU9l1oeUhYInDOYU01wXW94GdIvK60/lkhTGmlDGmqOtxPqxOCb85m1XmichAEakgIpWw/kZWiMgjDqd1VYwxBVydEHCdRrkbCMiediJyGPjbGPN/rtC/AJ91qgj31RPldCKSaIzpCSwFwoAZIrLd4bSuijFmLnAHUNIYcwAYJiLvO5vVVWkEPAr86jq3DjBIRL5yMKerFQnMcvVOywUsEJGA7noZBMoA/7O+bxAOfCwi3zibUpY8C8xxfZHdC3T11ROHTPdRpZRS3oXSqSGllFJeaCFQSqkQp4VAKaVCnBYCpZQKcVoIlFIqxGkhUEqpEKeFQCmlQtz/A/R8w9oci2x4AAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4mAkJYNu8kFm"
},
"source": [
"or we can plot the error (i.e., the difference between our approximation and the true solution). "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 282
},
"id": "DJ9PeHcn8kFm",
"outputId": "5857de96-ad0a-44e4-9e5f-b34e988153ba"
},
"source": [
"err = abs(deriv - np.cos(x))\n",
"plt.plot(x, err, 'k', linewidth = 4)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 34
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXwUVdY//s/JDkkgQMK+BMSwK0sEA5gQNgkgyCMiqOMyDqCjo46O8/NxnlHEmZ86qOgMOMrIuCOguKCsCmJAtoTIGghECBC2hBCWANnP9480TW5Vh3TSS3VVn/frlRe5tyvdp0n3ye1Tt+4lZoYQQgjrCjA6ACGEEJ4liV4IISxOEr0QQlicJHohhLA4SfRCCGFxQUYHoBUdHc2xsbFGhyGEEKaybdu208wc4+g2n0v0sbGxSE9PNzoMIYQwFSI6XNNtUroRQgiLk0QvhBAWJ4leCCEszqlET0SjiCiLiLKJ6FkHtycSUQYRlRPRRM1t7YloNRHtJaJMIop1T+hCCCGcUWuiJ6JAAHMBpADoDmAKEXXXHHYEwAMAFji4i48AzGLmbgD6A8hzJWAhhBB148yIvj+AbGY+yMylABYCGF/9AGbOYeadACqr99v+IAQx8/e244qY+ZJ7QlcVFxd74m6FEML0nJle2QbA0WrtXAADnLz/OABniehLAB0B/ADgWWauqH4QEU0DMA0A2rdv7+RdX3Xx4kU0adIE119/Pfr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MqyGhGNBZDHzNuMjsVNBjNzXwApAB61lT7NKAhAXwD/ZuY+AC4CcNu5Rqsketmy0EfZatpLAHzKzF8aHY+rbB+nfwQwyuhY6mkQgHG22vZCAEOJ6BNjQ6o/Zj5m+zcPwFeoKuOaUS6A3GqfFL9AVeJ3C6skeme2OxReZjuJOR/AXmZ+w+h46ouIYogoyvZ9A1Sd9N9nbFT1w8z/y8xtmTkWVe+Ttcx8r8Fh1QsRhdtO8sNW5hgJwJSz1Zj5JICjRNTF1jUMVTvzuUWtWwmaQU3bHRocVr0Q0WcAhgCIJqJcAC8w83xjo6q3QQB+A2CXrb4NAM8x83IDY6qPVgA+tM3uCgCwmJlNPS3RIloA+KpqPIEgAAuYeaWxIbnkDwA+tQ1WDwJ40F13bInplUIIIWpmldKNEEKIGkiiF0IIi5NEL4QQFieJXgghLE4SvRBCWJwkeiGEsDhJ9EIIYXH/D01ltreJ1aMSAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "GcsuVppE8kFn"
},
"source": [
"Notice the scale on the $y$ axis here. Our approximation is off by roughly $\\pm 0.2$. If we decrease $\\Delta x$, we can make this more accurate. For example, "
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 293
},
"id": "CwGdpF9q8kFn",
"outputId": "83f33a50-e9ca-46c9-c0c3-434668ab83fd"
},
"source": [
"dx = 0.01\n",
"deriv = np.zeros(n)\n",
"for k in range(n):\n",
" deriv[k] = (np.sin(x[k] + dx) - np.sin(x[k] - dx)) / (2 * dx)\n",
"err = abs(deriv - np.cos(x))\n",
"plt.plot(x, err, 'k', linewidth = 4)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 35
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgA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MLNhFuJ9992H3r17K4rIPNHR0YaJNpmZmdi3b5+agIRBZmam5izLCq15QBJ9vRGR4RR64cKF2L59u6KIhK+1a9ciJydHU6fvxrGzqVOnonv37t6y2+3G3//+d4URicsqKysNjb4HH3xQeWsekETfIGPHjkVKSoqm7i9/+YuiaIQvfdKbOHGiJjHaXWRkpKFV/+6778Iqy4aEM6u25gFJ9A3ir1U/f/58OYVWbPfu3Yb1vvUzE53gzjvvRMeOHb3l8vJyvP766wojEi6Xy9CanzZtGjp06FDDM0JLEn0D3Xrrrejbt6+3zMyOuOBnZy+//LKmPHjwYMP1FCeIiorCE088oambNWsWysrKFEUkvvjiCxw+fNhbbtKkiaW6DCXRN1BERIRhDZz33nsPR48eVRRReDt58iTee+89Td1vfvMb246br8u0adM0a+CcPn0a8+bNUxhReNMvaX7fffdZpjUPSKJvlDvvvFOz1K3L5cJ//vMfhRGFr3/961+apWA7d+6M22+/XWFEwXXFFVfgwQcf1NS98sorsv6SAjt37kRWVpam7vHHH1cUjX+S6BshMjISTz75pKbujTfekFPoELt06ZKhj/rJJ5+07KYiZnn88ccREfHjV3jHjh1YtWqVwojC07/+9S9NOSMjA/369VMUjX+S6BtpypQpaNasmbd89uxZfPzxxwojCj9z5szRbPjdokULPPDAA+oCCpHk5GTccccdmrp//OMfiqIJT4WFhXj33Xc1dVZrzQOS6BstPj7ekFRkF6DQqaqqMqzP/uijjyI+Pl5RRKGlP6NcunQp9uzZoyia8DNnzhzN9o4dOnTApEnW2zFVEr0JHn30UU35m2++MUzaEcGxcOFCzboiMTExmDFjhsKIQmvIkCFIS0vT1L366quKogkvLpfL0Kh79NFHERUVpSiimkmiN0HXrl0xduxYTZ206kNDv1n7fffdh9atWyuKRo1f//rXmnJmZibOnj2rKJrw8cUXX2gaGbGxsYYL5FYhid4kjz32mKY8b9482QUoyA4fPoyVK1dq6sKpNX/ZHXfcgWuuucZbLisrM2wsLsynH1L505/+FC1btlQUTe0k0Zvklltu0cxWLCsrw1tvvaUwIud78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/qjoeM3hOqbMAjFcdSwMMBTDR07f9IYAbiOg9tSE1HDMf9/x7GsBnqO7GtaNjAI75nCUuQHXiN4VTEn0g2x2KEPNcwJwDYA8z/0N1PI1BRK2I6ErPz3GovvC/V21U9cfMTzNze2ZORvX3ZDUzT1UcVoMQUbznIj883RxjAdhytBoz/wAgn4i6eapGo3pnPlPUuZWgHdS03aHisBqEiOYBGAmgJREdA/AsM89RG1WDDQVwH4Adnr5tAPg9M3+pMKaGagPgHc8IrwgA85nZ1kMTHaA1gM+q2xOIAvABMy9TG1Kj/BLA+57G6vcAfm7WCztieKUQQoiaOaXrRgghRA0k0QshhMNJohdCCIeTRC+EEA4niV4IIRxOEr0QQjicJHohhHC4/weGxy1oE9IKKgAAAABJRU5ErkJggg==\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "x6HMbfR78kFn"
},
"source": [
"Again, note the scale on the $y$ axis. We reduced $\\Delta x$ by a factor of 100 and the error fell by a factor of $100^2 = 10,000$. This once again confirms that the central scheme is second order. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "3rAVOakk8kFo"
},
"source": [
"# Older notes: \n",
"## Approximating Derivatives From Data\n",
"To see why we might care about higher order schemes, let's change our scenario slightly. Instead of knowing $f(x)$ and a list of $x$ values, let's instead suppose that we only have a list of points: $(x_0, y_0)$, $(x_1, y_1)$, $\\dotsc$, $(x_N, y_N)$. We assume that these $y$ values come from some function $f(x)$, so that $f(x_k) = y_k$, but we don't know the formula for this function. We will further assume that the $x$ values are evenly spaced and we will call the distance between two subsequent $x$ values $\\Delta x$. That is, $x_k = x_0 + k\\Delta x$. Everything we do below still works fine if the $x$ values are not evenly spaced, but it becomes much more tedious to write down the formulas. \n",
"\n",
"For example, suppose we are given the data"
]
},
{
"cell_type": "code",
"metadata": {
"id": "A9rsE_8p8kFo"
},
"source": [
"x = np.arange(0, 6.1, 0.1)\n",
"y = np.sin(x)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "CJ45qFXo8kFo"
},
"source": [
"Of course, you can tell from this code that the function is really $f(x) = \\sin(x)$, but we will pretend that we don't have access to this function. (Usually the $y$ values come from actual data, so you really don't know the function $f$.) We want to do the same thing as before: Approximate $f'(x_k)$ at each of the given $x$ values and store our approximations in the array `deriv`. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "mxGuvDN38kFp"
},
"source": [
"n = x.size\n",
"deriv = np.zeros(n)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "BeWx-V0p8kFt"
},
"source": [
"Unfortunately, our old code will not work. The problem is that we used the function $f$ many times in that code. Every time through the loop we used both `f(x[k] + dx)` and `f(x[k] - dx)`. Since we don't know $f$, neither of these is possible. However, both of these are $$ values of the function. If we choose our $\\Delta x$ correctly, the hope is that we can use some of the $y$ values we already know rather than plugging anything into the function $f$. \n",
"\n",
"In particular, since the $x$ values are each spaced $0.1$ apart, let's choose $\\Delta x = 0.1$. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "0hTKvFC18kFu"
},
"source": [
"dx = 0.1"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "EFxJ1fpG8kFu"
},
"source": [
"As an example, let's try to approximate $f'$ at the 21st $x$ value:"
]
},
{
"cell_type": "code",
"metadata": {
"id": "no4_TKwV8kFv",
"outputId": "c25ee046-e06a-4078-f6cf-65b669a80718"
},
"source": [
"print(x[20])"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"2.0\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4bUaI_Qj8kFv"
},
"source": [
"That is, we want to find $f'(2)$. We don't actually have the function $f(x)$, but if we did we could write \n",
"\n",
"`deriv[20] = (f(x[20] + dx) - f(x[20] - dx)) / (2 * dx)`\n",
"\n",
"Since $\\Delta x = 0.1$, this translates to \n",
"\n",
"`deriv[20] = (f(x[20] + 0.1) - f(x[20] - 0.1)) / (2 * 0.1)`\n",
"\n",
"or\n",
"\n",
"`deriv[20] = (f(2.1) - f(1.9)) / (2 * 0.1)`\n",
"\n",
"We don't know the function $f$, but 2.1 and 1.9 are actually two of the $x$ values from our original data set. They are `x[21]` and `x[19]`. This means that we already know $f(2.1)$ and $f(1.9)$ - they are just `y[21]` and `y[19]`. This means that we can calculate the desired derivative with "
]
},
{
"cell_type": "code",
"metadata": {
"id": "hDwvEBmq8kFv"
},
"source": [
"deriv[20] = (deriv[21] - deriv[19]) / (2 * dx)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "ODYDKXLa8kFv"
},
"source": [
"A little experimentation will show that this works for almost every one of our $x$ values. (We will see why the \"almost\" is there in a moment.) If you want to approximate the derivative of $f$ at `x[k]`, you can use the fact that `x[k] + dx = x[k + 1]` and that `x[k] - dx = x[k - 1]`, and so the corresponding $y$ values are `f(x[k] + dx) = y[k + 1]` and `f(x[k] - dx) = y[k - 1]`. We can therefore try the code \n",
"\n",
"`for k in range(n):\n",
" deriv[k] = (y[k + 1] - y[k - 1]) / (2 * dx)`\n",
" \n",
"Unfortunately, if you try to run this code you will immediately encounter an error. The problem arises when we try to compute $f'(x_0)$, which is `deriv[0]` in code, and when we try to compute $f'(x_N)$, which is `deriv[n-1]` in code. Let's look at the first one. When $k = 0$ (that is, when we are trying to find $f'$ at the first $x$ value) we need `y[1]` and `y[-1]`. Unfortunately, the code `y[-1]` does not actually give us what we want. It doesn't cause an error, but it gives the last $y$ value, which is actually $y_N$. However, in order to use a central scheme at $x_0$ we would need to know $f(x_0 - \\Delta x)$, and $x_0 - \\Delta x = -0.1$, which is not one of our original data poitns. This means that we don't know the corresponding $y$ value, so it is impossible to use this difference scheme. The only solution (without calculating more $y$ values) is to use a different kind of scheme. In particular, we can use a forward difference scheme. This translates to \n",
"\n",
"$f'(x_0) \\approx \\frac{f(x_0 + \\Delta x) - f(x_0)}{\\Delta x}$. \n",
"\n",
"In code, this is `(f(x[0] + dx) - f(x[0])) / dx`, which is the same as `(f(x[1]) - f(x[0])) / dx`. This means that we can write the forward difference scheme solely in terms of the original data. \n",
"\n",
"Similarly, when $k = n - 1$ (that is, when we are trying to find $f'$ at the last $x$ value) we need `y[n-2]` and `y[n]`. Unfortunately, `y[n]` does not exist. The problem is that this is one after the last $y$ value in our data, so it is not one of our original data points. The only solution (without calculating more $y$ values) is to use a backward difference scheme. This translates to \n",
"\n",
"$f'(x_N) \\approx \\frac{f(x_N) - f(x_N - \\Delta x)}{\\Delta x}$. \n",
"\n",
"In code, this is `(f(x[n-1]) - f(x[n-1] - dx)) / dx`, which is the same as `(f(x[n-1]) - f(x[n-2])) / dx`, which is just `(y[n-1] - y[n-2]) / dx`. This means that we can also write the backward scheme solely in terms of the original data. \n",
"\n",
"We now have a full solution to our problem: We can use the central scheme (or any other scheme we want) for every point except the first and the last. For the first point, we need to use a forward difference scheme and for the last point we need to use a backward difference scheme. We can therefore write "
]
},
{
"cell_type": "code",
"metadata": {
"id": "N_BXwham8kFw"
},
"source": [
"deriv[0] = (y[1] - y[0]) / dx\n",
"for k in range(1, n - 1):\n",
" deriv[k] = (y[k + 1] - y[k - 1]) / (2 * dx)\n",
"deriv[n - 1] = (y[n - 1] - y[n - 2]) / dx"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "7_bHeWyA8kFx"
},
"source": [
"We can check our solution by plotting it alongside the actual derivative"
]
},
{
"cell_type": "code",
"metadata": {
"id": "WdhG7WzI8kFx",
"outputId": "d82d5d0d-76b6-4776-f696-41e1524db5fc"
},
"source": [
"plt.plot(x, np.cos(x), 'k', x, deriv, 'r')"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[,\n",
" ]"
]
},
"metadata": {
"tags": []
},
"execution_count": 26
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CA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i0t076QLAZydVhPnqjfydqpaJyB3AfCAUeEVV1zuOVS0i8hZwLhAtIpnAo6r6sttU1TIMuA5Y6923DvCQqs5zF6na2gKvec9OCwFmq2pAn3pZD8QCH1T8vUEY8Kaqfu42Uo3cCbzh/UN2G3CDr944aE4fNcYYU7Vg2jVkjDGmClYExhgT5KwIjDEmyFkRGGNMkLMiMMaYIGdFYIwxQc6KwBhjgtz/Ax7JENCbqj6HAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UjPMJS1Q8kFx"
},
"source": [
"or by plotting the error"
]
},
{
"cell_type": "code",
"metadata": {
"id": "ud1E027X8kFx",
"outputId": "006bb853-0b7b-46fd-e78a-4f6d26218300"
},
"source": [
"plt.plot(x, deriv - np.cos(x), 'k')"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 27
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAD8CAYAAACPWyg8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAkZklEQVR4nO3deZBV9Z338feX7oZuVFAEFbppQWwizSp0UFxAUBaVRWSRRaQmVUOZGlPJ5I88GJNK8kymJjNTlVhJfJIwzlioCEEQIdBsNquiLAKCyNINCdLsNMUiSzdNf58/+sBcyG26Ty/cvrc/r6pTZ/v9zvmepOwP53fuvcfcHRERkTAaxboAERGJPwoPEREJTeEhIiKhKTxERCQ0hYeIiISm8BARkdBqJTzMbIiZ7TazAjObGmW/mdlvg/3bzKxnZX3N7D/NbFfQfp6Z3R5sb2dmF8xsazD9sTauQUREqq7G4WFmScAbwNNANjDezLKva/Y0kBVMU4A/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IiEpvAQEZHQFB4iIhKawkNEREL7/0d2dffiy8MYAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "yPDYlPNT8kFy"
},
"source": [
"The error for the first and last points is quite different from the error for the middle points. This is because we used different schemes with different error terms. How can we reduce this error? The obvious approach would be to reduce $\\Delta x$, but if you try just setting `dx = 0.01`,you will find that the approximation gets much worse. The problem is that our original $x$ values were all 0.1 apart, so we cannot find appropriate $y$ values if we choose $\\Delta x$ any smaller than 0.1. The only way to make $\\Delta x$ any smaller is to get more data points in the first place. (Usually this requires paying someone to go and collect more data, which rapidly gets very expensive.) For example, we could try "
]
},
{
"cell_type": "code",
"metadata": {
"id": "q7bct_6F8kFy"
},
"source": [
"dx = 0.01\n",
"x = np.arange(0, 6.01, 0.01)\n",
"y = np.sin(x)\n",
"\n",
"n = x.size\n",
"deriv = np.zeros(n)\n",
"deriv[0] = (y[1] - y[0]) / dx\n",
"for k in range(1, n - 1):\n",
" deriv[k] = (y[k + 1] - y[k - 1]) / (2 * dx)\n",
"deriv[-1] = (y[-1] - y[-2]) / dx"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "ral77W-S8kFz"
},
"source": [
"This is almost the same code as before, but notice that there are ten times as many $x$ and $y$ values. If we look at the error now, we get "
]
},
{
"cell_type": "code",
"metadata": {
"id": "r9zTOAwW8kF0",
"outputId": "5e212981-7c78-40ae-ccfd-7f44dfdcf7ab"
},
"source": [
"plt.plot(x, deriv - np.cos(x), 'k')"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 29
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAD4CAYAAAAUymoqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjM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"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "tU9kBQoI8kF0"
},
"source": [
"The scale of the $y$ axis did get smaller. In particular, it is about ten times smaller. If we try the same thing with $\\Delta x = 0.001$, we get "
]
},
{
"cell_type": "code",
"metadata": {
"id": "lB03eiS88kF1",
"outputId": "47f6a92c-d45d-4ad2-80ff-0256598ff522"
},
"source": [
"dx = 0.001\n",
"x = np.arange(0, 6.001, 0.001)\n",
"y = np.sin(x)\n",
"\n",
"n = x.size\n",
"deriv = np.zeros(n)\n",
"deriv[0] = (y[1] - y[0]) / dx\n",
"for k in range(1, n - 1):\n",
" deriv[k] = (y[k + 1] - y[k - 1]) / (2 * dx)\n",
"deriv[-1] = (y[-1] - y[-2]) / dx\n",
"\n",
"plt.plot(x, deriv - np.cos(x), 'k')"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 32
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZYAAAD4CAYAAADPccAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAYcklEQVR4nO3df6zd9X3f8ecrdiA/aaD8MjbEnnY7zaBqJFdOpkgkG3gYVsX8kU5GyuJUUa1F0B/KNGaWSctUWQIqLVEkSGuRrKZr6znpOm4qBwZOonVTCFyaNBRTzzeQ1lf2wKVtRhaFX3vvj/MhPTjnx/U938v15T4f0tH5fj/fz/tzPh8h/Lrn+z3ne1JVSJLUlTcs9wQkSa8vBoskqVMGiySpUwaLJKlTBoskqVNrl3sCy+3888+vjRs3Lvc0JGlFefTRR/+yqi4YdGzVB8vGjRuZnZ1d7mlI0oqS5M+HHfNUmCSpUwaLJKlTBoskqV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0Puq6l3AdcBN7VTySrMWeBfwuaq6Evi/QKfXiQ2WxZkHLu3b3wAcX6a5qGnXI34f+J2q+i/LPZ8utFMUXwe2Le9MFuV9wAfbdYn9wD9O8p+Wd0qTqarj7fkZ4A/onRZfaeaB+b53wV+iFzSdMVgW5xFgKsmmduFrBzCzzHNa1doF788DT1TVf1ju+UwiyQVJ3tG23wxcA/zZsk5qEarq1qraUFUb6f0/8tWq+vAyT2vRkry1fTCEduronwAr7tOUVfW/gWNJ/l5ruhro9EMua7scbLWoqpeS3AzcD6wBvlBVjy/ztBYlye8BHwDOTzIP/Luq+vzyzmpR3gf8c+Cxdm0C4N9U1cHlm9KirQP2tU8fvgE4UFUr/qO6rwMXAX/Q+xuGtcDvVtV9yzulRfsl4HfaH8ZPAr/Q5eB+3FiS1ClPhUmSOmWwSJI6ZbBIkjplsEiSOmWwSJI6ZbBIkjplsEiSOvX/ASj3BVtLWepzAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "x4el5oOZ8kF1"
},
"source": [
"Once again, the error (the scale on the $y$ axis) went down by a factor of ten as well. However, something strange is clearly going on. The error for most of the points is *much* smaller than the error for the last point. The issue is that the backward difference scheme is only first order, while the central difference scheme is second order. Every time we reduce $\\Delta x$ by a factor of ten, the error for most points drops by a factor of 100, while the error for the last point only drops by a factor of 10. The difference becomes quite dramatic after $\\Delta x$ gets small enough. All of the errors go to zero, but the error for the last point goes to zero much more slowly than the central scheme. \n",
"\n",
"In many applications, the worst case error is the one we care about. This means that if one of the schemes we use is only first order, then our overall error will also be first order, even if most of our approximations are much more accurate. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NyxXxJYb8kF2"
},
"source": [
"## Higher Order Forward/Backward Schemes\n",
"The solution to this problem is to use a second order scheme for every point. This means that we need a second order forward difference scheme for $f'(x)$ and a second order backward difference scheme for $f'(x)$. Fortunately for us, such schemes exist. We can use \n",
"\n",
"$f'(x) \\approx \\frac{-3f(x) + 4f(x + \\Delta x) - f(x + 2\\Delta x)}{2\\Delta x}$\n",
"\n",
"and \n",
"\n",
"$f'(x) \\approx \\frac{3f(x) - 4f(x - \\Delta x) + f(x - 2\\Delta x)}{2\\Delta x}$. \n",
"\n",
"The former is a forward difference scheme and the latter is a backward difference scheme. We can check the order of both of these schemes with the same approach we used last time: Taylor expand every term around $x$ and simplify. The following Taylor expansions will be useful (and are easy to derive from the basic formula for $f(x + \\Delta x)$): \n",
"\n",
"$f(x + \\Delta x) = f(x) + \\Delta x f'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$, \n",
"\n",
"$f(x - \\Delta x) = f(x) - \\Delta x f'(x) + \\frac{(\\Delta x)^2}{2}f''(x) - \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$, \n",
"\n",
"$f(x + 2\\Delta x) = f(x) +2 \\Delta x f'(x) + \\frac{(2\\Delta x)^2}{2}f''(x) + \\frac{(2\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$, \n",
"\n",
"$f(x - \\Delta x) = f(x) - 2\\Delta x f'(x) + \\frac{(2\\Delta x)^2}{2}f''(x) - \\frac{(2\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)$.\n",
"\n",
"As an example, let's verify that the forward scheme is second order. We have \n",
"\n",
"$f'(x) \\approx \\frac{-3f(x) + 4f(x + \\Delta x) - f(x + 2\\Delta x)}{2\\Delta x}$\n",
"\n",
"$= \\frac{1}{2\\Delta x}\\left[-3f(x) + 4\\left(f(x) + \\Delta xf'(x) + \\frac{(\\Delta x)^2}{2}f''(x) + \\frac{(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right) - \\left(f(x) + 2\\Delta xf'(x) + 2(\\Delta x)^2f''(x) + \\frac{8(\\Delta x)^3}{6}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right)\\right]$\n",
"\n",
"$= \\frac{1}{2\\Delta x}\\left[2\\Delta x f'(x) - \\frac{2(\\Delta x)^3}{3}f'''(x) + \\mathcal{O}(\\Delta x^4)\\right]$\n",
"\n",
"$= f'(x) - \\frac{(\\Delta x)^2}{3}f'''(x) + \\mathcal{O}(\\Delta x^3)$. \n",
"\n",
"Since the first term is $f'(x)$, this is a consistent scheme. Since the second term has a $\\Delta x^2$, this is a second order scheme. The proof for the backward scheme is very similar. \n",
"\n",
"We can use these schemes to improve our code from the previous section. We wll still use a central scheme for most of the points (since it is already second order) and we will use these new schemes for the first and last points. "
]
},
{
"cell_type": "code",
"metadata": {
"id": "G4YRGhqZ8kF2"
},
"source": [
"dx = 0.001\n",
"x = np.arange(0, 6.001, 0.001)\n",
"y = np.sin(x)\n",
"\n",
"n = x.size\n",
"deriv = np.zeros(n)\n",
"deriv[0] = (-3 * y[0] + 4 * y[1] - y[2]) / (2 * dx)\n",
"for k in range(1, n - 1):\n",
" deriv[k] = (y[k + 1] - y[k - 1]) / (2 * dx)\n",
"deriv[-1] = (3 * y[-1] - 4 * y[-2] + y[-3]) / (2 * dx)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Yhr3EBuk8kF2"
},
"source": [
"If we plot the error now"
]
},
{
"cell_type": "code",
"metadata": {
"id": "WUzcWYBV8kF3",
"outputId": "21292fea-91d0-468b-a112-9d9a4453af31"
},
"source": [
"plt.plot(x, deriv - np.cos(x), 'k')"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {
"tags": []
},
"execution_count": 34
},
{
"output_type": "display_data",
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAEDCAYAAAAoWo9tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGli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kBAI+KyMOFbxT0ALBecya7VvgGYRSAdKXUbN15SkJEqotI1cI/VwQQAOCE1lDFoJQaq5RyU0rVxa3fkR1KqT6aYxWLiFQqfBMdhdMQbQCYcqWXUupnAGdE5PHCh/wBGLYowMmogUqbUipPRP4NYAsARwBLlVLHNccqFhGJAdAKQDURyQIwSSkVpTdVsbQA0BfA0cK5ZQAYp5TaqC9SsdUCsLxwdZQDgNVKKVMv3bMBNQEk3jpfgBOAT5VSm/VGKpHXAKwqPBHNADDAqIFNs/yQiIjuzkxTK0REdBcsciIik2ORExGZHIuciMjkWORERCbHIiciMjkWORGRyf0/jP2S8cUVc1wAAAAASUVORK5CYII=\n",
"text/plain": [
""
]
},
"metadata": {
"tags": [],
"needs_background": "light"
}
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "V9wIh9HX8kF3"
},
"source": [
"we can see that all of the errors are on roughly the same scale, and that the maximum error is now much lower than before. "
]
}
]
}