Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

4
votes
2answers
302 views

Volume of a graph

I have the following list: ...
2
votes
1answer
189 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
154 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
179 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
291 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
254 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
188 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
177 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
157 views

Using new symbol in WhenEvent in NDSolve

This is an example in Mathematica's help document. ...
9
votes
2answers
299 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
238 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
133 views
0
votes
1answer
86 views

Question with ParametricNDSolveValue

When solving the following system: ...
0
votes
1answer
154 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
282 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
83 views

Changing ParametricNDSolveValue options for only part of the run

Here is an example of the system that I am running, ...
-1
votes
1answer
207 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
254 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
88 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
318 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
228 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
318 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
58 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
69 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
284 views

triple NIntegrate fails

Here's m problem simpler in terms of codes ...
21
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
46 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
225 views

Problem with plotting a function with NIntegrate

Why does the following Plot3D command never terminate? ...
6
votes
1answer
158 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
173 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
195 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 ...
38
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
150 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: ...
2
votes
1answer
192 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
2answers
452 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
150 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
402 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
578 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.
2
votes
1answer
270 views

Multi-dimensional integral in the complex plane with poles and essential singularity

I've passed the last week searching a way to numerically integrate this multi-dimensional integral in the complex plane at the poles and avoiding the singularity at z=0: $$ \oint_{C}\oint_{C\ auound\ ...
0
votes
0answers
111 views

Integrating and plotting pde system solution

I have a trouble with plotting a pde system solution. I'm solving a PDE system in 2-dimensional space and then I want to integrate the solution along one dimension and build a log plot along the ...
1
vote
1answer
237 views

Simpson's rule with ListConvolve or ListCorrelate

I have a function that's represented as a long list of values that I want to integrate. I can do it procedurally with Simpson's rule. ListConvolve generally runs faster then procedural code, so i ...
9
votes
1answer
207 views

WhenEvent and partial derivatives

Can WhenEvent be used to reset the conditions on a PDE at a given time? How would the syntax of that be? This is the code I`m using ...
1
vote
1answer
174 views

NIntegrate converging too slowly when increasing size of array

I have a problem with a numerical integration. I have a 4x4x4x4 array that has for each entry an integral and I want to use NIntegrate to evaluate it. It gives me ...
6
votes
2answers
866 views

Finding y given x from an interpolating function

I would like to put a dot on the point of a curve that has a specific y value but I don't know the x value. A simple example of my code is ...
1
vote
0answers
225 views

Numerical integration involving Inverse Normal CDF

I'd like to evaluate the following numerical integration using Mathematica $$ \ \int_0^T\int_0^\infty xe^{-0.04 s}g(x,s) dxds\ $$ where g(x,s) is a Gaussian copula function with say, marginal ...
8
votes
1answer
362 views

Integration strategies for oscillatory multidimensional function

I am seeking to integrate a highly oscillatory, multidimensional function. I am currently using NIntegrate's QuasiMonteCarlo approach. However, this is time-consuming and, given my current resources, ...
7
votes
1answer
249 views

Numerical contour integrations in the complex plane - contour deformation gives different answer for analytic kernel

I am trying to do a contour integration in Mathematica numerically. In particular, I'm checking the identity: $$ H_m^{(1)}(z) =\frac{i^{-m}}{\pi}\int_{-\pi/2 + i \infty}^{\pi/2 - i \infty} \exp[i m ...
0
votes
0answers
38 views

NIntegrate issue to do with unknown types [duplicate]

I have a numerical function zz: zz[s_ ? NumericQ] := so3toE3[Inverse[yn[s]].ND[yn[k], k, s]]; The other functions involved have 2 pages of code defining them so ...
2
votes
1answer
351 views

Monitoring the Evaluation of NDSolve: time to finish estimation

My problem is quite simple: I run a NDSolve with a system of many ODEs, a calculation that will run for many hours, and I would like to know the progress of the ...