Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

12
votes
1answer
404 views

Mathematica9: NDSolve slows down after repeated calls

Bug introduced in 9.0 or earlier and persisting through 10.4.1 or later I have noted that in Mathematica 9 my code, which involves a lot of calls to NDSolve, ...
-1
votes
1answer
139 views

Why MMA is not able to solve this problem?

I am running these following code in Mathematica. But, MMA does not output anything. It is giving me an message as "The integrand .... has evaluated to non-numerical values for all sampling points in ...
-1
votes
1answer
183 views

Can Mathematica solve this integral numerically?

I need to evaluate numerically the following $$\int_0^{\infty}\exp\left(-\pi\lambda\mathbb{E}_H\left(\int_r^\infty\left(1-\exp\left(-sP_{\text{M}}Hr^{-1/\delta}\right)\right){\rm{d}}r\right)\right)2\...
4
votes
1answer
44 views

How to speed up NIntegrate when using an interpolating function output from NDEigensystem?

I have been working with NDEigensystem in order to find the resonant frequencies of different shaped drums. I would also like the coefficients of the different eigenfunctions so that each of these ...
24
votes
2answers
427 views

How to implement custom integration rules for use by NIntegrate?

How can NIntegrate be extended with custom implementation of integration rules? This answer of the question "Monte Carlo integration with random numbers generated ...
16
votes
1answer
1k views

I failed to solve a set of one-dimension fluid mechanics PDEs with NDSolve

The fluid here has been assumed as single component perfect gas i.e. it obeys the equation $p=ρ R T$, the thermal conductivity is assumed as a constant, so the equation set is: ...
0
votes
1answer
82 views
1
vote
1answer
50 views

Complex exponential integrand and NIntegrate

For some non-negative numbers $m_1$, $m_2$, $E$ I define a function $$ f\left(\boldsymbol{q},E\right)=\frac{1}{2\omega_{1}\omega_{2}}\frac{1}{\omega_{1}+\omega_{2}+E}+\frac{1}{4\omega_{1}\omega_{2}}\...
1
vote
1answer
60 views

ParametricPlot3D shows an empty box

I'm trying to visualize numerical solution of 4 differential equations (these are the coordinates of a wave function in a quantum mechanical system): ...
1
vote
1answer
220 views

Orthogonalizing polynomials with inner product depending on parameters

I need to orthogonalize the polynomials $h_n(x)=x^{2n}(1+x^2)^{-4S}$ with $x\in\textbf{R}$, $2S\in\textbf{N}$ and $n\in\{1,3,5,\ldots, 4S-1\}$ over the inner product $\langle h_n,h_m\rangle=32\pi S\...
0
votes
2answers
38 views

Convergence Problem in NIntegrate

I need to evaluate the following integral numerically for different values of a: ...
17
votes
1answer
162 views

How to implement custom NIntegrate integration strategies?

How can new integration strategies algorithms be used with NIntegrate? This is a different type of extension than the extensions with new integration rules, as ...
7
votes
1answer
82 views
2
votes
1answer
55 views

Problem using Nintegrate and NDsolve

I am going to use Nintegrate to integrate the result of NDsolve and also a Table. How I can ...
2
votes
3answers
110 views

How to integrate numerically the product of result of NDsolve? [closed]

I am going to integrate the product of the results of NDsolve, in fact If x and y are the results as interpolating function, How I can integrate x*y numerically? <...
2
votes
1answer
116 views

Numerical integration over a circle contour [duplicate]

I want to numerically integrate the following function $$f(p) = \frac{1}{2\pi i}\int_{\Gamma}\frac{1}{p}\exp\left(\frac{a^{2}}{2}\frac{1}{p}+\frac{b^{2}}{2}p\right)dp$$ where the contour $\Gamma$ ...
0
votes
1answer
203 views

How to pass arguments in NIntegrate and NDSolve

I am solving PDEs with NDSolve and NIntegrate, but I do not know how to pass arguments correctly. My orignial code is very ...
0
votes
2answers
114 views

Solving a set of nonlinear equations

I am trying to setup and solve a set of nonlinear equations. I keep getting an error. Here is my problem: ...
3
votes
2answers
473 views

NIntegrate giving message NIntegrate::slwcon:

I got this interesting answer from Mathematica when trying to integrate my function numerically: f[x_] := Sqrt[17*x^2 + x^4] NIntegrate[f[x], {x, -1, 2}] ...
0
votes
0answers
30 views

How to use a numerical integral as an input function

I am new to mathematica. I am trying to use a numerical indefinite integral as an input function of a module. I have a function $$r^* \equiv r^*(r)=\int_0^{1/r} B(z)dz$$ with $B(z)$ being a analytic ...
0
votes
1answer
63 views

Error message when running NDSolveValue

I am trying to solve a set of differential equations but keep getting an error. See message below "NDSolveValue::ndnum: Encountered non-numerical value for a derivative at t=0" The system that I ...
1
vote
2answers
120 views

Discontinuous boundary condition in NDSolve

Assume we have any PDE to be solved on the rectangular domain $0<X<4$ and $0<y<2$ How do we tell Mathematica to impose the following boundary conditions? $\cases{ U[0,y,t]=0,& if $0&...
1
vote
2answers
85 views

Stop Integration in NDSolve

The following code executes properly for some choices of initial points and parameter c, but fails for other choices. Could the failure be due to computation outside of the defined t, x, and y ranges? ...
7
votes
2answers
115 views

Bug in NDSolve/WhenEvent?

Bug introduced in v10. I'm fairly sure the following is a bug, and I would normally just report it to WRI. However, this is related to my answer to When using NDsolve, how to determine the ...
3
votes
3answers
212 views

When using NDsolve, how to determine the positions of steady states?

I am currently trying to numerically solve a set of ordinary differential equations of chemical kinetics. However, I want to implement perturbations only when system reach steady states. For example ...
5
votes
3answers
1k views

How to deal with zero in NDSolve in mathematica?

I would like to solve the following ODEs $$\begin{cases} x'(t)&=y\\ y'(t)&=-y(t)/t-e^{x(t)},\\ x(0)&=1,\\y(0)&=0, \end{cases}$$ (EDIT : The second equation used to be $y'(t) = -x(t)/...
1
vote
2answers
343 views

NDSolve giving the wrong solution?

I'm considering the non-linear second order ODE DE $=0$, with DE given by ...
1
vote
0answers
26 views

Numerical integration and interpolation with free parameters [closed]

I hope you'll be able to give me a hand on my question, I'm stuck and don't know how to make it work. First of all, I have a table of data pairs (x,f): ...
3
votes
1answer
305 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 ...
2
votes
0answers
29 views

Use of AccuracyGoal & MachinePrecision in NIntegrate

I just learned about the Inverse Symbolic Calculator and it seems like a very useful tool. For example, to find an analytic solution to $$ \int_0^{\infty } \frac{1-e^{-x} (x+1)}{\left(e^x-1\right) \...
3
votes
1answer
101 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 ...
0
votes
0answers
30 views

Difference between using NIntegrate and Integrate inside NDSolve?

The differential equation I am considering depends on an integral, which I would like to solve with NIntegrate (since it will gets more complicated and thus I have to use NIntegrate later). My code ...
15
votes
5answers
2k views

How to speed up the plot of NIntegrate?

Here is a toy example: f[t_] := NIntegrate[Sin[x], {x, 0, t}]; Plot[f[t], {t, 0, 10}] // Timing Even such a simple example will take 2.8 seconds on my computer. ...
0
votes
0answers
52 views

Double Integral with NDSolve!

I have fivefold multiple integral and I wanted a speed calculations.I came across on this Question and had already begun the problems. Here is a toy example with simple double integral: ...
11
votes
6answers
877 views

Integrate gives wrong results

Integrate[a/(Sin[t]^2 + a^2), {t, 0, 2 Pi}] $$\int_0^{2 \pi } \frac{a}{a^2+\sin ^2(t)} \, dt$$ gives $0$ This cannot be true. What is going on? If I insert a ...
1
vote
2answers
122 views

NIntegrate evaluates its 1st argument while it has the attribute HoldAll?

NIntegrate owns the attribute HoldAll: Attributes@NIntegrate (* {HoldAll, Protected} *) ...
1
vote
0answers
22 views

Launching specific remote kernels in parallel

For some reason I found that my numerical integration runs much faster on Mathematica 9 than on Mathematica 10. Since I sent my calculation to a cluster with 24 cores with the following command <...
1
vote
3answers
266 views

NIntegrate and Integrate of a Spherical Bessel function

I am trying to integrate a spherical Bessel function. I have used both the Integrate and NIntegrate functions in Mathematica but ...
11
votes
2answers
119 views

Why NIntegrate is badly-behaved on $J_{\frac{9}{2}}(x)$ by default?

A friend of mine showed me this example: Plot[BesselJ[9/2, x], {x, 0, 1}, PlotLabel -> Style["The integrand seems to be simple", 14]] ...
4
votes
1answer
522 views

How can I invoke the solution of NDSolve to determine a parameter in my equation just inside NDSlove?

I am trying to solve a differential equation by NDSlove for $h(x,t)$. It reads $$h_t=h_{xx}-V_h-\lambda(t)$$ where $V_h$ is a given function of $h(x,t)$ denoted by <...
3
votes
2answers
137 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: <...
0
votes
1answer
83 views

Definite and indefinite integral give different results

I'm trying to find an expression that, given $x$, $y$, and $R$, gives the indefinite 2D integral of a function at the circle centered on $(x_0, y_0)$ with radius $R$. With $g$ as defined below, I'd ...
2
votes
2answers
138 views

NIntegrate fails in a very strange way

I found a strange behavior in Mathematica when trying to evaluate the integral $$f(n) = \int_{1}^2 \frac{\Gamma(n)\Gamma(x)}{\Gamma(x+n)}{\rm d}x$$ I evaluate this using ...
0
votes
1answer
75 views

Negative numerical result when integrating a strictly non-negative integrand

Although there are similar posts here Negative integral of a positive function , Positive integrand giving negative answer , my case is even more surprising. I have a very simple function ...
2
votes
2answers
148 views

Definite Integral. Perfomance problem

I have a notebook in Mathematica 4. I'm trying to convert it to use in Mathematica 9. One of the problem is the long computation of definite integral. In Mathematica 4 the result of the following code ...