Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

6
votes
3answers
196 views

Certain integral over torus

Let $F(t_1,s_1,t_2,s_2)=$ $$\big((2+\cos t_1)\cos s_1 - (2+\cos t_2)\cos s_2\big)^2 + \big((2+\cos t_1)\sin s_1-(2+\cos t_2)\sin s_2\big)^2 + (\sin t_1 -\sin t_2 )^2.$$ I am interested in computing ...
1
vote
1answer
168 views

How do I plot this 3-D, double integral?

I have the following function: I need to plot a 3-D with coordinates f (p, q), p and q. I mean, I enter values for p and q, so that the integral of f (p, q) must be a number. This number must be ...
11
votes
1answer
273 views

How can I use Mathematica to numerically compute a Wigner spectrogram of an optical pulse?

This question was inspired by this question where it is necessary to numerically compute the Fourier transform of a Gaussian optical pulse with a Gaussian chirp function. $$E(t)=e^{-t^2} \cos(50 t - ...
0
votes
1answer
135 views

NDSolve breaking down

I'm trying to model a situation involving charged sphere in a dynamic electric potential, and find out how the rotational motion of the sphere affects the translational dynamics in two dimensions. ...
3
votes
1answer
70 views

Numerical integration with parameter and plot

I'm working on this function: (0.0027 Sin[phi])/(1.05*Exp[-241w]+ Exp[239w]-Cos[phi]) I'd want NIntegrate this function on ...
3
votes
1answer
59 views

How can I plot points generated by a Verlet Integration?

So, I have this code for Verlet Integration: ...
2
votes
0answers
53 views

Discretised numerical solution to a non-linear non-local equation

I understand that to do something even slightly non-trivial in Mathematica, I need to read some materials; the problem is that there are (too) many materials and only one particular problem, and I ...
3
votes
2answers
195 views

Error in NIntegrate command

I am trying to evaluate (numerically) the integral $$\int_0^1\int_0^1\int_0^1\int_0^1\int_0^1\int_0^1\frac{dx\,dy\,dz\,ds\,dt\,du}{(x - s)^2 + (y - t)^2 + (z - u)^2}$$ with Mathematica using the ...
6
votes
2answers
261 views

Solving the path of Earth around Sun

This maybe isn't a universally helpful question. Maybe a little of a code dump. But here goes. I'm trying to solve the path Earth moves around Sun from Earths mass, Suns mass, Earths initial velocity ...
1
vote
1answer
78 views

Nonlinear 2nd order ODE with regular singularities

I am tring to solve the following ODE with NDsolve $2x~(1-x)~f''(x)+(3-4x)~f'(x)+a~f(x)+b~f^n(x)=0;~~a,b\in\mathbb{R},~n\in\mathbb{N}$. The mathematica "code" is: ...
1
vote
1answer
387 views

Numerical solution of Schrödinger equation

I want to solve the following differential equation numerically. The geometry of the problem is as shown below. Electron 1 is located on the inner ring of radius $R_1$ and electron 2 is located on the ...
1
vote
1answer
51 views
16
votes
2answers
275 views

More efficient method to compute moments of the Johnson $S_B$ distribution

Here is a very specific feature request. I need Mean[JohnsonDistribution["SB", γ, δ, 0, 1]] When I issue e.g. ...
2
votes
0answers
133 views

How to solve an equation where the unknown variable is inside the integration [closed]

I have an equation: $$ \frac{1}{g}=\int_0^{\frac{1}{\delta}\sinh \frac{1}{g}} \frac{\tanh\left(0.882\, b\,\delta\sqrt{1+z^2}\right)}{\sqrt{1+z^2}}\mathrm{d}z $$ I want to obtain the relation ...
1
vote
1answer
82 views

Convergence in NIntegrate

I wish to understand how to cope with the following error messages: ...
0
votes
0answers
82 views

How to solve boundary value problem with singularities at boundaries?

I have a boundary value problem, solving a system of differential equations with a singular boundary condtion (V[0] = 1/s, s->0) ...
2
votes
0answers
61 views

NIntegrate over statistical variables with parameter

Essentially, what I am trying to do is the following: Integrate a function which contains the parameter k ...
0
votes
1answer
131 views

NIntegrate with variable limit of integration [duplicate]

Hey guys Im working with this integral and I can´t get it right. ...
-1
votes
1answer
286 views

Follow up: how to plot a function under NDSolve domain

Here is the details of the code to plot. ...
2
votes
0answers
109 views

integration of a list of gaussian type orbitals (GTO)

I am currently trying to integrate various components of a current density (j={jx,jy,jz}) over space. The problem is that the current j is extracted from a quantum chemical computation and is a sum of ...
0
votes
2answers
75 views

Fit a polynomial/curve to an NIntegrate result

I want to NIntegrate a function which also contains some parameter. In the end, I would like to plot the result as a function of one of these parameters. The thing ...
2
votes
2answers
229 views

Attempting to use NDSolve to plot harmonic oscillator solutions

NDSolve[{ (-y''[r]/1880) + (470 (0.04077)^2 r^2 - 48 + 1/(1880 r^2)) y[r] == 0, y[0] = 0, y'[0] = 0}, y, {r, -4, 4}] I use this but get errors and am ...
5
votes
1answer
128 views

A 1D numerical integral Mathematica cannot compute, from physics

A well know result in theoretical physics is that a sum over Matsubara fermionic frequencies, i.e.: $$ S = \sum_{n=-\infty}^{\infty} h(\omega_n) \hspace{32pt} \omega_n=(2n+1)\frac{\pi}{\beta} $$ can ...
1
vote
2answers
128 views

Trapezoid Integration over a list of pairs [duplicate]

I have two very connected questions: Is there really no built-in function to integrate a list of pairs without converting to a function? Something like: ...
0
votes
2answers
181 views

Solving non-linear differential equation

For my research project I need to solve the following integral ...
1
vote
1answer
98 views

Problem with NIntegrate and FindFit [closed]

I fit the experimental curve with the model using the following equation, ...
1
vote
0answers
48 views

Problem with curve fit using integral [closed]

I need fitting a Langevin function on a experimental data, but one parameter must be firstly optimized by using a Lognormal distribution. The complete expression could be written as: The integrate ...
7
votes
2answers
226 views

How to locate the position of a periodic orbit

These are the equations of the dynamical system ...
1
vote
2answers
107 views

Can't NIntegrate my NDSolve results

I want to NIntegrate my NDSolve result. I don't have a exact function form because it is coming from the ...
2
votes
1answer
58 views

WhenEvent stops working after first instance

I'm modelling a very simple physical situation is which an object is rested on two moving fingers. Sometimes the object moves with one finger while sliding over the other, while at other critical ...
0
votes
0answers
49 views

NIntegrate within NMinimize - how to optimize the code?

How I can optimize these numerical calculations? Most annoying is encountering instabilities (numerical errors). I have a predefined function: ...
3
votes
2answers
106 views

Numerical integration of oscillatory function

I am trying to evaluate the following oscillatory integration numerically but the answers are wrong or not accurate enough. I don't know what the problem is. ...
7
votes
2answers
257 views

NIntegrate fails to converge under almost any PrecisionGoal, MinRecursion etc. How can I trust the result?

I have been getting some ideas by reading other related questions in the forum, but the integral I have to do is not converging in many cases. The integrand is of the form: ...
2
votes
2answers
93 views

numerical integration of equation obtained by ParametricNDSolve

I am trying to find a definite integral of the solution obtained using ParametricNDSolve (i.e. y[x,a,b]) from 0 to 1 and plot ...
16
votes
1answer
1k views

Numerical integration — Mathematica vs Python (w/ Scipy) performance

I'm about to tackle a problem that involves a lot of (multi-dimensional) numerical integrations and also subsequent optimizations, and so I want to make sure at least the integration step is as fast ...
1
vote
0answers
59 views

Continuous integration of a tensor function using discrete density values

Hei, I am wondering is it possible to implement continuous integration using Integrate() of a fourth order tensor with discrete density values. ...
5
votes
4answers
245 views

error with NIntegrate and RegionPlot

Bug introduced in 10.2 or earlier and persisting through 10.2 or later Here's a simplified example of what I'm trying to do: ...
3
votes
1answer
202 views

Backward in time numerical integration with fixed time step

Consider simple use of NDSolve[] function used to solve an ODE backward in time ...
5
votes
3answers
126 views

Differentiate a numerically defined function

My function is f[a_, b_] := NIntegrate[Sqrt[(Cos[t] - a)^2 + b^2], {t, 0, Pi}] I want to calculate g[1,1] where ...
1
vote
1answer
55 views

NIntegrate option for FourierSeries

I would like to use FourierSeries but it is very slow. My guess is that it is because it uses symbolic integration: ...
1
vote
2answers
138 views

How to determine the parameter in a differential equation with some fixed solution

Assuming that I have a ODE system with undetermined parameter $$x''(t) == y(t) x(t)$$ $$y'(t) == 2 - a x(t)$$ and I have some fixed solution condition $$x(0)=0$$ $$x(10)=8$$ $$y(10)=3.5$$ Is there ...
1
vote
2answers
174 views

How do I exclude regions from numeric integration on Mathematica?

The part of the equation that is giving me trouble is below: f[t_,v_]:= Exp[-(1/Log[1-t/v]^2)]*(v-t) I need to integrate this function over the ranges .1 ...
3
votes
0answers
124 views

NSolve doesn't work on an equation containing a numerical integral and constraints

I'm having trouble getting Mathematica to solve equations numerically. I know that its important to specify the type of variables for pattern testing (see e.g. here) but this doesn't seem to work. ...
5
votes
2answers
159 views

Why am I getting different answers for an integral depending on method?

I'm trying to carry out an integral and I'm finding different answers depending on which method I choose to integrate with. I assume this has something to do with divergent pieces but I don't ...
3
votes
2answers
160 views

Maximizing a function defined using NIntegrate [duplicate]

I have two functions fn[x,y,z] which is in integral form and I have another function gn[x,y] which is also in integral form ...
7
votes
2answers
236 views

How to do multi-dimensional principal value integration?

The toy model is: $$\int_{-2}^{2}\int_{-2}^{2}\frac{1}{1-(x^2+y^2)}\, dx\, dy$$ The integrand have opposite sign across the circle $x^2+y^2=1$, so one would expect that the integral has meaning only ...
10
votes
1answer
95 views

How to speed up the evaluation of a function with a large LeafCount but many repeated sub-functions for use in NIntegrate

General Context Apparently, the memory leak in NIntegrate is unavoidable pre-MMA-10.2. I have some (two-dimensional) numerical integration to do on a complicated ...
2
votes
1answer
99 views

Three Dimensional Plot of Numerical Integral with Delta Function

I want to plot the definite integral of the following function ...
0
votes
1answer
82 views

Integrate works but NIntegrate doesn't

I have a complicated integral function that I'm trying to evaluate, which will have to be done numerically. I wanted to try a simpler one first, one that has an analytic form, because I could check ...
4
votes
2answers
203 views

How to speed up a high dimensional numerical integration of Gaussian-form integrand [duplicate]

My integral has the following form: $$\int \sin(\theta) d\theta d\phi\left| \int d^3p_1 d^3p_2d^3p_3 \frac{f(p,\theta,\phi)}{g(p,\theta,\phi)}e^{-\frac{1}{2}(p^\mathrm{T} .A.p)}\right |^2,$$ where ...