What is Numerical integration: Definition and 147 Discussions

In analysis, numerical integration comprises a broad family of algorithms for calculating the numerical value of a definite integral, and by extension, the term is also sometimes used to describe the numerical solution of differential equations. This article focuses on calculation of definite integrals.
The term numerical quadrature (often abbreviated to quadrature) is more or less a synonym for numerical integration, especially as applied to one-dimensional integrals. Some authors refer to numerical integration over more than one dimension as cubature; others take quadrature to include higher-dimensional integration.
The basic problem in numerical integration is to compute an approximate solution to a definite integral





{\displaystyle \int _{a}^{b}f(x)\,dx}
to a given degree of accuracy. If f (x) is a smooth function integrated over a small number of dimensions, and the domain of integration is bounded, there are many methods for approximating the integral to the desired precision.

View More On Wikipedia.org
  1. chwala

    Use Euler method to determine the approximation of given problem

    There is a mistake in my opinion on the text. In my working i have, ##y_1= 3 + 0.2 e^{\cos1} = 3+ 0.54357 = 3.54357## ##y_2 = 3.54357 + 0.2 e^{\cos 1.2} = 4.0871## ##y_3 = 4.0871 + 0.2 e^{\cos 1.4} = 4.6305## I also noted that we do not have an exact solution for this problem.
  2. C

    A Memory issues in numerical integration of oscillatory function

    Hello! I need to numerically integrate a frequently oscillating, decaying complex function over the interval from 0 to infinity, which is continuous. For brevity, I provide the general integral view $$\int_{0}^{\infty} A(t)e^{e^{iw't}}dt$$. I'm using Python libraries for this task...
  3. chirag1

    A Numerical evolution of Einstein-Boltzmann equations in cosmology

    I'm trying to numerically evolve the Einstein-Boltzmann equations for cold dark matter perturbations using Runge-Kutta method of the fourth order. There are 5 standard equations: $$ \begin{align} \dot{\Theta}_{r,0}+k\Theta_{r,1}&=-\dot{\Phi} \\ \dot{\Theta}_{r,1}+\frac{k}{3}\Theta_{r,0} &...
  4. Another

    Confused between the units of a constant and the units of the integral boundary conditions

    I want to integrate this function ## \int_{0.8um}^{1.8um} A e^{B/E(x)} \, dx ## But A has a unit as ## 1/cm ##. Should I change ##1/cm## to ##1/um## by multiplying ##1/10^{4}## For this function, I decided to integrate using the online numerical integral, This side . I am just curious that...
  5. S

    Question about approximate numerical integration methods

    This isn't a homework question per se but I can post more details like the data points & my work after. Suppose we are given a set of arbitrary points for which we cannot find an equation and we need to find the area under the curve without an analytical method - we can use either of the three...
  6. M

    Mathematica Numerical integration over a Green's function

    Hi PF! I'm numerically integrating over a Green's function along with a few very odd functions. What I have looks like this NIntegrate[-(1/((-1.` + x)^2 (1.` + x)^2 (1.` + y)^2)) 3.9787262092516675`*^14 (3.9999999999999907` + x (-14.99999999999903` + x (20.00000000000097` -...
  7. uzi kiko

    Python Numerical integration over a disk with polar coordinates

    In my job, I was given the task of calculating a force that operates an ultrasound transmitter on a receiver. The calculation is made by assuming that each point on the transmitter is a small transmitter and integration should be made on the surface of the transmitter. Since the transmitter is...
  8. T

    I Bose-Einstein numerical integration

    Want to integrate the total energy density over all photon energies between two temperature values from 500K to 5800K, but not sure how to proceed. Here is some examples to help:
  9. T

    Orbital equations in polar coordinates

    The equations of motion are: \ddot{r}-r{\dot{\theta}} ^{2} = -\frac{1}{r^{2}} for the radial acceleration and r\ddot{\theta} + 2\dot{r}\dot{\theta}= 0 for the transverse acceleration When I integrate these equations I get only circles. The energy of the system is constant and the angular...
  10. E

    Discontinuities in a Poincare map for a double pendulum

    I'm generating poincare sections of a double pendulum, and they mostly look okay, but some of them have weird discontinuities that seem wrong. The condition for these sections is the standard ##\theta_1 = 0## and ##\dot{\theta}_1 > 0##. Looking at one of the maps, we see that most of the...
  11. S

    Numerical integration - Gauss Lobatto

    Homework Statement I need calculate the points (##x_i##) and weights (##w_i##) with Gauss Lobatto seven points on the interval [a,b]. With the points and the weights I am going to approximate any integral at this interval.Homework Equations I have found the relevant points and weights at the...
  12. opus

    I Determining an n for Numerical Integration

    When estimating an integral using trapezoidal approximation, we can find the error or uncertainty in the estimation by: ##Error~in~T_n \leq \frac{M(b-a)^3}{12n^2}## where ##M## is the maximum value of the absolute value of f''(x) over [a,b], ##n## is the number of intervals, and ##T_n## is the...
  13. M

    Mathematica Why is the Numerical Integration Resulting in Zero for a Non-Zero Function?

    Hi PF! The following function is long but only 3 command lines: first defines the function ff, second numerically integrates the function, and third plots the function. As you'll see the integral is zero yet clearly that is not the case (seen from the plot). Any idea what's happening? ff =...
  14. SchroedingersLion

    Python Solving Double Integral with Monte Carlo Integration

    Greetings, I am desparately trying to solve a double integral via Monte Carlo integration. I integrate over two probability densities, the Beta distributions. Python can easily draw samples from these densities and calculate its function values. The integral can be seen here: Now my idea was...
  15. 9

    I Integrating Discrete Data for Navigation: A Comprehensive Guide

    I have values for the variables (C, v, g, w at all sample points) but I do not know how to evaluate the integral. This equation is supposed to be implemented on a computer as part of a larger algorithm for navigation purposes. I have a feeling that the gyroscope sensor reading and or the...
  16. E

    Numerical Integration in Python

    I want to find the numerical solution to the following nested integral in Python \frac{K!}{(K-M)!}\int_{x_1=0}^{y}\int_{x_{2}=x_1}^{\max(x_1,\,y-x_1)}\cdots \int_{x_M=x_{M-1}}^{\max(x_{M-1},\,y-\sum_{m=1}^{M-1}x_m)} \frac{1}{(1+x_M)^{K-M+2}}\prod_{m=1}^{M-1}...
  17. E

    MATLAB What does a maximum number of intervals warning mean in numerical integration?

    Hi, I am trying to evaluate the following integral numerically in MATLAB \int_0^{\infty}\frac{e^{-jt}E_1^2(-jt)}{t}\,dt where ##j=\sqrt{-1}##, and ##E_1(x)## is the exponential integral. My code is fun = @(x) (exp(-1i*x).*(expint(-1i*x)).^2)./x; q = integral(fun,0,Inf) but I get the...
  18. E

    MATLAB How Can I Perform Double Numerical Integration in MATLAB or Mathematica?

    I have the pdf of a random variable found from the characteristic function given by f_X(\alpha)=\frac{1}{2\pi}\sum_{m=0}^Mj^m{K\choose m}\int_0^{\infty}e^{-jt(m+\alpha)}E_1^m(-jt)\,dt where ##j=\sqrt{-1}## and ##E_1(x)## is the exponential integral. I need to find the CDF of the random...
  19. S

    Numerical integration of sharply peaking functions

    Homework Statement ∫ e1000((sinx)/x) dx [0 to 1000 : bound of integration]. Solve this integral of a sharply peaked function without a calculator. Homework Equations I'm doing this in relation to statistical thermodynamics - I think I need to use Sterling's Approximation or a gamma function...
  20. C

    Python Numerical integration 'quad' error

    I have defined a series of functions below with the end function `fA` being inserted for a numerical integration. The integration is with respect with one variable so the other arguments are passed as numeric so that the integration method (quad) may proceed import numpy import...
  21. M

    MATLAB Numerical Integration with variable limits MATLAB

    Hi PF! Suppose I have two functions ##f(x),\,g(y)## that are numerically defined as vectors (i.e. ##g(y) = [0,1,4,9,16]:y = [0,1,2,3,4]## and say ##f(x) = [0,1,8,27,64]:x = [0,1,2,3,4]##) and am trying to compute $$\int_0^1 f(x) \int_x^1 g(y)\, dydx.$$ How would I do this in MATLAB? I could be...
  22. JTC

    A Newmark-Beta vs Predictor Corrector

    Hello, I am teaching myself various numerical methods for integrating coupled, second order differential equations. I am looking at Newmark-Beta methods Sometimes I see Newmark Beta implemented as a predictor/corrector method. Sometimes I see just Newmark methods alone. And I get confused...
  23. O

    I Gaussian Quadrature on a Repeated Integral

    Hi there, I am having some difficulty evaluating a repeated integral, which is the first of two shown in the image. I had hoped to be able to use Gaussian Quadrature to provide a numerical result, however am unsure on if this is possible for a repeated integral? I have attempted to use Cauchy'...
  24. P

    I Numerical Integration twice (acceleration to displacement)

    Hello everyone I have the following question regarding numerical integration twice from acceleration to displacement. Suppose that a particle has acceleration function of a = tt (which has non-elementary integral), to find the velocity it is easy as I can use Simpson's rule for numerical...
  25. Alexanddros81

    Simple Pendulum motion - Numerical Integration

    Homework Statement The differential equation of motion for the simple pendulum can be shown to be ##\ddot {θ} = -(g/L)sinθ##. Given that L=9.81 m and that the pendulum is released from rest at θ=60deg, determine the time required for the pendulum to reach the position θ=0deg. Use Δt=0.10s, and...
  26. G

    Engineering Simulation of Circuits Without Kirchhoff's Laws?

    1. The problem statement, all variables, and given/known data I am currently drafting a proposal for a project in Computational Physics. I'm planning on creating a program that simulates circuits numerically instead of solving the system of equations. The purpose of my project is to observe the...
  27. Alexanddros81

    Determine stopping distance of a train - modified Euler method

    Homework Statement 12.81[/B] A train traveling at 20m/s is brought to an emergency stop. During braking, the acceleration is a=-(7/4)+(t/16) m/s^2, where t is the time in seconds measured from when the brakes were applied. (a) Integrate the acceleration from t=0 to t=16s using Euler's method...
  28. Alexanddros81

    Determine stopping distance of a train traveling at 20m/s

    This is problem 12.81 from Pytels Dynamics 2nd edition 1. Homework Statement A train traveling at 20m/s is brought to an emergency stop. During braking, the acceleration is a=-(7/4)+(t/16) m/s^2, where t is the time in seconds measured from when the brakes were applied. (a) Integrate the...
  29. Fabio Kopp

    How to integrate when one of the limits is a variable?

    I'm trying to integrate a simple function (x*y) using the Romberg method. Question 1: I want to integrate only x and maintain the argument y present in the rest of calculation, like a global variable. In fortran 77 I would use common. Question 2: How to integrate using arguments in the...
  30. S

    Numerical integration in Python (throwing a ball)

    Homework Statement I have a problem with my physics task, but you do not need to understand physics to be able to help me, because my main problem is bad programming skill. I am dealing with a problem of throwing a ball in the air at an angle between 0 an 45 degrees. I need to consider not only...
  31. E

    I How do you Calculate the Points in Gaussian Quadrature?

    How do you calculate the necessary points in a function to numerically integrate it using the Gaussian Quadrature? If I were to evaluate a function using two points, the Gaussian Quadrature needs the value of the function at ##\displaystyle{\pm \sqrt{\frac{1}{3}}}## with weights of unity. How...
  32. D

    I don't get a reasonable output for my code?

    I'm trying to plot the probability of error for the following equation using Matlab software, i want to use the command "trapz" for the numerical integration, the problem is that i get a fine shape for the plot, but the values in the y-axis are wrong, the whole curve should be between 0 and 1.2...
  33. M

    A How to Integrate the geodesic equations numerically?

    Hello there, I've been considering the geodesic equations of motion for a test particle in Schwarzschild geometry for some time now. Similar to what we can do with the Kepler problem I would like to be able to numerically integrate the equations of motion. I'm quite interested to see how...
  34. E

    A Comparative statistics of (trivariate) random event

    Problem: I'm interested in studying the probability of an event involving a random vector. Specifically, I'm interested in (∂/∂a)Pr[X>( (Y-a)/Z )] Where "a" is a non-random parameter and the random vector {X,Y,Z} is distributed Normal( µ, Σ) for µ={0,0,0} and Σ= {{1, 0.5, 0.5}, {0.5, 1, 0}...
  35. I

    Mathematica Numerical solution of integral equation with parameters

    Hello! Could you tell me about how to take the next numerical calculation in mathematica? (perhaps there are special packages). I have an expression (in reality slightly more complex): ## V=x^2 + \int_a^b x \sqrt{x^2-m^2} \left(\text Log \left(e^{-\left(\beta...
  36. vmr101

    Numerical Integration of Chandrasekhar's Equation

    Homework Statement We need to write an integrator for the Chandrasekhars Equation (CE) for White Dwarfs (WD) using python3/NumPy/Matplotlib. We then need to compute the structure of a WD made of our varying elements. We also need to compute and plot the mass-radius relation for WD. Homework...
  37. E

    I Decomposing a Function for Numerical Integration

    Is their a tutorial or a reference on how to decompose a function, specifically Fourier and Legendre decomposition, for numerical integration? The method I am going to use for the numerical integration is the Gauss Quadrature, and I suppose I need to decompose my function for the rule to work...
  38. F

    A Numerical integration of motion

    Hi,I'd like to build a simulation (realtime) of space ships near a black hole (neutral, still or rotating possibly). Key features would be: 1) the ships are test particles that do not affect the metric a) possibly test rigid-bodies with GR consistent rotational DOF. 2) the ships can fire...
  39. user123897

    Java Numerical integration of an harmonic oscillator using java

    Hi, I am trying to analyze the an harmonic oscillator using kinematics. first i calculate the force applied by the spring (f = (-x)*k) then i calculate the acceleration (a = f/m) then speed (v= v0 + v0t + 0.5*a*t^2) and finally update x (x = x0+vt) this is a simplfied loop of my program...
  40. davidbenari

    I Numerical integration of PDEs: How do you satisfy boundary conditions

    Suppose we are solving a diffusion equation. ##\frac{\partial}{\partial t} T = k\frac{\partial^2}{\partial x^2} T## On the domain ##0 < x < L## Subject to the conditions ##T(x,0) = f(x) ## and ##T = 0 ## at the end points. My question is: Suppose we solve this with some integration scheme...
  41. F

    MATLAB Finite difference numerical integration or ode45?

    I'm trying to numerically solve the time dependent Schrödinger equation and I've been told that the best approach is to numerically integrate using a finite difference method, however I don't understand why I couldn't just use ode45 to solve it?! Is the finite difference (interpolation) method...
  42. C

    MATLAB Numerical Integration with Matlab - Solve K33, K11 Integral

    Hi all, i need help solving the following integral using Matlab: * tetam is a parameter and the integration is by alpha. the answer should be function of tetam * K33, K11 are constantsThanks , Chen
  43. E

    Mathematica Numerical vs. Monte-Carlo Simulations

    I have an integration that doesn't have a solution in the table of integrals. So, I evaluated it using Mathematica using the command NIntegrate. However, when I compare the result with Monte-Carlo simulations, there is a very small constant gap between the two curves. Is it because of the...
  44. E

    Mathematica Solving Mathematica Error: NIntegrate::ncvb

    Hello, I have the following code in Mathematica, and it gives the following error: NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 12 recursive bisections in x near {x} = {0.000156769}. NIntegrate obtained 0.21447008480474927` and 5.637666621985554`*^-13 for the...
  45. R

    MATLAB Bisection method and numerical integration

    In Matlab I am trying to use the composite Simpson's rule to find ##x_l## so that $$170=\int^{x_l}_0 \sqrt{1+(y')^2} dx = \int^{x_l}_0 \sqrt{1+\left( \frac{x^2}{68000} \right)^2} dx $$ For convenience this can be written as $$I(x) = 170 - \int^x_0 \sqrt{1 + (\frac{x^2}{68000})} dx$$ The...
  46. sunrah

    Numerically integrate bivariate function

    What methods are available for integrating, e.g. \int^{\infty}_{0} f(x) dx \int^{x}_{0} g(x,y) dy numerically without resorting to symbolic integration. Thanks
  47. O

    Selecting a numerical method

    Good Day Let's say I have developed a new method to extract, more efficiently (yes, "more efficiently" is ill-defined; but bear with me) the differential equations that describe a specific phenomena (please just assume it). So now I have a system of coupled second order differential...
  48. D

    Help with numerical integration

    I want to integrate a function numerically from 0 to infinity where for small x ##f(x)\sim x^{-5/2} \exp(-a/x)## and for large x ##f(x) \sim \exp(-bx)##. How do I best treat the steep rise for small x?
  49. Rapier

    Numerical Integration for Magnetic Field of a Loop of Wire

    Homework Statement Calculate the magnetic field of a current loop. Compare your numerical results with exact solution above the center of the loop. Investigate the effect of the grid size based on this comparison. Homework Equations dB = u0*I/4pi * (dL * R) / (R^2 + Z^2)^3/2 Bz = u0*I*R^2/ (2...
  50. QPingy

    Numerical integration - verlet algorithm - accuracy

    In my computational physics textbook, three different velocity estimators are derived for a problem with equation of motion: \ddot x = F(x) where the positions are found by using the Verlet algorithm: x(t+h) = 2 x(t) - x(t-h) + h^2 F[x(t)] The three velocity estimators are: v(t) = \frac{x(t+h)...