Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need a very basic javascript program along with an output using the following instructions: Consider a first order ordinary differential equation given by: y '

Need a very basic javascript program along with an output using the following instructions:

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

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions