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
∫
a
b
f
(
x
)
d
x
{\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.
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.
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...
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} &...
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...
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...
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` -...
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...
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:
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...
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...
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...
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...
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 =...
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...
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...
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}...
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...
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...
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...
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...
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...
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...
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'...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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}...
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...
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...
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...
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...
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...
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...
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...
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
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...
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...
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...
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
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...
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?
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...
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)...