Given a function, f(x), tabulated at points equally spaced by such that
- …..and so on
The upper and lower limits a, b correspond to which the integral needs to be found, the task is to find the integral value of the given equation f(x).
Input: a = 0, b = 4,
Integral of (1 / (1 + x)) is 4ln(|1 + x|)0 + c.
On substituting the limits, ln(|5|) + ln(|1|) = 1.6178.
Input: a = 0.2, b = 0.6,
Approach: In this article, Boole’s rule is discussed to compute the approximate integral value of the given function f(x).
Boole’s rule is a numerical integration technique to find the approximate value of the integral. It is named after a largely self-taught mathematician, philosopher and logician George Boole. The idea of the Boole’s technique is to approximate the integral using the values of ‘fk‘ at some equally spaced values(h in the given image). The following illustration shows how various fk’s are considered:
The integral value of the Boole’s rule is given by the formula:
- In the above formula, an error term which comes when integration is of the order 6. The error term is .
- are the values of f(x) at their respective intervals of x.
- Therefore, the following steps can be followed to compute the integral of some function f(x) in the interval (a, b):
- The value of n=6, which is the number of parts the interval is divided into.
- Calculate the width, h = (b – a)/4.
- Calculate the values of x1 to x5 as
Consider y = f(x). Now find the values of for the corresponding values.
- Substitute all the values in the Boole’s rule to calculate the integral value.
Below is the implementation of the above approach:
f(x) = 1.6178
- Write a program to calculate pow(x,n)
- Write a program to reverse digits of a number
- Program to find whether a no is power of two
- Program to find parity
- Write an Efficient C Program to Reverse Bits of a Number
- Write a program to print all permutations of a given string
- Write a program to add two numbers in base 14
- Program for Fibonacci numbers
- Program to find amount of water in a given glass
- Program to convert a given number to words
- Efficient program to calculate e^x
- Efficient program to print all prime factors of a given number
- Program for nth Catalan Number
- Write a function that generates one of 3 numbers according to given probabilities
- Write an iterative O(Log y) function for pow(x, y)
- Program for Rank of Matrix
- Euler's Totient Function
- Euler's Totient function for all numbers smaller than or equal to n
- Program for Bisection Method
- Program for Newton Raphson Method