Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my code for Euler's method: change(N)=0.2*N*(1-(N/100)) count = srange(0,1000) vals = [150] step_size = 0.1 for i in count: current_value=vals[i] future_value=current_value+step_size*change(current_value) vals.append(future_value) vals

This is my code for Euler's method:

change(N)=0.2*N*(1-(N/100))

count = srange(0,1000)

vals = [150]

step_size = 0.1

for i in count:

current_value=vals[i]

future_value=current_value+step_size*change(current_value)

vals.append(future_value)

vals

Questions:

  1. Turn your implementation of Euler's method into a function. This function should take a differential equation (see the previous paragraph), an initial value, a step size, and the number of steps as inputs. It should return a list of state values as its output.
  2. Modify this function so it returns a list of pairs of time and state values.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions