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
- Runge-Kutta 2nd order method to solve Differential equations
- Gill's 4th 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
- Solving Homogeneous Recurrence Equations Using Polynomial Reduction
- Find number of solutions of a linear equation of n variables
- Number of sextuplets (or six values) that satisfy an equation
- Sort an array after applying the given equation
- Number of integral solutions of the equation x1 + x2 +.... + xN = k
- Smallest root of the equation x^2 + s(x)*x - n = 0, where s(x) is the sum of digits of root x.
- Number of non-negative integral solutions of sum equation
- Solve the Linear Equation of Single Variable
- Number of integral solutions for equation x = b*(sumofdigits(x)^a)+c
- Program to find number of solutions in Quadratic Equation
- Find the missing value from the given equation a + b = c
- Absolute difference between sum and product of roots of a quartic equation
- Number of solutions for the equation x + y + z <= n
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.