Question: Task 2 : IVP Solvers ( 1 5 pts ) Write Python functions for the Euler, Midpoint, Heun, and Classic RK - 4 methods of

Task 2: IVP Solvers (15 pts)
Write Python functions for the Euler, Midpoint, Heun, and Classic RK-4 methods of solving IVPs. Save all
functions to a file called A4.py.
Valid call: T, Y = euler_integrate(fun, t0, y0, tStop, h)
Inputs: fun : (callable) ODE function handle
t0 : (float) Initial time step
y0 : (float or 1D numpy array) Initial value of y
corresponding to t0
tStop : (float) Final time step
h : (float) Step size
Outputs: T : (1D numpy array) integrated t-values
Y : (1D or 2D numpy array) integrated y-values
Assumptions: The ODE function is called by: dydt = fun(t,y)
h will be provided such that the solver will not step past
tStop
Note: Aside from the function names, the information above is the same for midpoint_integrate,
heun_integrate and RK4_integrate.

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 Programming Questions!