Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

3
votes
2answers
884 views

How to avoid this kind of numerical error caused by extreme parameters when using NDSolve?

Here I use a one-dimensional heat conduction equation as the example. I found that when the thermal diffusion coefficient is small enough, Mathematica will give a result against the second law of ...
3
votes
2answers
344 views

Integration and Fourier transform

I would like to calculate the distribution function from the characteristic function. There is a formula given as $$F_X(x)=\frac{1}{2}+\frac{1}{2\pi}\int_{0}^\infty \frac{e^{i w x}\phi(-w)-e^{-i w x}...
3
votes
1answer
197 views

Numerically integrate a plotted function

I used Plot[NIntegrate[...]...] to plot a function of 5 different variables. It took really long. Right now I need to integrate this function one more time over the ...
3
votes
2answers
151 views

Help with Integration

I am new to Mathematica, and I need help with integration of the following Reliability expression (from a well-known Reliability Model). $$R(t)=e^{-Ne^{-bt_i}(1-e^{-bt})}, t \geq 0$$ I have ...
3
votes
3answers
399 views
3
votes
2answers
168 views

Integrate and NIntegrate not the same

Why am I getting two different results here? ...
3
votes
4answers
441 views
3
votes
2answers
346 views

NIntegrate piecewise vector function

Is there a way to numerically integrate a vector function defined via Piecewise? Example: ...
3
votes
2answers
689 views

Speed of convergence for NIntegrate

I'm trying to optimise numerically a function that entails computing the expected value of a truncated trivariate normal distribution and this is taking extremely long -I also get warned about ...
3
votes
3answers
1k views

How to integrate a function over a 3D planar polygon?

I am trying to integrate a function over a planar polygon in 3D. In 2D, this is fairly straightforward, using either answer from this question (I use the second answer). If we use an equilateral ...
3
votes
2answers
131 views

Reaction-diffusion PDE with NDSolve: either very slow or very inaccurate

I am struggling to have Mathematica 10.3 solve a system of PDE's (with periodic boundary conditions and random initial conditions), but either it produces a set of very noisy InterpolatingFunction ...
3
votes
4answers
269 views

NIntegrate Trapezoid rule with even subdivision producing poor results

NIntegrate[x^2, {x, 5, 9}, Method -> {"TrapezoidalRule", "Points" -> 2, "RombergQuadrature" -> False}, MaxRecursion -> 1] returns the ...
3
votes
1answer
572 views

Solving the Sine Gordon PDE in mathematica

how can i solve this equation in mathematica? this is sine-gordon eq. but the boundary condition can not recognized by mathematica . thank you for you attention. ...
3
votes
2answers
171 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 ...
3
votes
2answers
125 views

How should I tweak the options in NIntegrate?

I'm trying to obtain an accurate result from a difficult-to-integrate function and I've thrown in the kitchen sink worth of options in NIntegrate. I think I'm ...
3
votes
3answers
308 views

NIntegrate-ing a compiled function

I'm trying to integrate numerically in 6 dimensions a very long expression and I read about the option to NIntegrate a compiled function which should be faster. ...
3
votes
2answers
241 views

NIntegrate and Integrate giving different results for ill-behaved function

I'm trying to integrate the following function with Mathematica 8: $$ I(a,b)= \int_0^1 \mathrm{d}x\int_0^1\mathrm{d}y \,\theta(1-x-y) \frac{1}{x a^2-y(1-y)b^2},$$ where $\theta$ is the Heaviside ...
3
votes
1answer
313 views

What method does NIntegrate use by default?

There is a variety of algorithms for performing numerical integration (See wiki). What method does NIntegrate use by default? I looked at the documentation page ...
3
votes
1answer
354 views

Convergence in NIntegrate vs Integrate

I am faced with this situation that for a certain integration, $\int _0 ^\infty \frac { \tanh (\pi \sqrt{x} )} {\sqrt{x+10} } dx$ - the command Integrate returns ...
3
votes
1answer
1k views

Why this numerical integration takes so long?

Let me explain the problem. I am trying to integrate a one dimensional integral: $$\int {g\left( {{k_x}},parameter1,parameter2,...\right)d{\mkern 1mu} {k_x}} $$ for the sake of clarity, I will give ...
3
votes
1answer
938 views

Singular integral: NIntegrate fails to converge

I need to calculate the following singular integral: NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1}] However, it is failing to converge. I have tried to specify <...
3
votes
3answers
3k views

Retrieve values of InterpolatingFunction

While analyzing a large system of ODE's, I defined a particular ratio p, which contains some variables that are represented by ...
3
votes
2answers
142 views

Integrate on a contour in the complex plane

I want to integrate the function f[z]= z + Conjugate[z] over a circle of radius 2 centered at the origin. For the sake of stating something that I have tried: <...
3
votes
3answers
64 views

Replace variable with value prior to evaluating NIntegrate

The title says it all. Reading posts such as this however, I'm not seeing how to do this. This is the simplest example that can show my problem. ...
3
votes
2answers
889 views

What is the proper way to operate on interpolating functions?

I am trying to multiply an interpolating function by -1. If I do this Mathematica does not seem to allow any further operations. Bear with me while I generate the Interpolating Function in question. ...
3
votes
2answers
1k views

Area or NIntegrate curves defined by points?

Is there a convenient method to compute the AUC (Area Under the Curve) metric that quantifies a Receiver Operating Characteristic (ROC) like shown here? The data used to build the ROC are just ...
3
votes
1answer
459 views

Could the PrecisionGoal for NDSolve be a negative number?

The help of Mathematica doesn't say so much about the PrecisionGoal for NDSolve, and I never considered much about it even after ...
3
votes
1answer
717 views

NDSolve Problem

I am trying to solve a chemical equilibrium ODE with NDSolve where one function is the argument to another. I.E. My equations look like: ...
3
votes
2answers
982 views

Compute integral symbolically or numerically

I want to compute the integral of the following integrand ...
3
votes
2answers
110 views

Switching Differential Equation in NDSolve

I am trying to solve the following system of differential equations using NDSolve: $\dot{z}_t=.5(1-z_t)$ $\dot{y}_t=.05y_t+z_t-x_t$ subject to the following constraint: $-y_t-z_t\le0$ where $z_t$ ...
3
votes
1answer
51 views

My NIntegrate expression returns a wildly inaccurate value

I am trying to integrate a function using NIntegrate: ...
3
votes
2answers
2k views

How does one specify Neumann conditions for NDSolve?

I have a series of functions defined in my notebook, and then want to use this to solve a diffusion-reaction type equation. At the moment, something like this works: ...
3
votes
2answers
1k views

Problem with setting working precision in NIntegrate

I want to obtain a good numerical approximation (up to 10 decimal place would be ok for me) to an integral: $$ \int^{\infty}_{0} f(r)r^2dr $$ I am using the function $f(r)$, which is related to the ...
3
votes
1answer
609 views

Solving an ODE numerically

I really appreciate it if anyone helps me with this: How can I solve this ODE and plot the answer for $x$ on $[0.6,5]$: $$ \begin{align*} -2xy'[x] = y''[x]+ 47.21 (-.0025 x^6 & + ...
3
votes
1answer
56 views

How to index multi-dimensional vectors in NDSolve/WhenEvent?

I want to solve a system of coupled ODEs using NDSolve with WhenEvent. But I'm having a hard time trying to index the state ...
3
votes
1answer
102 views

Understanding difference between `NIntegrate` result and home-cooked Simpson's rule

In this question I am asking about the different results I get between NIntegrate-ing a function of two variables vs. "doing it myself" with my own implementation ...
3
votes
2answers
112 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. ...
3
votes
2answers
175 views

More issues Integrate, NIntegrate, FindRoot

I'm trying to solve a system of 3 non-linear equations using FindRoot and Integrate. If I start FindRoot[] close to the right answer, it works well but returns a bunch of error messages first. ...
3
votes
1answer
237 views

Precision of NIntegrate

At the moment I am considering a "difficult", highly-oscillatory integral in Mathematica. It calculates the integral without any complaints. However, I am also trying out a numerical method with which ...
3
votes
1answer
327 views

2-Dimensional NFourierTransform

Mathematica FourierSeries package contains the NFourierTransform function for calculating 1-D Fourier integral numerically. ...
3
votes
1answer
148 views

Calculate the relationship between the duration of two oscillating functions

I am trying to quantitatively determine the relationship between the length of two oscillating functions. Meaning, what is the duration of the green spike in relation to the blue square? Does anyone ...
3
votes
1answer
468 views

A Bessel & Struve functions related integral

I try to numerically compute this integral and I don't figure out why on earth Mathematica is not able to do it. Is my input correct? Does it possibly have a closed form? ...
3
votes
1answer
913 views

Problem with NIntegrate in NonlinearModelFit

We are receiving many error messages when using NIntegrate with NonlinearModelFit. Here is a much-simplified version of the code. It arrives at the correct answer after several messages saying that it ...
3
votes
1answer
667 views

Integrating over data points from an external source (wolfram|alpha and weather)

I moved to another city and the weather sucks. Sometimes I feel like getting sad and so I go to wolfram|alpha and check for example ${}$ http://www.wolframalpha.com/input/?i=weather+in+Rome+vs.+...
3
votes
1answer
56 views

Performance of numerical integral over piecewise function

Using mathematica version 10.3, I observe that an integral over a piecewise function evaluates a factor 10 slower than the same integral without the piecewise distinction. Here is the code: ...
3
votes
1answer
75 views

Split Boundary Value Problems win Algebraic Equations

Is it possible at all to solve with NDSolve (or other built in function) a split boundary value problem with algebraic equations? Please look at the following example: ...
3
votes
2answers
356 views

Error control for NDSolve

I have a problem controlling the numerical error associated with the following non-linear ODE : ...
3
votes
1answer
644 views

Numerical integration's speed

Consider this numerical integration of Bessel function: Do[NIntegrate[BesselJ[2, x], {x, 0, 10000}], {i, 1, 100}] // AbsoluteTiming {4.033403, Null} This is ...
3
votes
1answer
216 views

Evaluate function defined by DifferentialRoot

I have the following sequence of rationals that I want to find the generating function of: ...
3
votes
1answer
101 views

NIntegrate on tetrahedron

I've been trying to numerically calculate an integral in a tetrahedron of a discretized domain. In some cases when I specify a method I've been getting the error message NIntegrate::femonly <...