Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

0
votes
1answer
29 views

Solution of Coupled second-order ODEs and plot the diagram

We have two second-order Coupled differential equations as the followings: $$\left\{\begin{array}{lr} \displaystyle \frac{{{d^2}{y_1}}}{{d{x^2}}} = \{ \frac{{\sqrt {\frac{{1 - {\varepsilon ...
4
votes
2answers
95 views

How to speed up Integration of interpolation function?

I have a list of data and interpolate it to a function. Then I need to done something integration with the interpolation function. But I found the speed is unacceptable slow. My data is here (a ...
0
votes
0answers
22 views

Performing numerical derivative after numerical integration

First of all, I am sorry to repeat a question which is similar to the closed question, "Numerical Derivative after numerical integration". I could not understand the solution introduced in the link. ...
2
votes
1answer
61 views

Will the solution NDSolveValue finds outside of the region I give it give me bogus results?

I'm using NDSolveValue to solve Laplace's equation for a relatively simple system. I have two rectangles, separated by a small gap, which I define using RegionDifference: ...
0
votes
0answers
61 views

Tricky inverse Laplace transform

I'm trying to compute the inverse Laplace transform of $f(s) = s^c/(N + s^{ir} )$ where $c,N \in \mathbb{C}$ and $r \in \mathbb{R}^+$ using the Bromwich integral $$ F(t) = \frac{1}{2 \pi i} \int_{- ...
0
votes
0answers
50 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
1answer
64 views

Why does NDSolve and NIntegrate not give the same result?

I have plotted solution of two equivalent equations one in Integral form (right chart) the other in Differential form (left chart) using NDSolve and NIntegrate but they give me completely different ...
1
vote
1answer
52 views

How can use Table for two functions obtained from NDSolve? [on hold]

I have obtained a numerical solution using NDSolve for two functions a(x) and b(x). how do I use Table to make a list of a(x) vs b(x) values. is it simply Table[{a(x),b(x)},{x,0,100}] or should I use ...
2
votes
2answers
42 views

NIntegrate::inumri error with continuous function

I'm trying to calculate the finite part of a divergent integral numerically, but as I bring the regulator down to $0$, Mathematica starts throwing an error. ...
1
vote
1answer
85 views

Numerical integration over a circle contour

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$ ...
1
vote
1answer
63 views

NDSolve a system of PDE's when one variable does not have an explicit time derivative

Say I want to solve the following set of PDE's (my actual equations are way more complicated, this is just a simplified example to show the structure): $$\begin{align} \partial_t ...
0
votes
1answer
117 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 ...
0
votes
0answers
36 views

NIntegration and NDSOLVE and Interpolation [closed]

I am working on the Duffing equation to calculate the residual error from the x'[t] solution after integrating the Duffing once but the accuracy is not good I ...
7
votes
2answers
170 views

Multiply integrand with -1, and the precision changes?

"After multiplying the integrand of NIntegrate with -1, the Precision of the output will ...
1
vote
1answer
227 views

Why Integral does not converge?

I am trying to solve for $\Omega$ this nonlinear integral equation: $$1+\dfrac{z}{k^2}-\dfrac{z^2}{K_2(z)} \dfrac{\Omega}{k^3} \displaystyle\int_{1}^{\infty} \gamma^2\, \text{ArcTanh} ...
2
votes
1answer
155 views

The numerical solution of a nonlinear ODE: boundary value problem

I want to solve the following nonlinear ordinary differential equation with boundary values $f(0)=1$ and $f(1)=1$: $${\frac {{\rm d}^{2}}{{\rm d}{x}^{2}}}f \left( x \right) ={\dfrac { \left( 51-51\,x ...
3
votes
1answer
70 views

NDSolve DAE solution order is mixed up

Compare the two solution sets below: in the first one (x == False), there are only 3 dependent variables while in the second one (...
3
votes
0answers
67 views

Integrate function over a 2D implicit surface

I have the following problem. Let's say we have a 2D region, let me be very explicit: ...
14
votes
3answers
5k views

Solving a time-dependent Schrödinger equation

I want to solve the time-dependent Schrödinger equation: $$ i\partial_t \psi(t) = H(t)\psi(t)$$ for matrix, time-dependent $H(t)$ and vector $\psi$. What is an efficient way of doing this so that ...
4
votes
1answer
486 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 ...
2
votes
1answer
43 views

Nintegrate until a certain value is reached

I need to launch a Nintegrate command to integrate a function on a domain $(0,x_{b})$ where the value $x_{b}$ is determined by the fact that the integral reach a ...
1
vote
1answer
99 views

NDSolve with coupled ODE's and unknown singularities

I have two coupled ODEs that I am trying to solve numerically. It appears that there is a singularity in the solution to the equations which I am unsure how to get past. Both functions $\alpha$ and ...
12
votes
1answer
105 views

Empty WhenEvent action crashes kernel

Bug introduced in 9.0 and persisting through 10.4.1 WhenEvent is new in 9.0. This is an example from the docs, slightly modified (action is wrapped in ...
-1
votes
1answer
286 views
3
votes
0answers
112 views

Mathematica Newmark Optimization

Here is my Mathematica code which implements the Newmark method to solve a equation of motion. The variable "ag" contains the accelerations from an earthquake record. Is it possible to optimize this ...
2
votes
1answer
73 views

Does NDSolve iterate faster in a region where the system being solved is in equilibrium?

I was wondering how exactly the time it takes for NDSolve to iterate through a certain region of the domain depends on the local behaviour of the given system being solved. My guess would be the ...
0
votes
0answers
42 views

NDSolve kernel crash, affected by variable naming

The following isolated example cannot be further simplified much to reproduce a crash. I've already submitted the issue to TechSupport, but it seems this is not an easily reproducible case, so I'm ...
0
votes
0answers
69 views

Force NDSolve to use finite difference

How to force NDSolve to use finite difference instead of FEM. I have the following code: ...
18
votes
1answer
477 views

Numerical inverse Laplace-Hankel transform

When trying to reproduce the result of this paper about numerical solution of Lamb's problem, I encountered the following double integral (to be more precise, the 0-order inverse Hankel-Laplace ...
0
votes
0answers
70 views

Boundary conditions for NDSolve

I get the following message: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable. >> from ...
11
votes
1answer
216 views

NDEigensystem returns incorrect eigenvalues for 2D coulomb problem, eigenfunctions contain discontinuity

I posted a similar question a short time ago regarding the 3D Coulomb problem. Jens' excellent answer to this thread allowed me to obtain the correct eigenvalues and eigenenergies for that system. I ...
4
votes
1answer
73 views

Issues with modeling pulses in a very simple system of DAEs

Some time ago I had asked this question about evaluation difficulties using Euler Integration to solve a system of ODE where discrete pulses occur. While I have now abandoned Euler integration and ...
10
votes
0answers
135 views

Strange behaviour of integrals with Cos, Sin, and Exp

During the study of the problem How to solve this integration? I have discovered a strange behaviour of some integrals. I would consider it a bug. ...
1
vote
2answers
104 views

Numerical integration does excessive coarse-graining?

I am trying to perform numerically the following integral $$\int_0^8\text{d}x\,\text{Re}\left[\frac{e^{-\frac{a^2}{2}-\frac{x^2}{2}} x^4 \sin (b x)\left(e^{-i c x} \text{erfc}\left(\frac{-c +i x ...
1
vote
1answer
209 views

Solving wave PDE

I am trying to solve the wave PDE with NDSolve. Below is the equation: ...
3
votes
2answers
92 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$ ...
1
vote
0answers
236 views

A power series expansion [closed]

Consider the function, $f(z) = z\, \tanh(\pi z) \log (z^2 + a^2)$ for some $a>0$. Now I am considering 3 different situations, $z = i(n+0.5) - i\epsilon + \delta - it$ for $n \in \mathbb{Z}$ ...
1
vote
1answer
82 views

NIntegrate gives two results for two forms of the same function. Which one to trust?

I am interested in evaluation the following integral numerically (since apparently there is no analytical solution) $$\int dx \,x^3 \left(e^{2 i c x }-i \text{erfi}\left(\frac{x +i c ...
0
votes
3answers
85 views

Average function value over an Interval [closed]

What is the best way to find the average value of a function over a specific interval in Mathematica? I can not figure it out. I have two points on the interval and need to find the average value.
10
votes
1answer
202 views

NDEigensystem cannot solve numerically the 3D Coulomb problem, while DSolve returns the right answer

After having derived by hand the eigenvalues and eigenfunctions for the 3D and 2D hydrogen atom, I want to solve the systems numerically using Mathematica. I need to do this because my next step is to ...
14
votes
2answers
255 views

What can one do with extremely stiff problem in NDSolve?

Consider the following illustrative problem: $$ \frac {\partial f} {\partial t} = \frac {\partial} {\partial x}(x f) + \frac {\partial} {\partial x}(f \frac {\partial f} {\partial x}) $$ This is ...
3
votes
1answer
46 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
37 views

Method to compute NIntegral of Trigonometric functions

I don't know which method to adopt for computation of the following integrand on the unit sphere in $R^6$: $ 2 r^9 \sin ^5(\text{$\theta $1}) \sin ^3(\text{$\theta $2}) \sin2(\text{$\theta $3}) \sin ...
8
votes
2answers
145 views

How to improve accuracy of NIntegrate over ImplicitRegion

I'm trying to compute the area of a implicit region given as ...
1
vote
1answer
44 views

Using NIntegrate on a joint CDF without getting an error

I am trying to calculate the area under a constrained part of a function built from the empirical CDFs of two distributions. When I calculate the area of either CDF using NIntegrate it works fine, ...
0
votes
0answers
32 views

Stable numeric integration of multidimensional step function

I am trying to integrate numerically a two-dimensional function (a SmoothKernelDistribution) with a step. I tried a few different settings for the parameters of ...
12
votes
2answers
817 views

Why can't I change the value of MaxRecursion in NIntegrate when integrating BesselJ?

Bug introduced in 8.0.4 or earlier and persists through 10.4. I am trying to evaluate this integral numerically $$ \int_0^{\infty } J_0(q R) \tanh(q) \, \mathrm{d}q $$ for large values of $R$. ...
0
votes
1answer
92 views

How to omit the corrupt value in a program?

I've such errors: Coordinate .. is not a floating-point number and can't correctly fix it. The problem occures when x==Log[2] The program works correctly ...