Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

2
votes
0answers
107 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
73 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
222 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
118 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
180 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
223 views

How to locate the position of a periodic orbit

These are the equations of the dynamical system ...
1
vote
2answers
96 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
57 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
241 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
92 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
58 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
232 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
182 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
119 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
52 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
166 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
122 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
155 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
151 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
221 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
94 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
92 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
191 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 ...
1
vote
0answers
61 views

Plotting roots for a singular numerically-only integrable equation [closed]

In my problem I need to plot roots with respect to a parameter. But the condition for root is det(Function)=0. This function cannot be solved symbolically. So I need to put in a parameter value and ...
2
votes
3answers
167 views

slwcon and eincr in integrating multivariate Gaussian random variables

Why is the following integration involving multivariate Gaussian distribution so slow and generating an error? Is there a better integration strategy? All that I'm doing is considering ...
0
votes
1answer
79 views
4
votes
2answers
251 views

Postprocessing of CFD results in Mathematica

I was trying to perform computational fluid dynamics (CFD) post-processing in Mathematica after solving primitive variables from Navier-Stokes equation, mainly $(u,v)$, $(Px,Py)$. Since I am not an ...
4
votes
3answers
547 views

Nonlinear differential equation: numerical solution

I have to find and plot a numerical solution for this second order differential equation: u''[x] + (u'[x]/x) - (u[x]/(x^2)) + u[x] - u[x]^3 = 0 where $0\leq x ...
0
votes
0answers
42 views

Evaluation stops, no error

I'm trying to iterate NIntegrate using Table so that I can plot the result as a function of an external angle. It's an oscillatory function so it gives some error on the estimate for the value, but ...
11
votes
1answer
445 views

Nintegrate has memory leak

Bug introduced in 6.0 and fixed in 10.2.0 NIntegrates uses memory and does not release it. For long loops with NIntegrate ...
0
votes
1answer
89 views

NIntegrate and memory use [duplicate]

I wonder why NIntegrate uses memory. I have a long integral computation repeated thousands times. The memory use then goes up and speed goes down. I think I spot a ...
2
votes
0answers
96 views

Nasty integral advice

I have a pretty ferocious integral to solve, and since it doesn't seem I'll be able to do much analytically, I've taken to Mathematica to get some information. Mainly, I want to see if there are any ...
4
votes
1answer
108 views

Does not evaluate the Integral and a plane plot

I am trying to compute a ContourPlot and a VectorPlot using the following functions: ...
-2
votes
1answer
107 views

Plot the result of NIntegrate for different parameter values

I want to plot the result of a numerical integration containing a parameter in terms of the parameter. The code is: ...
0
votes
0answers
56 views

Is there a IsDefinedQ function? [duplicate]

I have a function which is a bit expensive to calculate. I want to translate and integrate. I want to translate by values on a grid, store the values of the integral and refine the grid. That is, I ...
0
votes
0answers
64 views

What am I missing in this integration?

Trying to solve diff.eq.has led me to: ...
1
vote
0answers
229 views

NDSolve fixed step problem

Working example here: Drive folder (have both files in the same directory! Notice: the line <<variables' in the file seems to throw an error for me, but ...
0
votes
0answers
61 views

How to solve algebra equations containing integration and parameters?

I'm trying to solve two nonlinear algebra equations for two unknown parameters, U and Tf. Since some terms in these equations contain integration, and the integration also contains U and Tf. The main ...
1
vote
2answers
260 views

Plotting a parametric function containing an integral [closed]

I need to plot this expression $$ \phi(s; H,B)=\left(\int_{0}^{s}\frac{1+B\ \sin2H\ t}{\sqrt{1+B^2+2B\sin2H\ t}} \text{d} t,\ \frac{1}{2H}\sqrt{1+B^2+2B\sin2H\ s}\right)$$ for $H=0.5$, $B=0, 0.5, 1, ...
8
votes
1answer
204 views

SymplecticPartitionedRungeKutta shows strange error

Bug introduced in 9.0 or earlier and persisting through 10.2 or later I tried to solve Hamiltonian system ($Q$ is a vector of all generalized coordinates, $P$ - of generalized momentum) $$ ...
2
votes
0answers
43 views

NDSolve with NIntegrate [duplicate]

I'm new to Mathematica and I'm trying to use it to solve some equation like: NDSolve[x'[t]+NIntegrate[x[tau],{tau,0,t}]==20,x,{t,0,10}] But it keeps giving me ...
1
vote
1answer
63 views

Matrix issue with NDSolve

I am solving a differential matrix equation with NDSolve. ...