Scipy Integration Method to implement Integration Result:-


scipy.integrate library has single integration, double, triple, multiple, Gaussian quadrate, Romberg, Trapezoidal and Simpson's rules.


Integration for Single value range:-
quad() is used to represent single integration in scipy.

from scipy import integrate
# take f(x) function as f
f = lambda x : x**2
#single integration with a = 0 & b = 1  
integration = integrate.quad(f, 0 , 1)

print(integration)
..............................................................................

Double Integration Example in Scipy:-

from scipy import integrate
import numpy as np
#import square root function from math lib
from math import sqrt
# set  fuction f(x)
f = lambda x, y : 64 *x*y
# lower limit of second integral
p = lambda x : 0
# upper limit of first integral
q = lambda y : sqrt(1 - 2*y**2)
# perform double integration
integration = integrate.dblquad(f , 0 , 2/4,  p, q)

print(integration)

                                        

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post