Question: Test 3 will have > 1 0 0 points but will be graded out of some fraction of those points ( i . e .

Test 3 will have >100 points but will be graded out of some fraction of those points (i.e. built in extra credit is possible). For problem 1, you are requested to use ode45 or scipy.integrate.solve_ivp for part of the problem, but for the remainder you will write your own ODE integrators. For problems 2,3, and 4, you may use any functions of your choosing (MATLAB/Python built-in functions or your own).
Question 1(45pts): ODEs - Explicit/Implicit Rules, Stability, and the importance of Stepsize.
Stiff systems those in which small step sizes are required due to large system changes in short timespans are particularly difficult to integrate and benefit the most from variable step-size integration schemes. You will not write one of these variable step-size codes (that's MATLAB's job), but you will see how effective they are. You are to integrate the following stiff system:
Equation System
In which x1, x2, and x3 are the positions of three masses, with the initial conditions
ICs
and system parameters
System Parameters
Your process is as follows:
On a piece of paper (or using electrons if you must), rewrite the equations as a collection of first-order ODEs.
Write a "odefun" function that takes the independent variable (
) and the dependent variables as a vector [
] and returns the derivatives [
] as a vector. For MATLAB, at least, you will need your odefun to return [
] as a column, or ode45() will complain; however, ode45 returns all its values in rows, which means you'll probably need to transpose things in your own codes if you want to return values the same way ode45() does.
Solve this system using ode45() or scipy.integrate.solve_ivp() and your odefun() from
=0 to 1.25 so you (likely) have an idea of what this system looks like. It's stiff - you can tell by how much it deviates from a sinusoid.
Write three solvers using the methods below that also use this odefun() function to integrate this initial value problem. Note that one of these solvers is the most complex, and if you write that one first you can essentially simplify it twice to obtain the other two solvers. Note also that each solver must be a function, with arguments (odefun, tspan, ics, timestep).
Predictor-Corrector (Heun's), explicit,
accurate.
Trapezoidal, implicit,
accurate; this function can/should take the additional argument of the size of error required to consider its intermediate iteration converged.
RK4, explicit,
accurate.
Integrate the equations using the Predictor-Corrector method from
=0 to 1.25. You may choose any step size(s) you want (it's gonna be fairly SMALL), but you must show:
The integrated solution is converged; and
The integrated solution is stable.
Based on the Predictor-Corrector step size, choose a somewhat larger step size for the other two methods and integrate them over the same timespan. Briefly justify your reasoning for the larger step size chosen using an argument based on the method's truncation error (i.e. the order of the method). For these as well, show stability and convergence.
Create a plot for each displacement (one figure for each of the
) over the timespan [01.25], showing all three solution methods. Comment on what you see and the amount of effort required (in terms of step size).
After this is all over, step outside your house and shout: "ODEFUN!!" three times. This step is optional.
Question 2(25pts): Single and Piecewise Polynomial Interpolation, Reverse Interpolation.
Use both single-polynomial and piecewise polynomial techniques of your choice to interpolate f(3.5), f(8.5), and f(6) from the data below. Plot a smooth curve from each method from 2.8 to 10.2; also on this plot, include the 7 given points as x and three specific points (from each method) as os. If your expectation is that this is a fairly smooth function, qualitatively comment on the reliability of the interpolated values from each technique. Plot the single-polynomial (and its points) in green, and the piecewise polynomial in blue.
index 0123456
x 45783910
f(x)810(1)/(3)1532(1)/(3)515(1)/(2)2
Next, find all x values (for both the single-polynomial and the piecewise polynomial) between x=3 and x=10 for which the function value f(x)=5.3. Do this algorithmically - that is, don't just look at the plot, guess where they are, and provide your root finder a close guess: have your code do it automatically. Once you find these values, plot them all (on their respective polynomial lines) as red '+' symbols. How many roots were found for each polynomial?
Hints:
Recall the technique provided during the interpolation lectures (i.e. how to do this, in general).
Given you are trying to find all the roots in a specific interval, it may be helpful to "sweep" through this interval using a loop with a small stepsize (0.2?), calling your root finding function at each step with the unique interval position (i.e. the loop variable) as your initial guess.
Because your root finding function will return multi

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!