You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Calculate the next y-value using the weighted average of the four slopes
27
+
returnyCurrent+(1/6)*(k1+2*k2+2*k3+k4)
28
+
}
29
+
23
30
/**
24
31
* @description Runge-Kutta method for solving ordinary differential equations (ODEs) with a given initial value. It is a numerical procedure for solving ODEs. The method proceeds in a series of steps. At each step the y-value is calculated by evaluating the differential equation at the previous step, multiplying the result with the step-size and adding it to the last y-value.
25
-
* @param {number} xStart - The starting x-value
32
+
* @param {number} xStart - The starting x-value
26
33
* @param {number} xEnd - The ending x-value
27
34
* @param {number} stepSize - The step size
28
35
* @param {number} yStart - The starting y-value
29
36
* @param {function} differentialEquation - The differential equation to solve
30
37
* @returns {Array} - An array of points (x, y) for the complete iteration from xStart to xEnd
0 commit comments