Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python & Math Question is as follows: NOTE: Python is required, not MATLAB . Subject: Numerical Methods for Ordinary Differential Equations: Initial Value Problems. ______
Python & Math
Question is as follows:
NOTE:
Python is required, not MATLAB.
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.2 An Order-Two Method: TS(2) As discussed in Appendix B, the second-order Taylor series expansion (t+h) = x(t) +hx'(t) + 3h2x"(t) + R2(t) has remainder term R2(t) = O(h3). Setting t = tn we obtain (since tn+1 = tnth) c(tn+1) = (tn)+ h2'(tn)+ ha (tn)+P(3). Neglecting the remainder term on the grounds that it is small leads to the formula Xn+1 = Xn + hxn +Step 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