1. HINT: use solve_ivp, quad and matplotlib. Write a python program that solves the following initial...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. HINT: use solve_ivp, quad and matplotlib. Write a python program that solves the following initial value problem over the interval from 0 x 5 using a step size of h = 0.2 using solve_ivp from scipy.integrate. y' = (y-0.01x2) sin(x) + 0.02x, y(0) = 0.4 1 The exact solution for this i.v.p.is:_: y = +0.01x where S(x) = ** sin(t)dt [2.5-5(x)] Your program must show the solution for the I.V.P. as a plot of y(x) for the exact solution as a solid line and the numerical solution as upward facing triangles at 0.2 increments. Plot requirements: 1. x-axis from 0.0 to 6.0 titled as x with tick marks pointed inward on both top and bottom sides. 2. y-axis from 0.0 to 1.0 titled as y with tick marks pointed inward on both left and right sides. 3. A legend with exact solution titled as 'Exact' and I.V.P. numerical solution titled as 'Numerical'. 4. Numbers on x and y axes formatted with one digit (e.g., 0.6) 5. Title the plot with the title: "IVP: y' = (y = 0.01x) sin(x) + 0.02x, y(0) = 0.4" Hint: the exact solution involves a difficulty integral S(x), which you may solve numerically using quad from scipy.integrate. 1. HINT: use solve_ivp, quad and matplotlib. Write a python program that solves the following initial value problem over the interval from 0 x 5 using a step size of h = 0.2 using solve_ivp from scipy.integrate. y' = (y-0.01x2) sin(x) + 0.02x, y(0) = 0.4 1 The exact solution for this i.v.p.is:_: y = +0.01x where S(x) = ** sin(t)dt [2.5-5(x)] Your program must show the solution for the I.V.P. as a plot of y(x) for the exact solution as a solid line and the numerical solution as upward facing triangles at 0.2 increments. Plot requirements: 1. x-axis from 0.0 to 6.0 titled as x with tick marks pointed inward on both top and bottom sides. 2. y-axis from 0.0 to 1.0 titled as y with tick marks pointed inward on both left and right sides. 3. A legend with exact solution titled as 'Exact' and I.V.P. numerical solution titled as 'Numerical'. 4. Numbers on x and y axes formatted with one digit (e.g., 0.6) 5. Title the plot with the title: "IVP: y' = (y = 0.01x) sin(x) + 0.02x, y(0) = 0.4" Hint: the exact solution involves a difficulty integral S(x), which you may solve numerically using quad from scipy.integrate.
Expert Answer:
Posted Date:
Students also viewed these mechanical engineering questions
-
The largest government expenditure for Japan & the US is... a) military / defense b) transfer payments c) education / healthcare d) infrastructure
-
Overhead costs are typically identified as belonging to one of four categories. List and briefly describe each category.
-
Find an equation for each line in the form ax + by = c, where a, b, and c are integers with no factor common to all three and a 0. Through (-1, 4); undefined slope
-
What is the credit rating on a bond and what factors determine it?
-
A marketing professor at Givens College is interested in the relationship between hours spent studying and total points earned in a course. Data collected on 10 students who took the course last...
-
After receiving an extension for her Year 1 tax return to October 15 of Year 2, Mandy placed her Year 1 individual income tax return in the post office mailbox on October 1 of Year 2. She sends it...
-
Ethan owns a 1000 par value 10% bond with semiannual coupon. The bond will mature for 1000 at the end of 10 years. Current yield rates are 7% compounded semiannually. Ethan has decided that he would...
-
Consider a market in which there are \(N\) banks and \(N\) buyers of securities. Each bank owns a security that ensures a return \(R\) in the next period. Half of the securities ensure a return...
-
Linlithi Medical provides on-site health screenings for other organizations, and has been hired by the City of Baltimore to conduct the annual health screening of all 250 of Baltimore's bus drivers....
-
Palms Coast Hospital is designing a new building and has determined the closeness ratings between the eight departments that must be located on the ground floor of that structure. These ratings are...
-
Consider the following project management problem: a. What is the expected completion time of this project? b. What is the critical path through this project? Task Immediate Predecessor(s) Duration...
-
An office supply company manufactures paper clips, and even tolerates a small proportion of those paper clips being defective (incorrectly shaped and/or twisted) in its outgoing product. (The company...
-
FIFO and LIFO Costs Under Perpetual Inventory System The following units of an item were avalable for sale during the year: Beginning inventory 27 units at $44 Sale 14 units at $62 First purchase 19...
-
What is a lobbyist in US? How did this term emerge?
-
Mass transfer models include transfer in only the packed region. Mass transfer also occurs in the column ends where liquid and vapor are separated. Discuss how these end effects affect a design. How...
-
Construct your key relations chart for this chapter.
-
a. The Bolles and Fair (1982) correlation indicates that \(\mathrm{H}_{\mathrm{G}}\) is more dependent on liquid flux than on gas flux. Explain this on the basis of a simple physical model. b. Why do...
Study smarter with the SolutionInn App