Questions tagged [integration]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
28 views

Computation of a functional for large values

Consider the following function : $$f(x) = \sin^2(\frac{π\Gamma(x)}{2x})$$ Now consider the following functional : $$I(x)=\int_0^\infty \frac{f(x + iy) − f(x − iy)}{e^{2πy}-1} dy$$ I need values for ...
2
votes
2answers
114 views

Weak form of the Navier-Cauchy equation

I am trying to obtain the weak form of the Navier-Cauchy equation, which is $$- \rho \omega ^2 \textbf{U} - \mu \nabla ^2 \textbf{U} - (\mu + \lambda) \nabla (\nabla \cdot \textbf{U}) = \textbf{F}$$ ...
1
vote
0answers
73 views

Is Romberg integration method implemented as weighted function values numerically correct?

I have to integrate expression f(x) * g(x) for many different functions f but just one g. I ...
0
votes
2answers
160 views

Integration by parts with cross derivatives to obtain the weak form [duplicate]

I’m trying to write the weak form of the Navier-Cauchy equation in the component form, where $u_1$ and $u_2$ are the displacement components: $$-(2 \mu +\lambda) \frac{\partial ^2 u_1}{\partial x_1 ^2}...
0
votes
1answer
48 views

How to use cumtrapz correctly?

I have tried to do a trapeze integration with f(x)=x^2, where I know how the antiderivative looks like, so F(x) = (1/3)x^3 Here's my code, just like I tried: ...
0
votes
1answer
87 views

Two RK4 method in one program

I want to solve this integral using RK4 by coding in Fortran: $$R=∫1/a(t) dt → dR/dt=1/a(t) =f(t)$$ Initial point: t=0 (or a=0.001) and R=0 And I have to get a(t) by solving another ...
2
votes
0answers
31 views

To use the confluent hypergeometric function or not to?

I am numerically computing the following integral as a function of positive $k$. $$I(k) := \int_0^\infty x^b(k+x)^{a-1} e^{-x} dx \tag1$$ It is shown in math.stackexchange.com that this can be ...
3
votes
0answers
43 views

Time independent Runge Kutta integration of SDE

I am trying to compare the result of numerical integration of time independent Runge_Kutta, github page for stochastic differential equations with the analytical solution. True answer match the ...
0
votes
0answers
20 views

Does order of data points matter for approximating AUC with unit time steps?

I have a time series of data where the increment is every minute. In order to approximate AUC, I just compute the sum of the data values, since they would all be multiplied by 1 anyway per Riemann sum ...
1
vote
0answers
73 views

Plot of ratio of two integrals:

Consider the following integrals $$ I_1(x) =\int_0^\infty\mathrm dy \frac{F(x + \mathrm iy) − F(x −\mathrm iy)}{\mathrm e^{2πy}-1}, $$ And $$I_2(x) =\int_1^x F(t)dt$$ Where, $ F(z) = \sin^2[π\Gamma(z)/...
5
votes
0answers
97 views

How to numerically evaluate this double Integral?

I want to evaluate the following integral: $$\int_{0}^{60} \ \left(\int_{0}^{2z} 0.5\cdot t \left(\mathrm{erf}(t-a) -1 \right)J_{0}(qt)\mathrm{d}t \right)^2 \mathrm{exp}\left(-\frac{(z-a)^2}{2s^2}\...
2
votes
3answers
234 views

Comparison of integrals with a function:

Consider the following integral: $$S(q)=\int_{x=2}^q\sin^2\left(\frac{π\Gamma(x)}{2x}\right)dx$$ And consider the functions : $$R(q)=\frac{q}{\log(q)}$$ $$T(q)=\int_2^q\frac{1}{\log(x)}dx$$ I ...
1
vote
1answer
62 views

Performing 2d numerical integration with Boost Cpp

I've been learning to use the numerical quadrature of the Boost library for Cpp. In the documentation, I've found an example for 1D Gauss-Kronrod Quadrature using Boost. ...
0
votes
3answers
72 views

Changing variables in integral to avoid infinity

I want to write a code in Fortran to solve this integral numerically: $$\int_{1095}^\infty \frac{dx}{x\sqrt{(x+644.153)(4.17 \cdot 10^{-5} x+0.145)}}$$ What is the best method for it? I tried Monte-...
2
votes
1answer
102 views

Vectorised second order ode solving in python

I am trying to write a python program that simulates the motion of a large number of particles by numerically integrating a second order ordinary differential equation. I first split the ODE into two ...
1
vote
1answer
45 views

Double Integral with Gauss- Hermite for one component

I am trying to perform the following integral $$\int_{0}^{2\pi}\int_{0}^{+\infty} \frac{r'\left(e^{-r'^2/2\sigma^2}\right)\left(r-r'\cos(\theta-\theta')\right)}{r^2+r'^2-2rr'\cos(\theta-\theta')}dr'...
-1
votes
1answer
53 views

Plot of a function involving an integral and value changing parameters [closed]

I'm trying to plot the cross section with respect to the photon energy $h\nu$ but for $\gamma = 1.0, 1.2, 2.0 $ in the same axes $\sigma = \left[\left(\frac{\xi_{eff}}{\xi_{0}}\right)^2 \frac{n_r}{\...
1
vote
1answer
52 views

How do I find the portion of a cell/voxel lying within a defined surface?

We have a 3-dimensional grid of voxels (or cells), with individual voxels being of volume $dx\,dy\,dz$ where $dx=dy=dz=1$. A cone-like surface is defined by some function, $z = f(x, y)$, which in ...
2
votes
1answer
39 views

Adaptive Runge-Kutta for Stochastic (Projected) Gross-Pitaevskii Equation

I am using the XMDS library for solving the stochastic (projected) Gross-Pitaevskii equation $$i \hbar \partial \Phi\left(\mathbf{r},t\right)_t=\hat{\mathcal{P}}\left\{(1-i \gamma)\left(\hat{H}_{\...
2
votes
1answer
80 views

Using Implicit Euler with second order differential equations

We can numerically integrate first order differential equations using Euler method like this: $$y_{n+1} = y_n + hf(t_n, y_n)$$ And with Implicit Euler like this: $$y_{n+1} = y_n + hf(t_{n+1},y _{n+...
2
votes
0answers
40 views

Evaluating integral $F(r_2) = \frac{1}{r_2^n} \int_0^{r_2} r_1^n f(r_1)\ \mathrm{d}r_1$ without growing instability

I have the following expression to be numerically integrated in a vector-based library (e.g. numpy, MATLAB, etc), $$ F(r_2) = \frac{1}{r_2^n} \int_0^{r_2} r_1^n f(r_1)\ \mathrm{d}r_1, $$ where $n$ is ...
3
votes
4answers
442 views

Trapezoid rule vs Gaussian quadrature: what am I missing?

I'm reading a paper right now which criticizes a method because it uses trapezoid rule, rather than "more advanced quadrature rules like the Gauss quadrature"... The Gaussian quadrature rule requires,...
3
votes
2answers
195 views

Solving ODE with “Jumpy” Coefficients

I'm numerically solving a linear coupled ODE of the form $$y^{\prime}(t) = \hat{M}(t)y(t)=\left[\begin{array}{cc}0& A(t)\\ B(t)& 0\end{array}\right]y(t),$$ and the difficulty I'm running into ...
2
votes
0answers
43 views

2-dimensional Gauss-Hermite quadrature in R

A similar question was asked here and the given answer is perfect for a unidimensional integration. I need to make bidimensional integration in R with a Gauss-Hermite quadrature: $$\int_{R^2} h(p1,p2)...
0
votes
0answers
54 views

Is it possble to do this complex symbolic calculation with Matlab?

Sorry it's bit abrupt, but recently I am caught up in some symbolic calcualtion which is tedious and almost impossible with mere human hands, so just wondering is it possible to solve the double ...
1
vote
2answers
124 views

Solving a 1D diffusion equation with linear and nonlinear source terms

I would like to numerically solve the following equation: $$\frac{\partial \rho (z,t)}{\partial t} = B(N_D \rho (z,t) + \rho(z,t)^2) + D \frac{\partial^2 \rho (z,t)}{\partial z^2}$$ with the boundary ...
3
votes
0answers
68 views

Numerical integration with singularity term

In https://www.johndcook.com/blog/2012/02/21/care-and-treatment-of-singularities, the author explains the subtraction method to get rid of singularities when performing numerical integration. The ...
1
vote
0answers
36 views

FFT convolution works only with certain domain length

in my quest to understand how I can use FFT to compute integrals (see my other question click, still no answer there), I came across the fact that a convolution of two functions can be calculated by ...
0
votes
2answers
81 views

Is expm1 the right primitive?

I'm writing some code to calculate $\int_0^1 e^{ax} \mathrm{d} x$. Annoyingly there does not seem to be a way of doing this without if statements: ...
2
votes
1answer
48 views

Numerical integration of the dataset of a function

The energy equation for a spherically symmetric system is given by $$\mathscr{E}=\frac{v^2(r)}{2}+\frac{c_s^2(r)}{\gamma-1}+\phi(r)$$ where $\mathscr{E}$ is the total energy, $v$ is the velocity of ...
1
vote
1answer
80 views

Evaluating an indefinite integral that has no closed form

I need to evaluate the following indefinite integral: $$I=\int\frac{x^5+2ax^3+a^2x-4a}{x^7+ax^5+2ax^4}dx=\int\frac{x^5+2ax^3+a^2x-4a}{x^4(x^3+ax+2a)}dx$$ The solution that I obtained while ...
1
vote
2answers
50 views

Numerical integral with symbolic integral in exponent

Many times in fourier approximation we come across integrals such as $$\int_0^1 e^{-\gamma\int_0^xu_0(\eta)d\eta}dx$$ where $\gamma$ is a constant and the data for $u_0$ is provided as a discretely ...
2
votes
0answers
37 views

Monte Carlo domain not-so-dense

I already posted it on Physics SE, but maybe this is a better place: I have a 5D integral being calculated with a Monte Carlo uniform random sampling. The issue is that the region of integration is ...
7
votes
1answer
135 views

Numerically estimating expected value of f(x) when x is normally distributed

I need to estimate $$ \mathbb{E}_x[f_i(x)] = \int_{\mathbb{R}^n} f_i(x) p(x) dx $$ for many functions $f_i(x)$, where $p(x)$ is the density of a normal distribution. The evaluation of all the ...
4
votes
1answer
233 views

DG-FEM integration by parts

I am going through the book of Hesthaven and Warburton on discontinuous Galerkin methods. I have difficulties understanding some basic steps in the calculations. Consider the PDE: $$\frac{\partial u}...
0
votes
0answers
38 views

Techniques to optimise the integral of a function of known analytical form

I need to compute repeatedly a function that depends on an integral. The integral is not solvable analytically, but it depends on the argument of the function parametrically, like this: $$ f(x) = \...
11
votes
3answers
356 views

Numerical evaluation of highly oscillatory integral

In this advanced course on applications of complex function theory at one point in an exercise the highly oscillatory integral $$I(\lambda)=\int_{-\infty}^{\infty} \cos (\lambda \cos x) \frac{\sin x}...
-2
votes
1answer
85 views

How to : numerical integration by quadrature in C language / remove NaN

What I wanna solve it the problem following ( by quadrature method ) I want to get two arrays of data ( z & tau ) from z[0], tau[0] to z[2249], tau[2249]. Since the integrand diverges at z=0.9, ...
1
vote
1answer
97 views

What's the minimum step size that can be used in Euler's method before it becomes unreliable?

In particular, if Euler's method is implemented on a computer, what's the minimum step size that can be used before rounding errors cause the Euler approximations to become completely unreliable? I ...
3
votes
4answers
474 views

Numerical integration in Python with unknown constant

I’d like to solve the below equation for the unknown $T$: $$\int_0^\infty \frac{x^2}{\exp\left(\frac{x}{T}\right)-1}\kappa_x \mathrm{d}x = C,$$ where $C$ is a known constant and $\kappa_x$ is some ...
4
votes
0answers
123 views

MATLAB: Compute the Schwarz-Christoffel transformation symbolically

Suppose we have a conformal mapping from the unit disk in the $\omega$ plane onto the exterior of a polygon in the $z$ plane. The Schwarz-Christoffel mapping in this case is defined as: $$f(u) = A - ...
0
votes
1answer
102 views

calculating integral for an ODE system

I have an ODE system defining a mathematical model of a biological system, say $$ \frac{da}{dt}=f_1(a,b,\ldots,z,p)\\ \frac{db}{dt}=f_2(a,b,\ldots,z,p)\\ \cdots\\ \frac{dz}{dt}=f_n(a,b,\ldots,z,p) $$ ...
5
votes
0answers
109 views

Best way to numerically compute elliptic integrals of the third kind with complex arguments?

I need to compute elliptic integrals of the third kind with complex arguments, preferably in C++. Is there code out there to do this? I have discovered the Arb library, but that does much more than I ...
0
votes
3answers
76 views

Rudin lecture — if f(x) is not integrable on some interval, does it not have a Fourier Series expansion on that interval?

I found an old lecture on YouTube given by Walter Rudin (1990, in Wisconsin), and towards the beginning he mentions that if $f(x)$ were not integrable, on some interval, it would be obvious that it ...
5
votes
0answers
77 views

Is there a numerically stable way to take $\epsilon \rightarrow 0$ in integrals of the form $\int \frac{f(x)dx}{x+i\epsilon}$?

The Sokhotski-Plemelj theorem states, $$\lim_{\epsilon\rightarrow 0^+}\int_a^b\frac{f(x)dx}{x+i\epsilon} = \mathcal P \int_a^b \frac{f(x)dx}{x} - i\pi f(0). $$ Is there a numerically stable way to ...
6
votes
1answer
114 views

How do I integrate a function defined over an arbitrary area?

Let's say, I have a compact area $S$ (for example a circle, a square or some arbitrary polygon) and a function $f: S \rightarrow \mathbb{R}$. I want to numerically calculate the Integral $$ \int_S f(\...
0
votes
1answer
34 views

FEM 1D poisson substitution integral issue

I'm trying to solve $ \begin{cases} -u''=f \\ u(0)=0 \\ u(1)= \alpha \end{cases} $ with FEM using reference elements and local coordinates. So we have the global ...
1
vote
2answers
214 views

How many quadrature points should I use?

I am trying to compute the following integration $$ \int_0^\infty e^{-y}y^{a/2}L_c^b(y)L_e^d(y)dy $$ using the generalized Gauss-Laguerre quadrature routine in the GNU Scientific Library. Here the $L$'...
1
vote
0answers
23 views

Algorithm for integrating a 6D function in a Morse-Smale 3D cell

Lets say that one has a scalar field defined in 3D space for whose gradient he wants to find the Morse-Smale Complex for later performing an integration of several hexa-dimensional functions over ...
4
votes
1answer
138 views

What is the best numerical method for a six dimensional spherical integral?

I am trying to do integrals of the type $$ \int d^3\vec{p} \int d^3\vec{p}' e^{-p^2} e^{-{p'}^2}f(\vec{p}, \vec{p}') $$ where $\vec{p}$ and $\vec{p}'$ are three dimensional vectors represented using ...