Questions tagged [numerical-integration]

Questions on the use of numerical functions NIntegrate and NDSolve.

Filter by
Sorted by
Tagged with
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: ...
6 votes
1 answer
246 views

Fractional PDE with CaputoD

I'm trying to solve this fractional PDE ...
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 ...
0 votes
1 answer
722 views

Reap and Sow From NDSolve solution

I want to get the answer of my NDSolve in the form of table (the value of each x and y). Let'...
8 votes
1 answer
1k views

Using external variable as a variable inside WhenEvent & NDSolve

I'm trying to use the new WhenEvent functionality of NDSolve in Mathematica 9, in order to perform an action when a variable in the system reaches a certain value. I would like this variable to come ...
3 votes
1 answer
335 views

Numerical solution of singular non-linear integral equation

I want to extend this collocation method based mathematica scheme to solve following non-linear integral equation (Cauchy/Carleman type): $$B(v)/(1-v) \int_{0}^{1} \mathrm{d}x B(x) (1-x)/(v-x) = 1 $$ ...
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 ...
0 votes
3 answers
156 views

Convergence and efficiency of 5-dimensional numerical integral using “GlobalAdaptive”

We have a 5-dimensional integral arising as a solution to a physics problem, where two dimensions of the integration space cover the spherical and azimuthal angle, and three dimensions are needed to ...
1 vote
1 answer
128 views

How to numerically integrate the time of two oscillatory functions from NDEigensystem

I am trying to numerically integrate phi*psi. And no matter which method I chose, the NIntegrate failed. ...
2 votes
1 answer
177 views

Looking for an appropriate method of NDSolve for dynamical system

I am dealing with the numerical solutions of a variety of dynamical systems with integrals of motion. As the example, let me consider the Kuramoto model, which equations of motion are ...
0 votes
1 answer
226 views

Principal value of a double integral numerically

I have several integrals of the form : where and . where a,b,wc and T are constants and PV denotes the Cauchy principal value I tried to integrate one of this form using NIntegrate however when ...
0 votes
2 answers
236 views

How to write more simple variable-step Runge Kutta algorithm to solve this differential equation?

Here is a case of Runge Kutta algorithm with variable-step size: ...
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: ...
6 votes
3 answers
2k views

How to integrate a Bézier function?

I have: points = {{0, 100}, {250, 0}, {0, 300}, {500, 500}} And I want to know the area below the curve, so I came to: ...
0 votes
1 answer
117 views

How to obtain the convolution of these functions?

I am starting to use Mathematica. I wanted to compute $$\nabla F*\phi(x),\;x\in\mathbb{R^2}$$ where $F(x)=\ln\|x\|$ and $\phi(x)=\chi_{B(0,2)}(x)$. I am a new user of this software, so I don't know ...
13 votes
2 answers
2k views

How can I use fast Fourier transform (FFT) to solve a PDE (heat equation)?

I'm trying to solve a one-dimensional heat equation (PDE) with the Fourier transform numerically, in the way it was done here. The equation: , is subject to the initial condition: , where U(x,t) is ...
0 votes
3 answers
2k views

Plotting multivariable integration

If I have a multivariable integration like NIntegrate[x^2 + y^2, {x, 1, 5}, {y, 6, 10}] But I need to plot its result in terms of ...
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
1 answer
116 views

The Range of a Function

I would like to see minimum and maximum for this example! g[x_]:=(3 a - 2)/((2 + 3 b - 3 a) x^2) + f*x^(-3 a + 3 b + 2) also for those parameters "1 < a &...
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 ...
1 vote
1 answer
232 views

Evaluate 3D- and 5D-constrained integrals for absolute separability probabilities

In a recent posting, TwoQubits user JimB, employing a change-of-transformations put forth by N. Tessore, was able to confirm a formula for the "two-qubit absolute separability Hilbert-Schmidt ...
4 votes
4 answers
2k views

Find arc length

I am trying to find the arc length for using ...
8 votes
2 answers
714 views

Numerical solution to a nonlinear Ordinary Differential Equation

I am trying to solve the following ODE for $f(x)$: $$x f' - f = \frac{(f')^2}{\gamma^2}[1-({f}')^\gamma]^2$$ where $\gamma < 0$ and real, which makes the ODE highly nonlinear. Since I am not ...
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. ...
6 votes
1 answer
445 views

Maxwell construction problem with FindRoot

A Maxwell construction is just an integral of area and then solving for a root to find vapor pressure. This must be exactly the same value as where the Gibbs energy plot crosses at a point. I found ...
0 votes
3 answers
174 views

Integrate and NIntegrate give different results

Good morning, i computed the following integral using Integrate and i get a different result from the one obtained with NIntegrate. Here is the integrand ...
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)$$ ...
0 votes
1 answer
90 views

Numerical integration precision issue

...
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)....
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 ...
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 ...
-3 votes
1 answer
86 views

Double NIntegrate

The functions I have are ...
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. ...
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: ...
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): ...
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$) <...
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 ...
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{...
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 ...
16 votes
4 answers
3k views

Plot MATLAB icon

I started to explore this on a whim and haven't succeeded yet… Some introduction for the icon is found here and here, but I can't understand it very well. (I admit that, though playing with ...
3 votes
3 answers
301 views

Evaluating the error function by integrating $ \mathrm e^{−t^2} $ with Simpson's rule

I am trying to evaluate an error function with Simpson's rule because there is no other way to integrate it. The function is $$ {\rm erf}(x) = \frac{2}{\sqrt π}\int_0^x \mathrm e^{−t^2}\, \mathrm dt ...
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 (...

1
2 3 4 5
63