代写 algorithm graph ME581 Homework 6

ME581 Homework 6
Due: 5:00 PM November 19, 2019
Instructions:
• The following problems are to be documented, solved, and presented in Jupyter notebooks.
• Save the notebooks as PDFs, then upload and submit the PDFs in Gradescope.
• Use the tool “Jupyter Notebook with Anaconda 5.1” available at https://nanohub.org/tools/jupyter51
• All code implementing integration algorithms (e.g. the Trapezoidal, Euler, R-K Methods, …) should be
the student’s own work. Problem 1
For the
(a) (b)
(c) (d)
(e)
initial value problem given by
𝑑𝑦 = 𝑡2 − 2𝑦2 − 1 𝑑𝑡
𝑦(0) = 0 (0 ≤ 𝑡 ≤ 1)
Determine and state the maximum time step size h for which the Trapezoidal Method will exhibit absolute stability. Apply the Trapezoidal Method with a time step size h = 0.1, and print each estimated 𝑦(𝑡𝑖). Solve any nonlinear algebraic equations using Newton’s Method.
Determine and state the maximum time step size h for which the Backward Euler Method will exhibit absolute stability. Apply the Backward Euler Method with a time step size h = 0.1, and print each estimated solution 𝑦(𝑡𝑖). Solve any nonlinear algebraic equations using Newton’s Method.
Apply the Euler Method with a time step size h = 0.1, and print each estimated solution 𝑦(𝑡𝑖).
Apply the Second-Order Runge-Kutta method with a time step size h = 0.1, and print each estimated solution 𝑦(𝑡𝑖).
On a single plot, graph the four solutions 𝑦 from parts (a)-(d). Label both axes and include a legend.
Problem 2
For the initial value problem given by
𝑑𝑦 = −25𝑦 + 25 sin(𝑡) + cos(𝑡) 𝑑𝑡
y(0) = 1 (0 ≤ 𝑡 ≤ 6)
whose exact solution is 𝑦(𝑡) = 𝑒−25𝑡 + sin (𝑡),
(a) Determine and state the maximum time step size h for which the Second-Order Runge-Kutta Method will exhibit absolute stability. Apply the Second-Order Runge-Kutta Method with a time step size h = 0.1, and plot the estimated solution 𝑦(𝑡𝑖). Label both axes. Do not print 𝑦.
(b) Determine and state the maximum time step size h for which the Classical Fourth-Order Runge-Kutta Method will exhibit absolute stability. Apply the Classical Fourth-Order Runge-Kutta Method with a time step size h = 0.1, and (on a new plot) plot the estimated solution 𝑦(𝑡𝑖).Label both axes. Do not print 𝑦.
(c) Repeat part (a) for time steps h = 0.08, h = 0.04, and h = 0.02. Use a single plot to graph the estimated solutions 𝑦(𝑡𝑖). Label both axes and include a legend. Do not print 𝑦.

Problem 3
For the
(a)
(b) (c)
(d) (e)
third-order initial value problem given by
𝑦′′′ + 1 𝑦𝑦′′ = 0 2
𝑦(0) = 0 𝑦′(0) = 0 𝑦′′(0) = 1
Convert the differential equation to a system of three first-order differential equations of the form
𝑢′ =⋯ 1
𝑢′ =⋯ 2
𝑢′ =⋯ 3
State this system of equations and the corresponding initial conditions 𝑢1(0), 𝑢2(0), and 𝑢3(0). Advance the solution of this system of equations through 𝑁 = 10 time steps using Euler’s Method and a step size of h = 0.1. Print each estimated value of 𝑢1(𝑡𝑖). Do not print 𝑢2 or 𝑢3.
Advance the solution of this system of equations through 𝑁 = 10 time steps using the Classical Fourth- Order Runge-Kutta Method and a step size of h = 0.1. Print each estimated value of 𝑢1(𝑡𝑖). Do not print 𝑢2 or 𝑢3.
On a single plot, graph the two solutions 𝑢1(𝑡𝑖) from parts (b) and (c). Label both axes and include a legend.
Graph 𝑢1 against 𝑢2 for the solution obtained in part (b). On the same plot, graph 𝑢1 against 𝑢2 for the solution obtained in part (c). Label both axes and include a legend.
Problem 4
The motion of a pendulum can be modeled by the second-order initial value problem
𝐿𝜃′′ + 𝑔 sin(𝜃) = 0 𝜃(0) = 𝜃0
𝜃′(0) = 𝜔0
where 𝜃 denotes the angle (in radians) which the pendulum rod makes with the vertical axis, 𝐿 is the length of the
pendulum rod, 𝑔 is the acceleration due to gravity, 𝜃0 is the initial angle, and 𝜔0 is the initial angular velocity. For
this problem, take 𝐿 = 1𝑚 and 𝑔 = 9.8 𝑚 . Using the Second-Order Runge-Kutta Method, perform the following: 𝑠2
(a) Solve for and on a single plot graph the angle 𝜃(𝑡) as a function of time for the time period
(0𝑠 ≤ 𝑡 ≤ 20𝑠) using a time step h = 0.01𝑠, an initial angular velocity of 𝜔0 = 0 𝑟𝑎𝑑, and initial angles
𝑠
𝜃0 = (0.0, 0.2, … , 1.4) 𝑟𝑎𝑑. Label both axes, include a legend, and state units. Do not print 𝜃(𝑡).
(b) On a single plot graph the angle 𝜃 against the angular velocity 𝜃′ for each of the solutions in part (a). Label both axes, include a legend, and state units.
(c) From the plot generated in part (a), make a rough visual estimation of the period 𝑇 (in seconds) of the pendulum for each initial angle.
(d) Repeat parts (a) and (b) using an initial velocity of 𝜔0 = 6 𝑟𝑎𝑑. 𝑠