Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

0
votes
1answer
96 views

Order of evaluation in nested expression

I am trying to make a function that works as follows: Integrate 1 for all t in the interval $ [0,1] $ such that the first element of function vstar is positive. ...
1
vote
1answer
98 views

ParallelTable of ParametricNDSolve objects fail

There seems to be a problem with ParametricNDSolveValue togeteher with ParallelTable First we create a ParametricNDSolveValue object ...
1
vote
1answer
115 views

ParametricNDSolve: Fails to differentiate an matrix differential equation

It seems like there is a problem with differentiating a ParametricNDSolve object when the underlying system contains an matrix differential equation. Create a simple ParametricNDSolveValue object ...
3
votes
1answer
127 views

NDSolve: Reinitialize fails with If condition

I have found a weird problem using If conditions containing an state inequality of the form state<=. First consider the simple ODE with an If condition ...
0
votes
0answers
174 views

Defining extra boundary conditions for NDSolve?

I have a second order reaction / diffusion type ODE of the form $\frac{D_{o}}{r^2} \frac{d}{dr}\left(r^2 \frac{dC}{dr} \right) - \frac{aC}{C+k} = 0$ where $a, k$ and $D_{o}$ are constants and $C$ is ...
4
votes
4answers
820 views

Numerical differentiation methods

Is it possible to write a code in Mathematica that implements various differentiation methods (like forward, central, extrapolated, etc.)?
2
votes
0answers
91 views

Whether NIntegrate evaluation is multithreaded or not?

About MultiThread evaluation I am talking about here, see this post I am NIntegrate the function grarm[e, 3, dimension, 1, 1, 0.005]. There is matrix operation in ...
0
votes
0answers
72 views

Some boundary issue of Integration

When I try to solve the integration f(x) as following (type it in the Mathematica) $ f(x)= \frac{1}{π} \int_{-1}^{1} \frac{\sqrt{1-y^2}}{(y-x)}dy $, I met some boundary problems. I have searched some ...
1
vote
0answers
90 views

why maxrecursion didn't work if I specify singularity in NIntegrate

I study sigularity specification and MaxRecursion in NIntegrate. And find something unusual. first I define a function δ[x_, y_: 1/100] := 1/π*y/(x^2 + y^2) ...
3
votes
1answer
301 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 ...
9
votes
1answer
254 views

Mathematica9: NDSolve slows down after repeated calls

I have noted that in Mathematica 9 my code, which involves a lot of calls to NDSolve, slows down considerably after some time. Apparently, the problem is NDSolve itself and it seems to be related to ...
4
votes
0answers
272 views

NDSolve: ProcessEquations and Reinitialize with Piecewise functions

I am having trouble with using NDSolve`Reinitialize when the system consists of a pieceise function. If we define the ODE system ...
4
votes
2answers
367 views

Volume of a graph

I have the following list: ...
2
votes
1answer
238 views

Limitations of ParametricNDSolve family w.r.t objective functions

Observation: I can see even for very simple modification in case of an scalar objective involving an definite integral in time ParametricNDSolve fails. Here is an ...
4
votes
1answer
174 views

How to demonstrate lack of stability with advection equation

I am trying to that using a coarse grid with an explicit method for, say, the advection equation leads to an unstable solution. The trouble is Mathematica avoids unstable solutions with good ...
3
votes
1answer
250 views

Evaluating function only when its optional argument is numeric

I want to have the argument 'a' for myf2 in form of optional argument, but at the same time I need to evaluate the function only if 'a' is Numeric, see also my previous question. ...
2
votes
1answer
329 views

Crank-Nicolson with NDSolve?

As far as I understand, the Crank-Nicolson method (a.k.a. trapezoidal method) can be expressed as a second order implicit Runge-Kutta method. It's Butcher tableau is: ...
3
votes
1answer
307 views

Tips for efficiently solving large system coupled (nonlinear) ODEs

I'm trying to solve a system of nonlinear, coupled ODEs, where the governing equation for the $n-th$ ODE is of the form: $\sum_k^M Q_{nk} \ddot{a}_k -\sum_{\ell}^M\sum_k^M S_n(\ell,k) \dot{a}_{\ell} ...
-2
votes
1answer
278 views

Interpolating Function inside of NDSolve

I have a problem and it seems to be connected to an Interpolating function inside of an NDSolve command. The resistivity[x] ...
0
votes
2answers
259 views

Plot of a function which includes numerical integrals

I want to make a 3D plot of two variable i1 and b1. The dependent variable results from a pay-off function ...
1
vote
1answer
170 views

Using new symbol in WhenEvent in NDSolve

This is an example in Mathematica's help document. ...
9
votes
2answers
308 views

Symbolic integration fails while numerical integration succeeds

I am hoping to evaluate the following integral Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, {r, 2, Infinity}] but Mathematica informs me that this ...
7
votes
2answers
255 views

Adding a constant vector to a vector differential equation seems to break NDSolve. Why?

I'm trying to solve a differential equation that's phrased in terms of matrices and vectors. My minimum working example is this: ...
1
vote
1answer
154 views
0
votes
1answer
99 views

Question with ParametricNDSolveValue

When solving the following system: ...
0
votes
1answer
165 views

find derivative with defined function

s[a_, b_] := NDSolve[{y''[x] == y[x] Cos[x + y[x]], y[0] == a, y'[0] == 1}, y, {x,0, b}] I need to find the minimal of $\int _1^by[x]^2$ in the region ...
8
votes
4answers
330 views

NIntegrate extremely piecewised functions

I often need to integrate extremely piecewised functions, like the following one (not extreme, but gives an idea): ...
1
vote
1answer
106 views

Changing ParametricNDSolveValue options for only part of the run

Here is an example of the system that I am running, ...
-1
votes
1answer
237 views

Help in NIntegration Methods - Takes too long, why?

I have this code. It is a triple integral, and using the automatic method gives me a wrong answer for $T=0.1$ (the correct answer is $5.44$, while I got $3.73$ ). I've tried to change the integral ...
-1
votes
2answers
269 views

Performance of numerical optimization with triple integral [closed]

I'm trying to solve a numerical optimisation that looks something like this: ...
0
votes
0answers
120 views

Which Method option should I choose for NIntegrate in two dimensions?

I want to integrate an interpolating function a[x,y] over a certain region in the xy-plane. My problem is that Mathematica is taking too long. I am hoping someone ...
4
votes
2answers
402 views

Numerical Integration as Model for Nonlinear Fit

I'm trying to do a fit for parameters of a function within an integral but I'm getting errors when I try and run it. Essentially I want the following fit to work out: ...
3
votes
2answers
277 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 ...
8
votes
1answer
353 views

Complex valued 2+1D nonlinear PDE using NDSolve

I am trying to follow the main ideas presented in this question, applying it to my own problem, which is a complex, time-dependent, nonlinear PDE: $$i \frac{\partial \psi}{\partial t} = \left[ ...
2
votes
0answers
59 views

Are FEM methods integrated in NDSolve yet? [duplicate]

About a year ago there was a discussion on these forums as to whether FEM methods have already been integrated into NDSolve in Mathematica. The answer back then was ...
1
vote
0answers
74 views

Integrate boundaries defined as equations

Have you guys ever needed to define Integrate boundaries as equations? I tried to submit the equation as was written in original text but it seems that mathematica can't understand it. ...
1
vote
0answers
359 views

triple NIntegrate fails

Here's m problem simpler in terms of codes ...
22
votes
2answers
1k views

Complex valued 2+1D PDE Schroedinger equation, numerical method for `NDSolve`?

Based on the heat equation of the Mathematica Manual tutorial, I wrote the complex counterpart (Schroedinger) equation, for the free particle propagation of an initial wavepacket. ...
0
votes
0answers
47 views

Ignoring Indeterminate Results [duplicate]

I am doing some program where I must calculate some numerical integral (the involved function is quite complicated to be solved analytically). The function to be integrated have some parameters which ...
-2
votes
1answer
289 views

Problem with plotting a function with NIntegrate

Why does the following Plot3D command never terminate? ...
6
votes
1answer
182 views

Specifying mesh in NDSolve

I am trying to solve a system of one-dimensional two-point boundary-value problems with NDSolve. I would like use a fixed mesh (specified by me) in the calculation. Is there a way to do this? The ...
0
votes
2answers
180 views

Is there a better way to approximate some graphs of integrals than interpolation?

I'm still pretty new to Mathematica so my apologies if this is a dumb question. I wanted to plot some integrals of functions for no particularly good reason, but the only decent way I could come up ...
1
vote
0answers
222 views

Why is a bump function making NDSolve take forever to solve?

I am attempting to solve a system of relatively complicated elliptic PDEs via a relaxation technique. In particular, I am trying to solve $\textrm{div} LW = S$ where $S$ is some vector and $L$ is the ...
42
votes
3answers
1k views

When I can assume that all decimal digits returned by Mathematica are provably correct?

How to Control the Precision and Accuracy of Numerical Results Arbitrary-Precision Numbers Mathematica works with exact numbers and with two different types of approximate numbers: ...
0
votes
0answers
160 views

Integral of a transcendental equation

I have taken the following derivative of a transcendental equation using the D[...] function, as part of an approximation: ...
3
votes
2answers
246 views

Numerical Integration with InverseErfc

I am trying to numerically integrate an equation that involves InverseErfc (embedded in the copula defined). The equation looks like the following: $$ \int_0^T \int_0^\infty \int_0^\infty ...
2
votes
3answers
570 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 ...
0
votes
1answer
170 views

Fast integration of 2D distribution across lines parallel to y-axis

I'm struggling with a small data set and a slow calculation. I have hundreds of small 2D data arrays and need to integrate across several lines parallel to the y-axis. Let me start with the data ...
0
votes
0answers
419 views

Solving coupled eigenvalue differential equations

I am trying to solve an equation of the form as follows $\left(\begin{array}{cc} -\frac{\hbar^{2}}{2m}\frac{\delta^{2}}{\delta z^{2}}+\sin^{2}\left(z\right) & z\\ z & ...
4
votes
2answers
664 views

Does Mathematica have a command analogous to ode45 of MATLAB?

Does anybody know if Mathematica has an analogue of MATLAB's ode45 command? I need to solve a second order coupled ODE system of equations.