Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is in python, please help, thank you! If you've been actively involved in class, and also solved problem 1 above, you might have noticed

this is in python, please help, thank you! image text in transcribed
image text in transcribed
If you've been actively involved in class, and also solved problem 1 above, you might have noticed a pattern in how the recursive sequences are calculated for differential equations. This is the convention: dtdy=f(y,t),y(0)=y0 The f(y,t) represents whatever equations appear on the right-hand side, whether it is dtdu=2u(1u) from the previous problem, where f(u,t)=2u(1u), or dtdy=y where f(y,t)=y. The " t " shows up in case your right-hand side includes both the dependent (y) and independent (t) variables. (Systems of differential equations follow a similar format but use vector notation.) Here are the update rules: yiti=yi1+hf(yi1,ti1)=ti1+h Your task: implement a Python function taking in variables f (a Python function), h,T (scalars) whose purpose is to solve any differential equation of the form of equation (3) above. The two outputs should be the arrays for t, and y, which allows the user to later plot the numerical solution. More guidance: - The function "f" must be assumed to take in two scalars y and t, and output one scalar, representing the right-hand-side for whatever differential equation the user wanted to solve. - Word of caution: the first input must be a Python function. Directly typing in the letter " y " does not represent a function in Python. Instead, you'd need to first define: deff(y,t):returny and then give that f as the input to the function. So, with that function defined, whateveryoucallyourfunction (f,0.1,1) would give arrays t and y which would represent a numerical solution to dtdy=y,y(0)=1, up until t=1. whateveryoucallyourfunction (g,0.2,4 ) should give you a result that exactly matches what you did for problem 1. on this homework, assuming g(y,t) calculates 2y(1y). - What we did with a system of two equations in class cannot be solved using this tool. That's OK. This is not an expectation for this

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago