Use a spreadsheet to approximate the solution to the initial value problem
from to , using step size . Plot the solution.
Qualitative methods for differential equations
6 problems · hints, answers and solutions shown beside each one
Use a spreadsheet to approximate the solution to the initial value problem
from to , using step size . Plot the solution.
We set up a spreadsheet as below. The first row contains labels.
| A | B | C | |
| 1 | t | y\_k | y\_k' |
| 2 | 0 | -1 | =1/B2 |
| 3 | =A2+0.05 | =B2+C2*0.05 |
We copy the bottom cells down through Row 42, and plot columns A and B.
Use a spreadsheet to approximate the solution to the initial value problem
from to with step size . Plot the solution.
You need to go to the left, as it were, by finding -values that are decreasing. That means you'll use .
Since we're taking values of that are decreasing, we'll use . Our spreadsheet setup is below. The first row contains labels.
| A | B | C | |
| 1 | t | y\_k | y\_k' |
| 2 | 0 | 0.4 | =B2*B2-4 |
| 3 | =A2-0.1 | =B2-0.1*C2 | |
| 4 |
We copy the columns down to Row 12 and plot columns A and B.
Use a spreadsheet to approximate the solution to the initial value problem
from to with step size . Plot the solution.
You'll be branching out from in two directions. So, you can copy-paste twice: once with , and once with .
We'll set up our spreadsheet twice. First, in the normal way, with initial value and step size . Then, with the same initial value, but . The first collection of data will approximate to the right of ; the second collection will approximate to the left of .
So, our spreadsheet looks something like this (note the omitted rows):
| A | B | C | |
| 1 | t | y\_k | y\_k' |
| 2 | 0 | 0 | =(1-B2)/(1+A2*A2) |
| 3 | =A2+0.2 | =B2+0.2*C2 | |
| 4 | |||
| 52 | |||
| 53 | 0 | 0 | |
| 54 | =A53-0.2 | =B53-0.2*C53 | |
| 55 | |||
| 103 |
The plot looks something like this:
Consider the following spreadsheet setup, where arrows indicate that an entry has been copied down a column, and the first row contains labels.
| A | B | C | |
| 1 | t | y\_k | y\_k' |
| 2 | 1 | 0 | =B2$\wedge$A2+0.2*B2 |
| 3 | =A2+0.01 | =B2+0.01*C2 | |
| 4 |
The spreadsheet is approximating a solution to an initial value problem.
What is the initial value?
What is ?
What is the step size?
There's no need to try to find tricks – just interpet the labels in Row 1 at face value.
0.01
There are, theoretically, different ways one could interpret the spreadsheet. But, one approach is by far the most obvious: to interpret the labels at face value.
The -values are stored in column , and the approximate -values are stored in Column B. The only ones that are entered as numbers (as opposed to computed) are in cells A2 and B2. So, the initial value is .
Derivatives are computed in column C. The cell A2 references the -value, and the cell B2 references the -value. So, we interpret the entry in cell C2 to mean .
The step size is recognizable in two places. In Column A, we see that the -values go up by 0.01 each step, so . This also accords with the formula in Column B:
In this question, we'll investigate step size and error. We'll use the initial value problem
Use a spreadsheet to approximate , using a step size . Store the step size in its own cell, so that it can be changed later.
The actual value of (which you don't know how to find on your own yet) is . Change the value of until your approximation of is within 0.001 of the actual value. What value of is small enough to keep the error within this tolerance?
The values of must be of the form , where is a whole number; otherwise, you won't get an approximation for specifically.
can be no bigger than
Our spreadsheet setup is as follows:
| A | B | C | D | |
| 1 | t | y\_k | y\_k' | step |
| 2 | 0 | 1 | =-2*A2*B2*B2 | 0.1 |
| 3 | =A2+\$D\$2 | =B2+\$D\$2*C2 | ||
| 4 |
Cel B12 holds the approximation .
We copy columns A, B and C down the spreadsheet further, so that we will still be able to see the row holding after we make the entry in D2 smaller. We want to approximate , so our value of should have the form , for a whole number . (Then our approximation will take steps of Euler's method.)
By trial and error, we find that gives us the approximation (in cell B37), and gives us the approximation (in cell B38). So, is too large, but is small enough. Taking even smaller values of keeps our approximation within the given error tolerance. So, any value of that is no bigger than will do.
Consider the initial value problem
We want to know when will be equal to 0. Using a spreadsheet and Euler's method, approximate the root of .
You aren't given an error tolerance, so it's up to you to play around with step sizes until your answers seems relatively consistent.
You aren't given an error tolerance, so your actual answer may vary, but if you've done a good job of making your step size relatively small, then your approximation should be relatively close to the actual answer of .
This question is meant to get you thinking about how to use spreadsheets creatively, but the vagueness makes it unlikely to show up on an exam in exactly this form.
We'll start with a fairly usual setup. We'll keep the step size stored separately, so we can change it later. Instead of copying our values down the column until we find a particular -value, we're looking for a particular -value. Or, at least, the spot where the values change from negative to positive.
| A | B | C | D | |
| 1 | t | y\_k | y\_k' | step |
| 2 | 0 | -0.1 | =1/(1-B2*B2) | 0.1 |
| 3 | =A2+\$D\$2 | =B2+\$D\$2*C2 | ||
| 4 |
The first iteration of Euler's method with step size 0.1 approximates . So, this approximation puts the root somewhere between 0 and 0.1 (but remember, it might not be entirely accurate).
Next, we will increase our accuracy by decreasing our step size. Changing the value in D2 to 0.1, and copying further down the columns, shows us and . So, this approximation guesses the root is between and . We continue to decrease and note the -values where the corresponding approximation changes from negative to positive.
| lower bound | upper bound | |
| 0.1 | 0 | 0.1 |
| 0.01 | 0.09 | 0.1 |
| 0.001 | 0.099 | 0.1 |
| 0.0001 | 0.0996 | 0.0997 |
There's not a clear stopping point, but the last approximation required about 1000 rows of the spreadsheet to produce, which seems on the edge of what is reasonable. So, our guess for the root is, let's say, .
This section is original content.
From the UBC Math 100 open textbook project, © Joel Feldman, Andrew Rechnitzer, Elyse Yeager and others. Licensed CC BY-NC-SA 4.0; this HTML adaptation is released under the same licence. Full attribution.