Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python or MATLAB Question is as follows: NOTE: Python is not required, MATLAB may be used. Subject: Numerical Methods for Ordinary Differential Equations: Initial Value
Python or MATLAB
Question is as follows:
NOTE:
Python is not required, MATLAB may be used.
Subject: Numerical Methods for Ordinary Differential Equations: Initial Value Problems.
______
Useful Information
Taylor Series Method of Order 2:
3. The motions of a swinging pendulum under certain simplifying assumptions is described by the second-order differential equation LO" + sin(O) = 0, where L is the length of the pendulum, g is the gravitational constant, and is the angle the pendulum makes relative to the vertical position (see Figure 1). For small values of 0 (i.e., small amplitude oscillations of the pendulum), this equation can be linearized (sin(0) 0) to give LO" +90=0. Consider a pendulum whose length is 2 feet and take the gravitational constant to be g = 32.17 ft/s2. o(t) / (a) (Linearized Model) Write the linearized pendulum model: LO" + g = 0. as a first-order system of equations. Develop a Taylor series method of order 2 for this equation. Create a PYTHON file called pendulum.py and a function linTSM2 that implements your Taylor series method of order 2. (b) (Linearized Model) Apply your method to solve LO" +90 = 0, 0(0) = 7/6, 6'0) = 0. For this question, use the following step sizes in seconds) k = 4/N for N = 40,80, 160, 320, 640, 1280, 2560. Turn in a table that contains 5 columns: the various k values, the errors in e(t) at time t = 4, the ratio of the previous/current error, the errors in ' (t) at time t = 4, the ratio of the previous/current error (c) (Nonlinear Model) Write the nonlinear pendulum model: Le" + g sin(O)=0. as a first-order system of equations. Develop a Taylor series method of order 2 for this equation. Inside the PYTHON file pendulum.py add a function nonlinTSM2 that implements your Taylor series method of order 2. (d) Use your two methods to compare the linearized and the nonlinear models of the pendulum. With k = 0.005 seconds, compare the angle @ for the following problems: Linearized: L" +90 = 0, Nonlinear: LO" + g sin(0) = 0, ICs: 0(0) = */6, 6'(0) = 0. For this problem turn in 3 clearly labeled plots: . a plot of the solution of e(t) to the linearized equation from t = 0 to t = 4, . a plot of the solution of e(t) to nonlinear equation from t=0 to t = 4, . a plot that contains both solutions of (t) from t = 0 to t = 4. Make sure to include a legend for plot this plot. (e) What do these plots say about the validity of the linearized equation as an approximation to the nonlinear equation? 3. The motions of a swinging pendulum under certain simplifying assumptions is described by the second-order differential equation LO" + sin(O) = 0, where L is the length of the pendulum, g is the gravitational constant, and is the angle the pendulum makes relative to the vertical position (see Figure 1). For small values of 0 (i.e., small amplitude oscillations of the pendulum), this equation can be linearized (sin(0) 0) to give LO" +90=0. Consider a pendulum whose length is 2 feet and take the gravitational constant to be g = 32.17 ft/s2. o(t) / (a) (Linearized Model) Write the linearized pendulum model: LO" + g = 0. as a first-order system of equations. Develop a Taylor series method of order 2 for this equation. Create a PYTHON file called pendulum.py and a function linTSM2 that implements your Taylor series method of order 2. (b) (Linearized Model) Apply your method to solve LO" +90 = 0, 0(0) = 7/6, 6'0) = 0. For this question, use the following step sizes in seconds) k = 4/N for N = 40,80, 160, 320, 640, 1280, 2560. Turn in a table that contains 5 columns: the various k values, the errors in e(t) at time t = 4, the ratio of the previous/current error, the errors in ' (t) at time t = 4, the ratio of the previous/current error (c) (Nonlinear Model) Write the nonlinear pendulum model: Le" + g sin(O)=0. as a first-order system of equations. Develop a Taylor series method of order 2 for this equation. Inside the PYTHON file pendulum.py add a function nonlinTSM2 that implements your Taylor series method of order 2. (d) Use your two methods to compare the linearized and the nonlinear models of the pendulum. With k = 0.005 seconds, compare the angle @ for the following problems: Linearized: L" +90 = 0, Nonlinear: LO" + g sin(0) = 0, ICs: 0(0) = */6, 6'(0) = 0. For this problem turn in 3 clearly labeled plots: . a plot of the solution of e(t) to the linearized equation from t = 0 to t = 4, . a plot of the solution of e(t) to nonlinear equation from t=0 to t = 4, . a plot that contains both solutions of (t) from t = 0 to t = 4. Make sure to include a legend for plot this plot. (e) What do these plots say about the validity of the linearized equation as an approximation to the nonlinear equationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started