Question: write code in python ( check bottom instruction ) : Consider the following ODE: d y d x - y = 2 , y (

write code in python(check bottom instruction): Consider the following ODE:
dydx-y=2,y(0)=1
The analytic solution is given by y(x)=3ex-2. Let h be the step size. Now using the
Euler and Runge-Kutta (RK) Methods, calculate y(x=1), and estimate the error
rate for both methods separately using the formula: e=ycalculated-yactualyactual.
Here, at x=1, we have yactual=3e-2. Now plot the error rate at x=1
vs step size for both Euler and RK methods in the same graph. Take
h=0.1,0.2,0.25,0.5,1.(Use scipy.integrate.solve_ivp to implement RK method.)
write code in python ( check bottom instruction )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!