For a given differential equation with initial condition
find the approximate solution using Predictor-Corrector method.
Predictor-Corrector Method :
The predictor-corrector method is also known as Modified-Euler method.
In the Euler method, the tangent is drawn at a point and slope is calculated for a given step size. Thus this method works best with linear functions, but for other cases, there remains a truncation error. To solve this problem the Modified Euler method is introduced. In this method instead of a point, the arithmetic average of the slope over an interval is used.
Thus in the Predictor-Corrector method for each step the predicted value of is calculated first using Euler’s method and then the slopes at the points and is calculated and the arithmetic average of these slopes are added to to calculate the corrected value of .
here h is step size for each increment
As, in this method, the average slope is used, so the error is reduced significantly. Also, we can repeat the process of correction for convergence. Thus at every step, we are reducing the error thus by improving the value of y.
Input : eq = , y(0) = 0.5, step size(h) = 0.2
To find: y(1)
Output: y(1) = 2.18147
The final value of y at x = 1 is y=2.18147
Implementation: Here we are considering the differential equation:
The final value of y at x = 1 is : 2.18147
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Euler Method for solving differential equation
- Runge-Kutta 4th Order Method to Solve Differential Equation
- Gill's 4th Order Method to solve Differential Equations
- Runge-Kutta 2nd order method to solve Differential equations
- Solving f(n)= (1) + (2*3) + (4*5*6) ... n using Recursion
- Data Science | Solving Linear Equations
- Data Science - Solving Linear Equations
- Sum of minimum value of x and y satisfying the equation ax + by = c
- Number of solutions for the equation x + y + z <= n
- Find the missing value from the given equation a + b = c
- Print values of 'a' in equation (a+b) <= n and a+b is divisible by x
- Satisfy the parabola when point (A, B) and the equation is given
- Equation of parabola from its focus and directrix
- Equation of circle from centre and radius
- Program to balance the given Chemical Equation
- Check whether one root of the Quadratic Equation is twice of other or not
- Form the Cubic equation from the given roots
- Find the number of solutions to the given equation
- Sort an array after applying the given equation
- Find the quadratic equation from the given roots
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.