Questions on the use of numerical functions NIntegrate and NDSolve.
5
votes
3answers
770 views
NDSolve with Euler method
I want to solve this equation with NDSolve[] using the Euler method:
x'[t] == 0.5*x[t]-0.04*(x[t])^2
with initial condition ...
5
votes
1answer
703 views
NDSolve, Schrödinger equation, and decaying solution
I am trying to solve a Schrödinger equation for a particle hitting a step potential using NDSolve in Mathematica. Here is my code:
...
5
votes
3answers
420 views
How to use results of NDsolve[] for further solving of ODEs?
I have a system of ODEs with 10 eqns. I can solve the first 5 independently. How can I use those results to solve for the remaining 5?
An easy example would be
$\dot{x}=f(x), \quad
\dot{y}=g(x,y)$
...
5
votes
1answer
308 views
How to solve a non-linear integral equation?
I have a non-linear integral equation that I'd like to solve with Mathematica:
Solve[Integrate[B[x] v / (B[x] + B[v])^2, {x, 0, 1}] == 1, B[v], {v}]
This ...
5
votes
2answers
232 views
How to find Matano plane
I have discrete collection of data points (10 to 10^4). I want to describe them by a continuous function and find a x value z, ...
5
votes
1answer
150 views
Differential Equations with Matrices
I'm trying to implement the differential equation of a Cellular Neural Network in Mathematica as seen below:
...
5
votes
1answer
459 views
Incorrect solution of diffusion equation with Neumann boundary conditions
I want to set up a PDE model, which takes a two-dimensional diffusion equation into account. The key problem is that I have some trouble in solving the two-dimensional diffusion equation numerically. ...
5
votes
1answer
229 views
Unexpected results from NDSolve
I am trying to solve a stiff reaction diffusion system with NDSolve. However, it does not produce the expected results.
My problem is a spherical cell with 5 ...
5
votes
1answer
182 views
The difference between “SymbolicProcessing” -> 0 and restricting the function definition to numeric values only
The Documentation tells us that there are two ways to disable symbolic processing of the integrand by the NIntegrate function when it is known that it just slows ...
5
votes
1answer
111 views
How can I deal with an NDSolve::ivone message regarding boundary values?
I have a question regarding the error message:
...
5
votes
1answer
97 views
Proper use of arbitrary number of variables
So, I'm working on a project where the number of independent variables is not fixed.
Consider a problem of $N$ independent variables, $\boldsymbol{r}$.
I want to perform different things with them. ...
5
votes
1answer
178 views
Multiple simultaneous events in EventLocator method for NDSolve
I'm using NDSolve to integrate a system of ODEs, and EventLocator to stop the integration when it leaves a certain region in phase space. This works perfectly as it should.
However, I've also added ...
5
votes
0answers
173 views
4
votes
2answers
522 views
Solving a time-dependent Schroedinger equation
I want to solve the time-dependent Schroedinger 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 ...
4
votes
2answers
389 views
How to solve for an Z-Score of a T-Distribution?
I'm looking for the Z-Score for a distribution, where the integrated area sums up to 0.90. Unfortunately I always get an error from Mathematica, ...
4
votes
2answers
641 views
Is it possible to compute trapezoidal rule numerical integration?
Is it possible to compute trapezoidal rule numerical integration? I know that Mathematica has Interpolation, and that a list of points can be interpolated and then ...
4
votes
1answer
177 views
Integral of integral — it takes too much time
When I evaluate the following expression in Mathematica, it takes so much time that I don't want to wait for the evaluation to complete. So I think that there must be a better approach.
...
4
votes
3answers
133 views
How could I get the value of y[t] at each specific interpolation point?
sol = NDSolve[{Derivative[2][y][t] + Sin[y[t]] == 0, Derivative[1][y][0] == 0, y[0] == 1},
y, {t, 0, 2}]
the above-mentioned differential equations can be solved ...
4
votes
1answer
154 views
Could the PrecisionGoal for NDSolve be a negative number?
The help of Mathematica doesn't say so much about the PrecisionGoal for NDSolve, and I never considered much about it even after ...
4
votes
1answer
212 views
Using a compiled function inside NIntegrate gives “CompiledFunction::cfsa” message
The following function is defined for Real input:
FFc = Compile[{{x, _Real}, {EF, _Real}},If[x > EF, 0., If[x == EF, 0.5, 1.]]]
FFc is now used in the ...
4
votes
1answer
250 views
Solving an ODE numerically
I really appreciate it if anyone helps me with this:
How can I solve this ODE and plot the answer for $x$ on $[0.6,5]$:
$$
\begin{align*}
-2xy'[x] = y''[x]+ 47.21 (-.0025 x^6 & + ...
4
votes
1answer
62 views
Differentiating ParametricNDSolve solutions
Is there any way to differentiate a solution obtained by ParametricNDSolve? For instance, I have the position $\phi_\gamma(t)$ as a function of time, parametrized ...
4
votes
1answer
91 views
Integrating a list of functions
For the purpose of this minimal example, let's say we have a list of functions, like this:
f[y_?NumericQ] := {NIntegrate[z*y, {z, 0, 1}], a y}
I want to ...
4
votes
1answer
102 views
How to find derivative of a numerical solution, where precision is ambiguous?
I am trying to take the derivative of a numerical solution. I am concerned that the way I'm doing this may be problematic due to numerical error; I think there must be a better way but I'm not very ...
4
votes
2answers
276 views
How to set the initial condition? (to make IC and BC consistent)
I want to find the initial condition which fits mixed boundary condition of Phi[r, Theta, t].
The original initial condition in text is
Phi[r, Theta, 0] == 1
. ...
4
votes
1answer
381 views
Solve system of ordinary differential equations that doesn't have an initial condition (t=0), but has an inifinity condition (t=infinity)?
I have a question for solving t -> Infinity on Mathematica. First, I have a system of ODEs:
...
4
votes
2answers
625 views
How to handle NDSolve::ndsz problem (singularity problem)
I have 2 second order differential equations (non-linear). The physics behind them is correct. I verified the equations many times. It is a solid pendulum with a mass-spring at the end of it.
Now, ...
4
votes
1answer
196 views
Error Interpretation in NIntegrate
I am using a recursion algorithm developed by Migdal for Lattice Field Theory, and I have the following code:
...
4
votes
2answers
124 views
4
votes
1answer
184 views
NDSolve does not respond
For some sets of constants, NDSolve gives me true solutions, but when I try for example, T = 1/(2*2200), Mathematica does not respond. What can I do? The code below ...
4
votes
2answers
806 views
PDE Boundary Conditions
I am solving a PDE using Mathematica and I would like to know how to implement the condition that the two-variable function y[t,s] is zero whenever ...
4
votes
1answer
165 views
NDSolve for a large system of simple ODEs
I am solving a system of many (more than 100) ODEs.
It is the kind of standard rate equation encountered in semiconductor physics.
Here is the system:
...
4
votes
0answers
129 views
Artifacts in Line Plot from InterpolatingFunction
I have a periodic solution from an NDSolve that is producing an InterpolatingFunction. With the default plot settings, there is not enough PlotPoints/MaxRecursion to resolve the peaks in the function:
...
4
votes
0answers
399 views
Controlling the time step in NDSolve?
I generally use NDSolve for stiff non linear partial differential equations of 4th order. I find that a BDF1 method generally does well to placate my beast of a PDE.
I've also tried out ...
4
votes
0answers
222 views
Increase precision of custom function
I hope the title is not misleading:
Suppose I have a function that is quite complicated, e.g.
f[u_] := Exp[-Exp[- Abs[c.u]^a] Sin[d.u] Sin[(Abs[c.u]^a) ...
I ...
3
votes
4answers
269 views
How can I get the value of a at “t=2.4985352432136567” in the following expression?
By running the following code:
...
3
votes
2answers
457 views
optimization problem with NDSolve
I want to minimize the function fcc. When fcc is calculated for a specified point the answer is correct:
...
3
votes
3answers
150 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.
...
3
votes
2answers
246 views
How to avoid this kind of numerical error caused by extreme parameters when using NDSolve?
Here I use a one-dimensional heat conduction equation as the example. I found that when the thermal diffusion coefficient is small enough, Mathematica will give a result against the second law of ...
3
votes
3answers
617 views
Retrieve values of InterpolatingFunction
While analyzing a large system of ODE's, I defined a particular ratio p, which contains some variables that are represented by ...
3
votes
2answers
109 views
LevinRule and SphericalBessels
I'm currently looking at a simplified problem that approximates another problem I'm looking into. In this simplified problem I at least have an analytic integrand and can easily provide all info on ...
3
votes
1answer
478 views
Methods to speed up numerical NDSolve, NIntegrate,
I am not very used to do numerical simulations on Mathematica. Do you have any ideas how to improve i.e. speed up my code?
...
3
votes
1answer
491 views
NDSolve with vectors
I'm stumped. I'm trying to write this using vectors, but the 2nd derivative isn't being expanded like I expected it to be. This is a system of equations for a projectile with quadratic drag and ...
3
votes
1answer
259 views
Solving the Sine Gordon PDE in mathematica
how can i solve this equation in mathematica?
this is sine-gordon eq.
but the boundary condition can not recognized by mathematica .
thank you for you attention.
...
3
votes
1answer
285 views
Optimizing a function involving NDSolve results in error messages
I want to minimize a function f with NMinimize but an error occurs that says:
...
3
votes
3answers
246 views
Numerical solution of a differential equation with NIntegrate coefficients
I am trying to solve a linear ODE with a variable coefficient which is given in terms of an integral I can only do numerically. That is, I have an equation of the form
$$
...
3
votes
1answer
399 views
NDSolve Problem
I am trying to solve a chemical equilibrium ODE with NDSolve where one function is the argument to another.
I.E. My equations look like:
...
3
votes
1answer
142 views
tricky memoization
Let's say I have the NDSolve example for documentation involving splitting 2nd order into set of 1st order ODEs:
...
3
votes
2answers
410 views
Compute integral symbolically or numerically
I want to compute the integral of the following integrand
...
3
votes
2answers
137 views
How to remove a singularity with WhenEvent
Bellow I have a differential equation which hits a singularity at low values of t. What I want to do is somehow utilize the WhenEvent command in order to replace ...
