Questions tagged [numerical-integration]
Questions on the use of numerical functions NIntegrate and NDSolve.
3,140
questions
0
votes
0
answers
32
views
NIntegrate failed to converge to prescribed accuracy for integral contain Bessel function of first kind
I am new in Mathematica, I try to find the following numerical integral.
but I get the error message ( NIntegrate failed to converge to prescribed accuracy ...), I know that there is a divergence ...
1
vote
1
answer
36
views
NIntegrate::nlim: * is not a valid limit of integration
The following numerical integral within a numerical integral:
...
1
vote
0
answers
50
views
Why this integral is calculated incorrectly?
Input:
Integrate[1/y - Floor[1/y], {y, 0, 1}]
N[Integrate[1/y - Floor[1/y], {y, 0, 1}]]
Output:
Integrate[1/y - Floor[1/y], {y, 0, 1}]
0.418638
The above code is ...
-3
votes
0
answers
77
views
Mathematica vs other languages such as C or Python [closed]
I need your valuable opinion on a very controversial question regarding Mathematica versus other languages, in particular C or C++. For computation, analytical or numerical in physics or other areas, ...
1
vote
0
answers
27
views
NDSolve error in Functional Delay Diff Eq
I'm trying to use Mathematica to study an equation that has an unusual dependence on past states, i.e. some kind of a Delay Diff Eq. For the sake of this post, we can say that the equation I would ...
10
votes
1
answer
626
views
Mathematica or math question: why my own Monte Carlo gives different result from the Mathematica's one?
Consider some function of arguments x,y,z, where the latter have some domain of definition $\mathcal{R}$:
...
1
vote
0
answers
28
views
Multi-NIntegral with a compiled function: Why not improved so much?
I want to compute the multi-dimensional integral by using NIntegral with the compiled function.
I have compiled an integrand function.
It made the computation time of the integrand about 100 times ...
3
votes
2
answers
163
views
Need help to speed up the Gaussian quadrature
I am trying to compute the $L_2$-norm of the solution $y(z,t)$ of a PDE with Gauss quadrature using the following code, where $z$ is space position and $t$ is time, then to construct it as a function ...
6
votes
1
answer
246
views
Fractional PDE with CaputoD
I'm trying to solve this fractional PDE
...
0
votes
0
answers
32
views
Memory Allocation Error with Principal Value Integral
I'm getting a SystemException["MemoryAllocationFailure"] error with some arguments to S[x] in the following ...
0
votes
1
answer
71
views
Numerical solution of differential equation with DiracDelta fit boundary condition at zero poorly
I need to solve: $x^2y''(x)+(2x+1)y'(x)-x^2\omega^2y(x)=\frac{-\omega^2\delta(x-x_0)}{4\pi},x\in[0,\infty)$ with boundary conditions:$y(0)=1,\ y(\infty)=0$ , $\omega$ is a function of this form: ...
1
vote
0
answers
53
views
How to improve the integration accuracy without significant reduction in the speed?
Consider some distribution:
...
1
vote
0
answers
32
views
Discrepancies in NDSolve Solution Between 4D and its Reduced 3D Counterpart
I have two systems, a 4D system and a 3D system. The 3D system is a reduction of the 4D system in such a way that:
...
0
votes
0
answers
85
views
Why the output curve is not smooth?
tmr is the output funciton which is a complex integral, and afa is the variable. If gama is a real number, for example, gama=-410^(-29)(1 - Cos[6afa]), A2 and A3 can be infinity, and there will ...
0
votes
0
answers
52
views
How to create and plot a function involving NIntegrate
I am interested in understanding the growth of the following function for $n\geq 2$
$$I(n) = \int_{0}^{1/2}\frac{ds}{s^{1-1/n}+(1-s)^{1-1/n}-1}.$$
I can explicitly compute $I(n)$ for various values of ...
4
votes
1
answer
78
views
NDSolve for Fluid Flow - Monitor Residuals
I'm using NDSolve for fluid flow and would like to monitor the convergence of the solution more closely. I have a simple stationary case set up. NDSolve should return the solutions for u,v and p. ...
3
votes
1
answer
70
views
Problem with parametric integral with variable bounds
d[p_, B_] := \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(-B\), \(+B\)]\(Cos[
p\ x] \[DifferentialD]x\)\)
Plot[d[x, 2], {x, -10, 10}, PlotRange -> Full]
I ...
4
votes
1
answer
103
views
Trouble plotting particle geodesic trajectory on wormhole embedding
I'm having tremendous trouble plotting geodesic trajectories on wormhole embedding. I'm attaching the article from which I am trying to re-create the trajectories (https://arxiv.org/pdf/1404.7210.pdf)....
9
votes
1
answer
182
views
Crank-Nicolson solver for heat equation
My ultimate goal is to solve the 1D radial diffusion equation
$$\frac{\partial u(t,x)}{\partial x}=x^2\frac{\partial}{\partial x} \left(\frac{D(t)}{x^2} \frac{\partial u(t,x)}{\partial x } \right)$$ ...
2
votes
0
answers
71
views
Attempt to code an Integro-Differential Equation Solver
I'm interested in constructing a code that is able to numerically integrate a function at discrete points in order to implement into a numerical solver for a set of Integro-Differential Equation. In ...
2
votes
1
answer
40
views
Multiple Integration of a function defined for a list of arguments [closed]
I want to calculate, by Mathematica, the following integral of a function defined with a list of arguments.
$$\int_1^2\int_1^2\int_1^2 (x+y+z)^4 \, dx\, dy \, dz$$
as follows:
...
0
votes
0
answers
48
views
Numerical integration of iterated integral with piecewise integrand
I need to plot the following integral:
$$
\Omega(t)=\int^{x_1(t)}_0 {4\pi x_i^2\rho(x_i,t=t_s)\int^\infty_04\pi x^2\rho_{reg}(x_i,x,t)dx}dx_i
$$
where
$$
\rho(x_i,t)=
\left\{
\begin{...
1
vote
1
answer
107
views
Trouble evaluating an expression [closed]
I am currently trying to numerically evaluate an expression which is the following. The expression IntD0 is being plotted, but the next line is not. I thought it ...
5
votes
1
answer
130
views
Wrong derivative in delay differential equation initial data returned by NDSolve
I have an DDE:
sol = NDSolve[{x'[t] + x[t - 1] == 0, x[t /; t <= 0] == t^2}, x, {t, -1, 5}]
And result (take the curve on the time interval $-1<t<0$)
<...
3
votes
3
answers
130
views
Iterative pde solution NDSolve && NIntegrate
I try to solve a diffusion pde depending on a timedependent argument.
Step by step I have no problem to evaluate several solutions:
first step (timefunction 0):
...
1
vote
2
answers
165
views
the Bessel function Integration
I try to calculate the integral of the Bessel function in Matlab
syms a r b k
L=int(log(r) * (besselj(0,a * r)+b * bessely(0,a * r)),k,1)
but I have this error (...
0
votes
1
answer
53
views
How to improve the accuracy of integration with Bessel function without significant drop in performance?
Consider the following function and integral:
...
0
votes
1
answer
156
views
How to make this kind of integration with the trigonometric function?
I am trying to make the following integration. But I am not sure about the result obtained as follows.
Is there some way to get more reliable and accurate results?
Thanks.
...
1
vote
1
answer
94
views
Why are the results different when I integrate an expression in different ways?
When I integrate the expression like,
...
0
votes
0
answers
42
views
Difference in the output of NIntegrate versus Integrate
I have an expression which when integrated, should be a cumulative distribution function (CDF). I have integrated the expression using both NIntegrate[] and Integrate[]. When the CDF returned by ...
3
votes
1
answer
110
views
Solve PDE with consraints
I am trying to solve the following problem of the free fall dynamics under gravity of a inextensible horizontal string attached at its end, in a 2D vertical plane. If I'm right, that is the governing ...
8
votes
2
answers
242
views
What is an appropriate setting in NDSolve to get feedback about the progress of a long computation?
Often in computation with an NDSolve-type solver, one hopes to know about its progress.
To this end, I am using StepMonitor as follows,
...
1
vote
1
answer
88
views
Catastrophic loss of precision calculating Fox-H integral
I'm trying to numerically calculate the following Fox-H integral
$$
1-e^{-100}\sqrt{\frac{x}{\pi}} \left(\frac{1}{2\pi j}\right)^2\\ \oint_{\mathcal{L}_1}\oint_{\mathcal{L}_2} \frac{\Gamma(z_1)\Gamma(...
0
votes
0
answers
67
views
Implementing the 3D Radon transform
I am wondering how to implement the Radon transform, the 3D Radon transform, that is, given a 'density' function $f: \mathbb{R}^3\to \mathbb{R}$ The Radon transform of $f$ is $$Rf(s,w)= \int_{x\cdot w=...
3
votes
1
answer
158
views
Matrix Integro-differential equation
I'm trying to solve this integro-differential equation to obtain the density matrix elements $\rho$.
$
\frac{d\rho}{dt}=-i[H_{0}(t),\rho(t)]-A^{2}\Big[H_{1},\int_{t1}^{t}e^{-B(t-s)}\Big(e^{-i\int_{s}^{...
2
votes
0
answers
148
views
Problem with a DAE and DiscreteVariables (II)
I continue with a DAE problem similar to another one posted here some days ago. @bbgodfrey offered a solution for the DiscreteVariables problem but now I have a ...
1
vote
2
answers
105
views
Solution on nonlinear pde with intial condtion
It produces an error. please suggest an alternative solution to the above-coupled pde problem.
...
1
vote
1
answer
87
views
Solving system of equations including numerical integrals over region
I am dealing with the resolution of a concrete beam. Simply put, it is an equilibrium of horizontal forces and moments.
Let's first define some parameters :
...
1
vote
1
answer
48
views
How to solve the error information in numerical integration and solve Sp?
How to solve the error information in numerical integration and solve Sp?
The codes are as follows:
...
2
votes
3
answers
111
views
Infinite Integral involving a Bessel function
I have trouble evaluating the following numerical integral,
$$
\int_{0}^{\infty} d k^{(yz)} \, k^{(yz)} J_{0} \left(d^{(yz)} k^{(yz)} \right) \frac{e^{-i d_x \sqrt{k_R^2 + {k^{(yz)}}^{2} }}}{ \sqrt{...
0
votes
2
answers
173
views
Why this integral gives zero?
I would like to compute this integral for a =100, ... ,1500
$$ \int_1^\infty \dfrac{\left(x^2-1\right)^{3/2}}{x} \,e^{-ax}\, dx $$
...
2
votes
1
answer
115
views
Solving this system of differential equation with NDSolve
I'm trying to solve this system of differential equation (the ones in yellow markers are just constants):
The initial conditions for this system are n(0) = NN, na(0) = Na, n'(0) = q(0) = 0, q'(0) = ...
0
votes
0
answers
39
views
Analytical integral running slow
I am calculating an integral with Mathematica, but it is running super slow!
Do you think there is a way to speed up the computation of A3? Maybe I should define my functions in a different way, but I ...
0
votes
1
answer
82
views
Need help solving iterativelly a set of transcendental equations with NIntegrate
I have two sets of equations:
$q = \frac{1}{\sqrt{2 \pi}}\int dz~ e^{-z^2/2}F(q,\phi;z,\beta,\Delta, J) $
$\phi = \frac{1}{\sqrt{2 \pi}}\int dz~ e^{-z^2/2}G(q,\phi;z,\beta, \Delta, J) $
As you may see ...
3
votes
1
answer
51
views
Why does NDSolve[] want to treat my equations as Delay Differential Equations?
I use NDSolve command (method->equation simplification -> residual) to solve different sets of Ordinary differential equations (ODEs).
It had worked alright till I added rather a simple ...
0
votes
0
answers
78
views
8
votes
2
answers
224
views
Problem with a DAE and DiscreteVariables
Cross-posted in Wolfram Community.
I am solving an DAE problem with NDSolve. It is a physical problem related to friction forces: one mass on the X axis and ...
4
votes
1
answer
239
views
NIntegrate fails to converge to desired accuracy
I am calculating an integral with Mathematica. This is the code I am using:
...
1
vote
1
answer
103
views
How to make an integral and reproduce its graph
How by Mathematica we can make the integral, equation (101) in
arxiv:1307.5949
$
H_0(t-t_0) = \int^{\frac{a}{a_0}}_1 ~ \frac{da’}{\sqrt{ \frac{\Omega_r}{a’^2} + \frac{\Omega_m}{a’} + \Omega_\Lambda ...
1
vote
1
answer
117
views
Compute area enclosed in a curve on a surface
Let's consider a 2D smooth surface embedded in 3D shown in the figure below. The corresponding metric tensor in Cartesian coordinates is
\begin{equation}
h = \biggr(\matrix{1 + \frac{A^2\pi^2}{4} \sin^...