Question: Let's write our first numerical method to solve this same problem! Create a new function called forward _ Euler _ velocity ( ) . This

Let's write our first numerical method to solve this same problem! Create a new function called forward_Euler_velocity(). This function will take in the same exact inputs and provides the same form of output as in the exact_velocity() of Problem 1. However, instead of computing the exact solution to the model we will approximate the time derivative using the forward
Euler approximation:
delvtdelt~~v(t+t)-vtt
so that we have the following algebraic problem to solve at a given time step:
v(t+t)-vtt=g-(cdm)***v(t)???2
Hint: For this problem we are assuming the input t will always include our initial time of t=0. The code should roughly be structured as follows:
cd,m,t,glarr user input
ntlarr length (t)
vlarr an array same length as t
v(0)larr0
ilarr1
while i nt do
tlarrt(i)-t(i-1)
v(i)larrv(i-1)+t(g-cdm***v(i-1)???2)
ilarri+1
end while. please code in python
 Let's write our first numerical method to solve this same problem!

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