Given the following inputs:
- An ordinary differential equation that defines the value of dy/dx in the form x and y.
- Initial value of y, i.e., y(0).
The task is to find the value of unknown function y at a given point x, i.e. y(x).
Input: x0 = 0, y = 3.0, x = 5.0, h = 0.2
Output: y(x) = 3.410426
Input: x0 = 0, y = 1, x = 3, h = 0.3
Output: y(x) = 1.669395
Gill’s method is used to find an approximate value of y for a given x. Below is the formula used to compute next value yn+1 from previous value yn.
yn+1 = value of y at (x = n + 1) yn = value of y at (x = n) where 0 ≤ n ≤ (x - x0)/h h is step height xn+1 = x0 + h
The essential formula to compute the value of y(n+1):
The formula basically computes the next value yn+1 using current yn:
- K1 is the increment based on the slope at the beginning of the interval, using y.
- K2 is the increment based on the slope, using
- K3 is the increment based on the slope, using
- K4 is the increment based on the slope, using
The method is a fourth-order method, meaning that the local truncation error is of the order of O(h5).
Below is the implementation of the above approach:
y(x) = 3.410426
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.
- Write an Efficient Method to Check if a Number is Multiple of 3
- Babylonian method for square root
- Print all permutations in sorted (lexicographic) order
- Horner's Method for Polynomial Evaluation
- Multiplicative order
- Primality Test | Set 1 (Introduction and School Method)
- Primality Test | Set 2 (Fermat Method)
- Gaussian Elimination to Solve Linear Equations
- Program for Bisection Method
- Program for Newton Raphson Method
- Runge-Kutta 4th Order Method to Solve Differential Equation
- Linear Diophantine Equations
- Largest number smaller than or equal to n and digits in non-decreasing order
- Tidy Number (Digits in non-decreasing Order)
- Fast method to calculate inverse square root of a floating point number in IEEE 754 format
- Generate k digit numbers with digits in strictly increasing order
- Using Chinese Remainder Theorem to Combine Modular equations
- Biggest number by arranging numbers in certain order
- Program for Muller Method
- Magic Square | Even Order
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.