Tip:
Highlight text to annotate it
X
Hi! Miriam here making a guest appearance in the middle of the unit.
Your task for this quiz is going to be to implement adaptive step sizes.
We've already provided Huen's method for you.
So you just have to determine the next value of the step size h.
There's one important change to the framework, however.
You see we're dealing with single vectors here. We're no longer filling arrays of vectors.
So the reason that we just are using single vectors is because we don't know upfront
how many steps the simulation is going to have.
The number of steps is going to depend on the values h that are being computed.
So we're not storing a history of x and b anymore
because we don't know how many entries that history would have to contain.
So when we plot the result, we're not going to be plotting a whole curve.
We're going to be plotting just a single dot at each different location.
Now you can see that in addition to the step size h right here,
we've also created a variable for you called h new.
Inside this while loop, we want h to store the current step size
and then we'll compute the next step size as h new.
At the end of each step, we want to add h to the time it has past, just what's happening right here
and I want to set h equal to h new, which signals that we move onto the next step.