
- SciPy - Home
- SciPy - Introduction
- SciPy - Environment Setup
- SciPy - Basic Functionality
- SciPy - Relationship with NumPy
- SciPy Clusters
- SciPy - Clusters
- SciPy - Hierarchical Clustering
- SciPy - K-means Clustering
- SciPy - Distance Metrics
- SciPy Constants
- SciPy - Constants
- SciPy - Mathematical Constants
- SciPy - Physical Constants
- SciPy - Unit Conversion
- SciPy - Astronomical Constants
- SciPy - Fourier Transforms
- SciPy - FFTpack
- SciPy - Discrete Fourier Transform (DFT)
- SciPy - Fast Fourier Transform (FFT)
- SciPy Integration Equations
- SciPy - Integrate Module
- SciPy - Single Integration
- SciPy - Double Integration
- SciPy - Triple Integration
- SciPy - Multiple Integration
- SciPy Differential Equations
- SciPy - Differential Equations
- SciPy - Integration of Stochastic Differential Equations
- SciPy - Integration of Ordinary Differential Equations
- SciPy - Discontinuous Functions
- SciPy - Oscillatory Functions
- SciPy - Partial Differential Equations
- SciPy Interpolation
- SciPy - Interpolate
- SciPy - Linear 1-D Interpolation
- SciPy - Polynomial 1-D Interpolation
- SciPy - Spline 1-D Interpolation
- SciPy - Grid Data Multi-Dimensional Interpolation
- SciPy - RBF Multi-Dimensional Interpolation
- SciPy - Polynomial & Spline Interpolation
- SciPy Curve Fitting
- SciPy - Curve Fitting
- SciPy - Linear Curve Fitting
- SciPy - Non-Linear Curve Fitting
- SciPy - Input & Output
- SciPy - Input & Output
- SciPy - Reading & Writing Files
- SciPy - Working with Different File Formats
- SciPy - Efficient Data Storage with HDF5
- SciPy - Data Serialization
- SciPy Linear Algebra
- SciPy - Linalg
- SciPy - Matrix Creation & Basic Operations
- SciPy - Matrix LU Decomposition
- SciPy - Matrix QU Decomposition
- SciPy - Singular Value Decomposition
- SciPy - Cholesky Decomposition
- SciPy - Solving Linear Systems
- SciPy - Eigenvalues & Eigenvectors
- SciPy Image Processing
- SciPy - Ndimage
- SciPy - Reading & Writing Images
- SciPy - Image Transformation
- SciPy - Filtering & Edge Detection
- SciPy - Top Hat Filters
- SciPy - Morphological Filters
- SciPy - Low Pass Filters
- SciPy - High Pass Filters
- SciPy - Bilateral Filter
- SciPy - Median Filter
- SciPy - Non - Linear Filters in Image Processing
- SciPy - High Boost Filter
- SciPy - Laplacian Filter
- SciPy - Morphological Operations
- SciPy - Image Segmentation
- SciPy - Thresholding in Image Segmentation
- SciPy - Region-Based Segmentation
- SciPy - Connected Component Labeling
- SciPy Optimize
- SciPy - Optimize
- SciPy - Special Matrices & Functions
- SciPy - Unconstrained Optimization
- SciPy - Constrained Optimization
- SciPy - Matrix Norms
- SciPy - Sparse Matrix
- SciPy - Frobenius Norm
- SciPy - Spectral Norm
- SciPy Condition Numbers
- SciPy - Condition Numbers
- SciPy - Linear Least Squares
- SciPy - Non-Linear Least Squares
- SciPy - Finding Roots of Scalar Functions
- SciPy - Finding Roots of Multivariate Functions
- SciPy - Signal Processing
- SciPy - Signal Filtering & Smoothing
- SciPy - Short-Time Fourier Transform
- SciPy - Wavelet Transform
- SciPy - Continuous Wavelet Transform
- SciPy - Discrete Wavelet Transform
- SciPy - Wavelet Packet Transform
- SciPy - Multi-Resolution Analysis
- SciPy - Stationary Wavelet Transform
- SciPy - Statistical Functions
- SciPy - Stats
- SciPy - Descriptive Statistics
- SciPy - Continuous Probability Distributions
- SciPy - Discrete Probability Distributions
- SciPy - Statistical Tests & Inference
- SciPy - Generating Random Samples
- SciPy - Kaplan-Meier Estimator Survival Analysis
- SciPy - Cox Proportional Hazards Model Survival Analysis
- SciPy Spatial Data
- SciPy - Spatial
- SciPy - Special Functions
- SciPy - Special Package
- SciPy Advanced Topics
- SciPy - CSGraph
- SciPy - ODR
- SciPy Useful Resources
- SciPy - Reference
- SciPy - Quick Guide
- SciPy - Cheatsheet
- SciPy - Useful Resources
- SciPy - Discussion
SciPy - integrate.dblquad() Method
The SciPy integrate.dblquad() is used to calculate the double numerical integration which means it accept two variables say(x, y) to work on. A calculation of two variable used in linear algebra mathematics.
Syntax
Following is the syntax of the SciPy integrate.dblquad() method −
dblquad(func, a, b, lambda x: 0, lambda x: 1)
Parameters
This method accept the following parameter −
- func: This parameter is used to work with integrals.
- a: The integer value is passed to this parameter(limit of integration in x).
- b: The integer value is passed to this parameter(limit of integration in x).
- lambda x: 0: This parameter is used to represent the lower limit of integration for inner integer variable as y(0) with respect to x.
- lambda x: 1: This parameter is used to represent the upper limit of integration for inner integer variable as y(1) with respect to x.
Return value
This method returns the result in form of float values.
Example 1
Following is the basic example that shows the usage of integrate.dblquad() method.
from scipy import integrate # define the function def fun(x, y): return x + y # perform the operation using dblquad() res, err = integrate.dblquad(fun, 0, 1, lambda x: 0, lambda x: 1) # display the result print("The result is ", res) print("The estimated error is ", err)
Output
The above code produces the following output −
The result is 1.0 The estimated error is 1.662923778137264e-14
Example 2
Here, we perform the double integration of function f(x,y) = x.y over the region covered x and the x is ranges between the interval 0 and 1.
from scipy.integrate import dblquad # define the function def fun(x, y): return x * y # perform the operation using dblquad() res, err = dblquad(fun, 0, 1, lambda x: x**2, lambda x: x) # display the result print("The result is ", res) print("The estimated error is ", err)
Output
The above code produces the following output −
The result is 0.04166666666666666 The estimated error is 1.0313680578775149e-15
Example 3
Below is the another demonstration of dblquad() to perform the task with three variable say(x, y, z) and calculate the result with the help of lambda function.
Mathematically, it is represented by f(x,y) = c(x+y) over a region x and have range interval.
from scipy.integrate import dblquad # define the function def fun(x, y, c): return c * (x + y) c = 2 # perform the operation using dblquad() res, err = dblquad(fun, 0, 2, lambda x: 1, lambda x: 3, args=(c,)) # display the result print("The result is ", res) print("The estimated error is ", err)
Output
The above code produces the following output −
The result is 24.0 The estimated error is 2.6645352591003757e-13