Question
Need a Javascript program for ODE soultions . Consider a first order ordinary differential equation given by: y ' = f (x,y) = y*x^2 -1.2y
Need a Javascript program for ODE soultions .
Consider a first order ordinary differential equation given by: y ' = f (x,y) = y*x^2 -1.2y with a starting value of y (0) = 1 on the interval x = 0 to 2 with n = 8 (step size will be h = 0.25 ) determine the value of y (2) using: (a) Euler's method on each interval the next y value = previous y value + slope times step size. or yn = y + f(x,y) * h (b) Heun's method k1 = f ( x, y ) k2 = f ( x+h, y+k1*h ) and yn = y + (k1 + k2) * h / 2 (c) RK-3 method k1 = f ( x, y ) k2 = f ( x+h/2, y+k1*h/2 ) k3 = f ( x+h, y -k1*h + 2*k2*h) and yn = y + (k1 + 4*k2 + k3) * h/6 (d) RK-4 method k1 = f ( x, y ) k2 = f ( x+h/2, y+k1*h/2 ) k3 = f ( x+h/2, y+k2*h/2 ) k4 = f ( x+h, y + k3*h) and yn = y + (k1 + 2*k2 + 2*k3 + k4) * h / 6 at the start of the program I need you to define: function f (x,y) initial values: x = 0 and y = 1 final value: b = 2 number of steps: n = 8 you will need to display the four ending values for y: (a) Euler's method (b) Heun's method (c) RK-3 method (d) RK-4 method .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started