Tagged Questions

Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

0
votes
1answer
345 views

NIntegrate & non-numerical values

I am wondering why I am receiving the message "The integrand ... has evaluated to non-numerical values for all sampling points in the region ..." for a particular calculation I am running. How can I ...
1
vote
3answers
189 views

plotting an Integration output

How to solve this integral by Mathematica even by numerical methods (plotting the solution) Integrate[(Cos[x] - a)/(1 + a^2 - 2*a*Cos[x])^1.5, {x, 0, 2*Pi}] It ...
7
votes
1answer
324 views
2
votes
1answer
439 views

Differential equations: Solving a singular/nonlinear ODE using NDSolve

I am trying to numerically solve a rather horrible looking singular/nonlinear ode: A*(y''[x]/y[x])'' +y[x]^2==1 on the interval ...
2
votes
1answer
225 views

How to use NIntegrate in a purely numerical mode?

I have a function that is defined as the smallest root of a given polynomial. Something like this: ...
0
votes
1answer
148 views

PDE Solving in mathematica

I'd like to ask how I might go about solving this equation: $\frac{\partial Ci}{\partial t} + \frac{1}{r^2}\frac{\partial (r^2 Ci)}{\partial r} = D\frac{1}{r^2}\frac{\partial}{\partial ...
2
votes
1answer
154 views

Plotting Laplace's equation on an infinite domain

I am trying to plot my solution to a Laplace equation on an infinite domain. However, when I try to plot it, Mathematica just runs with nothing happening. ...
0
votes
1answer
428 views

Syntax question regarding Triple Integrals in Mathematica

Integrate[1, {z, 0, 5}, {x, -Sqrt[ 9 - y^2], Sqrt[ 9 - y^2]} , {y, -3, 3}] 60 Sqrt[9 - y^2] How comes I am not getting a number for my final answer? This ...
2
votes
1answer
891 views

Can Mathematica solve integro-differential equations?

I have integro-differential equations like this: ...
1
vote
1answer
193 views

Using ParametricNDSolveValue with initial conditions of another ParametricNDSolveValue

I have a system of parameter-dependent ODEs, which I can solve using ParametricNDSolveValue. Now, I have another ODE, which has as initial condition the solution of ...
0
votes
0answers
131 views
12
votes
1answer
833 views

Numerical solution of coupled ODEs with boundary conditions

I have to solve the following set of ODEs and just can't get good results using Mathematica $$ r\frac{d}{dr}\left(\frac{1}{r}\frac{d}{dr}A(r)\right)-\xi^2F(r)^2\left(A(r)-1\right)=0 $$ $$ ...
1
vote
0answers
176 views

Jumps in NDSolve results

I need to compute using NDSolve routine, some function $F(x)$, having two possible values $F_1(x)$ and $F_2(x)$ depending on whether the argument exceeds some ...
0
votes
0answers
148 views

System of integral equations with integrals on both sides

I'd like to solve the following equation numerically for $a_1$, $a_2$, $\alpha_1$ and $\alpha_2$: $\displaystyle\int_0^{\infty}\Big[L_1\Big(\frac{k^2}{2}\Big)\Big]^2e^{-k^2}L_m(k^2)\ dk=$ ...
-2
votes
1answer
188 views

Is there any good way to find and/or plot numerical integrals of non-continuous functions like Tan[x]? [closed]

I believe that the answer to this may be obvious to some of you, but I just can't think of anything that works. NIntegrate, NDSolve, etc, all throw a temper tantrum when they have to divide by zero, ...
2
votes
1answer
320 views

Avoiding zero (empty set) solution with NDSolve

I'm trying to use NDSolve for a chemical kinetics equation where the rate of conversion is given by this relationship as typed in Mathematica: ...
2
votes
1answer
601 views

Obtain a stable solution using NDSolve

I am trying to solve a partial differential equation using NDSolve. When I am not specifying any method options with NDSolve, it ...
0
votes
1answer
108 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
105 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
123 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
152 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
200 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
959 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
97 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
74 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
99 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
354 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
272 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
311 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 ...
5
votes
2answers
451 views

Volume of a graph

I have the following list: ...
2
votes
1answer
274 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
184 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
301 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
357 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
346 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
354 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
406 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
178 views

Using new symbol in WhenEvent in NDSolve

This is an example in Mathematica's help document. ...
9
votes
2answers
321 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
270 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
170 views
0
votes
1answer
110 views

Question with ParametricNDSolveValue

When solving the following system: ...
0
votes
1answer
174 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
386 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
123 views

Changing ParametricNDSolveValue options for only part of the run

Here is an example of the system that I am running, ...
-1
votes
1answer
261 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
287 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
144 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 ...
5
votes
2answers
475 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
316 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 ...