Questions tagged [numerical-integration]
Questions on the use of numerical functions NIntegrate and NDSolve.
3,679 questions
2
votes
1
answer
143
views
Numerically integrate an implicit vector vectorizedly
I want to define a function f[x] and then be able to integrate numerically as a vector - not component by component. The following is my failed attempt:
...
3
votes
2
answers
219
views
Solving a coupled 2nd order differential equation numerically using NDSolve
I would like to solve the following system of differential equations numerically for two one-dimensional functions $R(x)$ and $\phi(x)$:
\begin{eqnarray}
c_1 \left(R''(x) - (\phi'(x))^2 R(x) \right) - ...
2
votes
0
answers
60
views
how to improve the predictor corrector schemes including computational cost
I am currently implementing a variable-order fractional predictor–corrector scheme in Mathematica. Since I am still a beginner with Mathematica programming, I encountered several issues during the ...
3
votes
1
answer
183
views
Mathematica ODE question
I am trying to solve an iterative matrix ODE of the form $f_k'(x)=T.f_k(x)+B(x)*S.f_{k-1}(x)$, where f is an $n$ dimension column, T and S are $n \times n$ matrices, and $B(x)$ is a function. The ...
0
votes
1
answer
160
views
NIntegrate on apparently simple function returning convergence issues
I am looking for a help in numerically integrating this function:
...
2
votes
0
answers
74
views
Event is not triggered in NDSolve
I'm solving an ODE system with multiple events and find the discrete variable not updated as expected because one of the events is not triggered. During narrowing down the problem, I find something ...
4
votes
2
answers
370
views
Fluctuating results with NIntegrate
I've been trying to calculate an integral using NIntegrate as follows.
...
3
votes
0
answers
125
views
Efficiently Finding Optimal Configurations of Lofted Solids
A lofted solid is like a solid cylinder with two different end caps.
A natural set of questions given a lofted solid using two shapes would be if we were to be able to rotate an end around the ends ...
0
votes
0
answers
104
views
How to integrate this highly singular function?
I have a function $f(z,\bar{z})$ that I would like to eventually integrate over the whole complex plane $\mathbb{C}$ parametrized by $(z,\bar{z})$. The function $f(z,\bar{z})$ has a singularity near $...
5
votes
2
answers
314
views
NDSolve exceedingly slow
I the following ODE with parameters
\begin{align}
B_e\: \theta''(s)+2(s-1)\cos\theta(s)=S_e\: f\left(\theta(s)\right),
\end{align}
with $0\leq s\leq 1$ and
\begin{align}
\theta(0)=0\:\:\:\text{and}\:\:...
7
votes
2
answers
405
views
Strange issue with numerical integration
I have mathematica 14.3.
I have encountered a weird issue when numerically integrating this complicated function
...
3
votes
1
answer
197
views
circumventing apparent errors in Integrate and NIntegrate
I have been working on a wiki page about asymptotic Laurent series for derangements, and recently learned that the converse of Watson's lemma often holds, allowing one to represent such series as ...
1
vote
1
answer
160
views
How should I deal with some unexpected values in numerical integration?
I computed the following numerical integration, which contains some unexpected points. How to revisit it?
...
1
vote
2
answers
177
views
Numerical integration with Singularity
I have an integral that I want to integrate over the whole $\mathbb{C}$ plane, say parametrized by $(z,\bar{z})$. The integrand is of the following form
$$ \frac{f(z,\bar{z})}{|1-z|^2} - \frac{C}{|1-z|...
0
votes
1
answer
179
views
Equivalent integrals, different answers
Below are two equivalent definite integrals.
$$\begin{align*}S&=2\pi\int_0^\pi b\sin t\sqrt{a^2\sin^2t+b^2\cos^2t}\text dt\\
&=4\pi b\int_0^\frac{\pi}{2}\sin t\sqrt{a^2-(a^2-b^2)\cos^2t}\text ...
0
votes
0
answers
76
views
Increasing the working precision gives me an error message in NIntegrate
I am hitting a problem with numerical integration. I have a function (a4xinteg in this expression below), the expression is quite long so below you can find a plot of it:
I would like to integrate ...
0
votes
0
answers
86
views
Using FindRoot with several NIntegrate inside
I have the following system
$$-a_1^2 + 2 a_0 a_2 - 2 b_0 b_2 =0\quad \text{and } \quad a_2^2 - 2 a_1 a_3 + 2 a_0 a_4 - b_2^2 - 2 b_0 b_4 =0$$
where the following $a_i, b_i$ are integral of some ...
5
votes
0
answers
147
views
"Glueing" interpolating functions
Suppose we have two interpolating functions with exactly touching domains, in our case {-1, 1} and {1, 2}.
How to "glue&...
4
votes
2
answers
155
views
Using NDSolve when bounds of independent variable are uncertain (unknown)
Here we have code that uses WhenEvent[x[t] + y[t] == # & /@ {0.25, 0.5, 0.75} // Evaluate for three different events.
...
5
votes
2
answers
275
views
Extract information from NDSolve during evaluation
I want to find for which t any of these holds: x[t] + y[t] == 0.25, x[t] + y[t] == 0.5, <...
2
votes
1
answer
248
views
Efficiently computing complicated multi-dimensional integrals involving Gaussian envelops
Consider a function like this
...
0
votes
0
answers
88
views
Unexpected linear decay in gravitational waveform amplitude using NDSolve—how to fix?
I'm solving the Regge–Wheeler equation in Schwarzschild spacetime
D[u[t, x], {t, 2}] + Vsx[x]*u[t, x] == D[u[t, x], {x, 2}],
with the potential
...
2
votes
4
answers
201
views
Using NDSolve to solve three coupled ODEs
I am trying in this code to solve three non-linear ODEs together, and I want to plot the three functions as functions of η.
Why does my code not work?
...
0
votes
0
answers
54
views
integrand to non-numerical values when doing numerical integration of numerical integrations [duplicate]
Could someone please explain me why these errors happen and if it's possible to solve them?
Here's my code
...
6
votes
4
answers
785
views
How to speed up this NIntegrate which is calculated many times?
Is there a trick to speed up the following calculations?
...
0
votes
2
answers
265
views
Error on numerical integration
Is there a way to obtain the error on a numerical integration using NIntegrate ?
I have try this answer https://mathematica.stackexchange.com/a/102469/111297, ...
1
vote
0
answers
93
views
Determinant with numerical value and Working precision
I have a matrix, with entries are series with numerical coefficients
$$
\begin{pmatrix}
G(q) & F(q) \\
F(q) & G(q\rightarrow-q)
\end{pmatrix}
$$
With $G(q)$ is an expansion obtained with <...
4
votes
1
answer
244
views
Generating Poincaré sections
I would like to reproduce the Poincaré sections presented in this and this papers, which look like
The figures are for energy values of E=0.2 (a) and E=0.25 (b) in the Hamiltonian, which reads
$$H=\...
2
votes
2
answers
120
views
Limit and NIntegrate do not commute
I am triggered about something, I have the following limit:
$$
\tiny \lim_{\beta \to \infty}
\left[\frac{k^2 y^2 \, sech^2\left(\frac{1}{4} \sqrt{4 - 4k^2 + k^4 + 4y^2} \,\beta\right)\left(\sqrt{4 - ...
6
votes
1
answer
677
views
How do you increase the precision and accuracy of the numerical approximation of the Volchkov integral?
There is a need to increase the number of correct decimal digits from this integral:
...
0
votes
0
answers
118
views
Series expansion from NIntegrate
I have a very nasty integrand
$$A(q,\Omega,k,\beta,y,x)= \int \mathrm{d}k \, \mathrm{d}x \, \mathrm{integrand_A}$$
where $\beta,y$ are numbers, and I integrate over $k$ and $x$ so at the end I only ...
7
votes
6
answers
633
views
NDSolve not able to adjust condition in ODE
I'm trying to solve the equation
\begin{align}
\epsilon_b\:\theta''(s)-(l-s)\cos\theta(s)=\epsilon_\gamma\sin\theta(s)\cos\theta(s),
\end{align}
with $0\leq s\leq l$ and
\begin{align}
\theta(0)=0\:\:\:...
2
votes
2
answers
269
views
How to use Schwarzschild geodesic equation in 2D with Energy
I'm trying to plot the motion of a star around a black hole by using the Schwarzschild equations in 2D. I will use only r and φ equations, while the equation for t will be obtained from the energy ...
0
votes
0
answers
144
views
How to solve a regular integral with divergence analytically
I want to analytically integrate this integration
$$\int_0^{1 - 3/rs}\left(\frac{9 \sqrt{3} \sqrt{\frac{1}{\left(1-\frac{2}{\eta }\right) \eta ^2 \left(\frac{\eta
^2}{1-\frac{2}{\eta }}-27\right)}}}...
0
votes
1
answer
82
views
Trouble with NIntegrate (errors: NIntegrate::inumri, Format::toobig)
I am working on a light-matter interaction project and I am stuck on an integration. The problem is as follows: I have a system of 16 equations with 16 unknowns. I can solve this system of equations (...
3
votes
1
answer
181
views
Effective numerical integration inside triangle
I want to integrate a function like
NIntegrate[f[x1] g[x2], {x1, 0, L}, {x2, x1, L}]
which is a triangle region. For every x1, ...
1
vote
1
answer
325
views
Errors in solving a complex equation: FindRoot and NIntegrate cannot converge
I am trying to numerically solve a complex equation eq[x,y,μ] that includes a complex integral. The integrand contains the inverse hyperbolic tangent function ...
3
votes
2
answers
234
views
NDSolveValue giving nlnum warning for ODE with discontinuity
The following code
...
1
vote
0
answers
83
views
Numerical inverse Fourier Transform of a singular function
I'm working on computing the inverse Fourier transform of a function derived from a matrix construction involving a Poisson-weighted system. Here's the relevant setup.The main object is a matrix-...
8
votes
1
answer
293
views
Generating natural structures with Mathematica
I am interested in Fomes Fomentarius or "Tinder Polypore" mushroom patterns
(original photo, diagrams of Voronoi and Delaunay):
At first it seems something simple, like a sunflower seed ...
2
votes
1
answer
195
views
NDSolve of a beautiful Integro-differential equation
I have a problem when I want to solve this integro-differential equation where the $\chi' (U)$ appears in the integrand. If statement gives the $chiIntegral=0$ for $umax=20$ since the upper bound of ...
2
votes
1
answer
145
views
Integrate and Plot
I have a function which I want to integrate and then plot. The function is a complicated one and getting an error SystemException["MemoryAllocationFailure"]. Can any one fix this? The code ...
3
votes
1
answer
285
views
Speed up a Table involving Integrate, then ListDensityPlot
Actually I don't know what is the problem, but the program doesn't give me a result. The last time I ran the program, it has been counting for 5 hours. Maybe I should give the program more time to end....
2
votes
1
answer
282
views
Nested NIntegrate Iterations
I'm working on finding the limit of a function that involves nested integration.
I've written the code, and it's running an iterative procedure.
However, each iteration currently takes about 24 hours ...
0
votes
0
answers
101
views
How to monitor intermediate values of `NIntegrate`?
I know several examples Monitor, EvaluationMonitor and IntegrationMonitor but cannot ...
0
votes
1
answer
258
views
How to avoid singularity during integration? [closed]
I applied the recommendations from my previous question, the calculation time was reduced. Thank you very much!
Now I have a question regarding the calculation of some matrix elements, for example <...
4
votes
3
answers
289
views
Plottting a Table of InterpolatingFunction's over distinct ranges
I have a Table of interpolated functions that are generated as parametric solutions via NDSolve. I want to plot all of them, but ...
1
vote
0
answers
140
views
Possible ways to increase the speed of integral calculations
The code below is used to calculate the matrix elements He. However, the calculation of each element takes a very long time.
Question: How can the speed of these ...
2
votes
1
answer
352
views
How can I be sure NIntegrate does not jump across a branch cut in this case?
I'm working with numerical integrations of multi-valued functions which have integration limits at a branch cut and I don't want the integration "jumping" the branch cut into the next branch ...
3
votes
2
answers
300
views
Solution to a two-dimensional integration equation
I was hoping to solve a two dimensional integration equation, which is actually a simplified Schrodinger equation in momentum space:
$$ (x^2-3)f(x,y)-\int_0^\infty du\int_0^{\pi}dv\frac{u^2\sin{v}f(...