Questions on the symbolic (DSolve, DifferentialRoot) and numerical (NDSolve) solutions of differential equations in Mathematica.
25
votes
2answers
1k views
Efficient Langevin Equation Solver
This question is not about good algorithms for solving stochastic differential equations. It is about how to implement simple codes in Mathematica efficiently exploiting Mathematica's programming ...
24
votes
2answers
407 views
Variable naming changes everything
I am having a rather unusual problem I do not understand with Mathematica where renaming one of the variables of my function causes the function to stop "working". Here is the example of the code ...
21
votes
4answers
545 views
How to use NDSolve to track equilibrium?
I am looking for an extension of NDSolve where integration runs until certain variables are settled at an equilibrium. Now I have a working solution in my sleeves ...
18
votes
1answer
421 views
Publishing results obtained in Mathematica
I've been using Mathematica to solve nonlinear partial differential equations for my doctoral research for the last 2 years or so. I am not an expert in Mathematica or mathematics and I am an engineer ...
16
votes
2answers
371 views
3D orbits and inaccuracy over time
I wrote a little program to use Newton's Law of Universal Gravitation to animate 3 planets orbiting a central star, but I have run into a problem. Here is the code that I used to create the program (I ...
14
votes
3answers
321 views
How to perturb a Dynamic System?
I'm trying to model a basic feedback system with delayed feedback. I've done the initial setup and now want to add a few more advanced features to my system.
Currently, it's just a simple ...
13
votes
1answer
265 views
Optimizing a Numerical Laplace Equation Solver
Laplace's Equation is an equation on a scalar in which, given the value of the scalar on the boundaries (the boundary conditions), one can determine the value of the scalar at any point in the region ...
12
votes
3answers
264 views
Accessing Reduce from DSolve
When solving transcendental equations, Solve frequently warns us that inverse functions are being used so that some solutions may not be found.
We also see that ...
12
votes
1answer
326 views
How to guarantee that NDSolve correctly detects abrupt changes in parameters?
When using NDSolve, I often have parameters that, in most of their domain, have a constant or null variation, but that suffer from abrupt variations on a very small ...
12
votes
3answers
227 views
How to splice together several instances of InterpolatingFunction?
I have a set of InterpolatingFunction returned by NDSolve which are valid over different (but overall continuous) domains. How ...
11
votes
1answer
410 views
2D Heat equation: inconsistent boundary and initial conditions
I'm attempting to use NDSolve on a 2D boundary value problem with initial conditions. Upon running my code, I get the following message:
"NDSolve::ibcinc: Warning: Boundary and initial conditions are ...
11
votes
2answers
601 views
How can I solve a difference-differential equation?
How do I ask Mathematica to try to solve a recursive relation that defines a sequence of functions? For example, suppose I know that $g_n(x) = g_{n-1}'(x)$ for $n > 0$ and that $g_0(x) = e^{2x}$. ...
10
votes
3answers
3k views
Plotting a Phase Portrait
I'm trying to plot a phase portrait for the differential equation
$$x'' - (1 - x^2) x' + x = 0.5 \cos(1.1 t)\,.$$
The primes are derivatives with respect to $t$. I've reduced this second order ODE to ...
10
votes
5answers
996 views
How can you compute Itō Integrals with Mathematica?
How can you compute Itō Integrals with Mathematica? I tried searching through the documentations but I didn't find anything.
P.S. I was not at all sure how to tag this question. I had to put in at ...
10
votes
2answers
253 views
DSolve cannot solve for certain branches of the solution
Could somebody please tell me, why I am always getting an error message when trying to run the following code:
...
9
votes
1answer
466 views
I failed to solve a set of one-dimension fluid mechanics PDEs with NDSolve
@DNA
The fluid here has been assumed as single component perfect gas i.e. it obeys the equation P=ρRT, the thermal conductivity is assumed as a constant, so the equation is:
...
9
votes
1answer
638 views
Numerically solving an inhomogeneous partial differential equation
I'm trying to solve a cylindrical partial differential equation with boundary conditions. But I got an error message saying ...
9
votes
1answer
936 views
What method does NDSolve use for solving PDEs?
What is NDSolve's mode of operation?
I use it to solve partial differential equations and never gave it too much thought. Recently, I came across this question. ...
9
votes
1answer
388 views
How to tell mathematica not to resolve stiffness issues
Very often I solve partial differential equations that are nonlinear and could be up to 4th order. In these cases, it is usual for the solution determined by ...
9
votes
1answer
257 views
How can I eliminate a function in a system of PDEs, Maple-style?
Maple can separate and eliminate a function in a system of PDE equations, with casesplit in the PDEtools package. How to do ...
8
votes
1answer
183 views
8
votes
1answer
448 views
Poisson solver using Mathematica
I am looking for some help with a Poisson solver I am writing in Mathematica. The code is quite long with Arrays plugged in, so the full details can be found at http://pastebin.com/uSrSDcW6
I am ...
8
votes
2answers
192 views
Differentiating an unknown solution to a PDE
Sorry if this question is too basic -- I'm not very familiar with Mathematica.
I am interested in a way to systematically address the following sort of problem:
Suppose that $u=u(x,y)$ is a function ...
8
votes
1answer
341 views
1D Euler Equations
Is it possible to accurately solve the 1D Euler equations in Mathematica using NDSolve?
For example, let us consider the problem given here: http://www.csun.edu/~jb715473/examples/euler1d.htm
Using ...
7
votes
2answers
273 views
Starting NDSolve from intermediate time step?
I always wondered if I could start NDSolve from an intermediate time step.
What I mean is, in the code sample below, if I were to run my solution from tmin=0 to ...
7
votes
2answers
287 views
Basins of Attraction
How does one shade the basin/s of attraction of a phase plot in Mathematica? I have been trying to do this using the system $\dot x = y$ , $\dot y = -9\sin(x) - 0.20y$ and have gotten nowhere.
7
votes
2answers
305 views
How to apply restrictions to the “integrated” variable, when using NDSolve?
I have to integrate an energy along a path. I know the energy at the "beginning" of the path (energy[0]), and I can determine the energy change (gain and loss) ...
7
votes
1answer
229 views
Setting the DifferenceOrder Option
I've been playing around with Method in NDSolve[...] and can't quite seem to figure out how to force ...
7
votes
1answer
187 views
What does MaxStepFraction do?
I find that with NDSolve[...] while solving a partial differential equation, changing the MaxStepFraction from ...
7
votes
1answer
142 views
The only usage for the option InterpolationOrder in NDSolve is to be set to All?
We know that changing the option InterpolationOrder in ListLinePlot、ListPlot3D、...
7
votes
1answer
333 views
Optimizing an energy functional in mathematica using variational calculus
I have an energy functional which I want to optimize using calculus of variation.
It would be nice if someone could please post a working example using mathematica. The procedure is as follows, ...
7
votes
0answers
135 views
Numerically solve 2nd order differential equation with singularity
Consider a second order differential equation with a potential that diverges at some generic value in the variable. For example:
$$-y^{\prime\prime}(s)+\frac1{\mathrm{cn}{(s\mid k^2)}}y(s)=0$$
where ...
7
votes
0answers
1k views
Integro-differential equation
I have to numerically solve a nonlinear partial integro-differential equation using Mathematica. This is my equation,
$$\frac{\partial y(x,t)}{\partial t}=\int_{-\infty}^\infty K_0(|x-u|) ...
6
votes
2answers
395 views
Creating Plots for a Family of Solutions
I am wondering how do you set the parameters appropriately for $a_n,\,\alpha,\,\text{and }b_n$ to plot the family of solution of:
$u_n(r,t) = [a_n\cos(k_n\alpha t)+b_n\sin(k_n\alpha t)]J_0(k_nr)$
...
6
votes
2answers
151 views
Catching only the first event in NDSolve EventLocator
I have a system of ODEs that I solve. During the integration process, there's an event that I want to catch, but I want to (a) continue the integration after the event and (b) catch only the first ...
6
votes
2answers
170 views
How to deal with zero in NDSolve in mathematica?
I would like to solve the following ODEs
$$\begin{cases} x'(t)&=y\\
y'(t)&=-y(t)/t-e^{x(t)},\\
x(0)&=1,\\y(0)&=0,
\end{cases}$$
(EDIT :
The second equation used to be $y'(t) = ...
6
votes
2answers
421 views
How to set the NDSolve method to LSODA
I notice that off all the Method options available for NDSolve[...], LSODA is invoked quite ...
6
votes
1answer
210 views
NDSolve and WhenEvent Causing Excess Work
When I use the following system
model = {x'[t] == x[t] (1 - x[t]) - x[t] y[t], y'[t] == x[t] y[t] - y[t], x[0] == 0.5, y[0] == 0.5}
with the ...
6
votes
2answers
333 views
Very long Refine/Solve batch run - is my code broken, or just complicated?
So I'm trying to run some Mathematica code in batch mode from my university cluster. Specifically, I'm trying to find the equilibria of a system of ordinary differential equations. Inspired by the ...
6
votes
1answer
464 views
Extracting coefficients from a partial differential equation
Frequently, I come across the following problem:
How to rewrite a complicated partial differential equation in a more clear way? I would like to create some order by collecting terms that are equal.
...
6
votes
1answer
387 views
vectorial ODE in mathematica with matrix exponentials
I want to solve the following equation in mathematica :
DSolve[{X'[t] == A.X[t], X[0] == ( {{0},{0}} )}, X[t], t]
It is a system of 2 ODEs coupled by the matrix A, ...
6
votes
1answer
60 views
6
votes
0answers
63 views
Modify NDSolve`StateData (if possible)
I am trying to solve a PDE that needs to be scaled constantly (refer to this). @andre suggests I modify NDSolve`StateData.
Now, the problem is, I'm not used to ...
6
votes
0answers
224 views
Modeling neural excitation with a non-linear differential equation
I think I have a special problem and I am not sure how to search for an answer, so I thought I would try here.
I am working with the so called FitzHugh-Nagumo model which describes very simple ...
6
votes
0answers
69 views
Return partial result when MemoryConstrained aborts NDSolve
I use NDSolve to solve a large set (~400) of coupled ODEs. Sometimes, the memory (~4GB) gets filled up, and my computer becomes impossible to work with, because it ...
5
votes
4answers
1k views
How can I plot the direction field for a differential equation?
I'd like to plot the graph of the direction field for a differential equation, to get a feel for it. I'm a novice, right now, when it comes to plotting in Mathematica, so I'm hoping that someone can ...
5
votes
3answers
767 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
2answers
411 views
3- dimensional plot of 2-dimensional systems of differential equations
Let's take this first example of a 2D output:
...
5
votes
2answers
172 views
Symmetry-finding packages
Where can I find the most up-to-date or whatever you consider to be the most useful symmetry-finding package for differential equations? I do not intend to restrict to, but would like to include ...
5
votes
1answer
701 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:
...