Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use python to solve this question!Change the function solve _ DE provided so that it uses the function eulers _ method _ n _

Please use python to solve this question!Change the function solve_DE provided so that it uses the function eulers_method_n_steps_t_final to solve the
differential equation
dy(d)t=3yt2-y5
with the initial conditions y(1)=4 using 35 steps to final t=8. As in the code provided, the function should return numpy
arrays of the t and y values giving the Euler's method solution.
For this question you can assume that the function eulers_method_n_steps_t_final(dydt, t ,y0,tf,n-steps ) is
available. This function returns the Euler's method solution to the DEdy(d)t=dydt with initial conditions y(t0)=yusing
n-steps steps to a final t=tf and returns numpy arrays of the t and y values giving the Euler's method solution.
Only a few lines of the given code need to be altered to answer this question!
Your code will be tested by running your function and checking various values in the returned arrays.
Answer: (penalty regime: 0,10,dots%)
import numpy as np
def solve_DE():
"" Perform several iterations of Euler's method
and return the Euler's Method solution.
"".
# DE Function
dydt=t,y:np*exp(-t)-4**y
# Initial conditions
to =0
ye =5
# number of steps and final t
n_steps =50
t_final =2
# Eulers method
t_values, y_values = eulers_method_n_steps_t_final ,
to,
yo,
t_final,
n_steps)
return t_values, y_valuesD
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions