Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Vector Mechanics For Engineers Statics

Authors: R.C.Hibbeler

7th Edition

978-0072931105, 0072931108

More Books

Students also viewed these Mechanical Engineering questions