# Questions tagged [differential-equations]

Questions on the symbolic (DSolve, DifferentialRoot) and numerical (NDSolve) solutions of differential equations in Mathematica.

4,736 questions
Filter by
Sorted by
Tagged with
355 views

### Why is NDSolve solving in term of two 1st order ODE slower than 2nd order?

As mentioned in the documentation for NDSolve it's often convenient to reduce a 2nd order ODE to a system of first order equations. When I do this however I seem to see a significant speed reduction ...
1k views

### NDSolve runs out of memory

I need to solve a second order ODE numerically. The ODE depends on two parameters (a,b). Things work fine when 'a' is small, but for large 'a' the solutions are oscillating rapidly and Mathematica ...
15k 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 ...
2k 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 ...
3k views

### 1D Euler equations (fluid dynamics) with NDSolve

Is it possible to accurately solve the 1D Euler equations in Mathematica using NDSolve? For example, let us consider the Sod shock tube problem. Introduction to ...
944 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 ...
2k views

### Improving NDSolve speed for heavily stiff problems

Having looked around the intergoogles and Mathematica.SE, I thought I'd pose a question with a minimum working example. Here is the situation I am trying to improve: I am solving a 4th order non ...
14k views

### Integral equation numerical solution with NDSolve

I'm trying to solve something like: f[x] == Integrate[f[x]*g[x]] where g[x] is known and f[x]...
629 views

### Second Order Non Linear Differential Equation

I'm trying to solve the following differential equation numerically: ...
283 views

### tricky memoization

Let's say I have the NDSolve example for documentation involving splitting 2nd order into set of 1st order ODEs: ...
511 views

### Efficient way to perform elementary integration step with NDSolve internal method

I'm trying to tweak the NDSolve function to perform one elementary integration step (using some explicitly selected stepping algorithm via ...
2k views

### Solving a PDE containing DiracDelta

I want to get the answer from a PDE: \begin{align*} \frac{\partial \rho(r,t)}{\partial t}&=Dr^{-2}\frac{\partial}{\partial r}r^2h(r)e^{-U(r)}\frac{\partial}{\partial r}e^{U(r)}\rho(r,t)-\left(\...
847 views

### Solving Differential Equation depending on variables solved by NDSolve

How to solve a differential equation which consists of variables depending upon another differential equation?
170 views

### Using MaxStepFraction as ticks on plot

Is there any way I could use the MaxStepFraction (or grid size) as used in NDSolve in the example below as ticks on the 3d Plot? ...
719 views

### Replacing variable in an equation with an Interpolating function polynomial and plotting residual

I was trying to plot the residual for the solution of my PDE. However, I was unsure about a couple of things. I imported the data and created an Interpolation polynomial with ...
264 views

### EventLocator with LSODA?

Is the EventLocator option not compatible with LSODA on NDSolve. Below is what I tried to do ...
1k views

### How could I get the value of y[t] at each specific interpolation point?

sol = NDSolve[{Derivative[y][t] + Sin[y[t]] == 0, Derivative[y] == 0, y == 1}, y, {t, 0, 2}] the above-mentioned differential equations can be solved ...
301 views

### How can I get the value of a at “t=2.4985352432136567” in the following expression?

By running the following code: ...
2k 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 <...
6k views

### How to discretize a nonlinear PDE fast?

I wish to numerically solve the following PDE. Although there are some complete discussions for solving PDEs in tutorial/NDSolvePDE, there is no hint for the nonlinear case by discretization. Thus, I ...
3k views

### export data points from differential equation system?

I am solving a dynamical three equation system. Besides plotting the individual effects for each of the state variables in an array and in a tridimensional graph, I would like to export the data ...
2k views

### Problem while solving system of two second order non linear coupled differential equations using NDSolve function

I am a completely new to Mathematica, and I am sorry if this question is dumb. I have to solve a system of two second order non linear coupled differential equations (that I got from the Lagrangian ...
7k views

### DSolve gives complex function although the solution is a real one

I have a problem with the DSolve[] command in mathematica 8. Solving the the following 4th order differential equation spits out a complex solution although it should be a real one. The equation is: ...
1k 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 ...
342 views

### Particular solutions of a Differential Equation not evaluated in a given case

Below first case which gives particular solutions of an OED correctly: ...
8k 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, ...
2k views

### Manipulate a Differential Equation result

I want to Manipulate the result of Differential Equation like : ...
451 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 ...
2k views

### Interpreting the interpolating function and saving data to plot with external program

So far I have been solving non-linear pdes with NDSolve and then plotting the result with the in-built Plot3D and ...
8k views

### Change variables in differential expressions

I have a fairly complicated differential expression in terms of a variable r and two unknown functions of r, B[r] and n[r]. I want to do a Taylor expansion of this around r=infinity. I want to do this ...
2k views

### I failed to solve a set of one-dimension fluid mechanics PDEs with NDSolve

The fluid here has been assumed as single component perfect gas i.e. it obeys the equation $p=ρ R T$, the thermal conductivity is assumed as a constant, so the equation set is: ...
914 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 ...
2k views

### 3- dimensional plot of 2-dimensional systems of differential equations

Let's take this first example of a 2D output: ...
3k views

### Animation of Differential Equations from NDSolve with ParametricPlot3D and Evaluate

I have a system of differential equations (referred to as "s") and use NDSolve to obtain the solution. I substitute the interpolated functions for the original ...
1k 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}} )}, X[t], t] It is a system of 2 ODEs coupled by the matrix A, ...
1k views

### Can DSolve solve systems with unspecified function coefficients?

I am an economic research student with no previous experience with Mathematica, so please pardon me if my questions sounds really stupid. I am hoping to solve a system of nonlinear ODEs symbolically. ...
721 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 ...
2k views

### Fourier series of interpolating function result of NDSolve

I am having a tough time formulating the right question but here goes. I know that solving the pde as in here gives me an interpolating function. I understand that the interpolating function object ...
873 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 . ...
845 views

### I ran into an error when I was trying to solve a PDE with a piecewise initial condition by NDSolve

This is a very simple one-dimensional heat-conduct equation, the only special part of it is the piecewise initial condition: ...
48k 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 ...
6k 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 ...
6k views

### Function output from DSolve

I want to get a function as output form DSolve. For Example : sol = DSolve[{Q''[t] + 40 Q'[t] + 625 Q[t] == 100*Cos[10*t], Q == 0, Q' == 0}, Q[t], t] I ...
8k 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)$ ...
541 views

### Problem with Eventlocator Method for NDSolve

I want to solve the ode and plot the solution v[x] for different values of parameter a where ...
1k views

### Solution of numerical vector equation

Suppose I have a vector equation: Y'[t]==rhs[Y[t]] and Y==ConstantArray[0,n] where "rhs[Y[t]]" is a black box function ...
2k 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, ...
289 views

### Backward compatibility issues while DumpSaving Interpolation polynomials

I have bkwrd compatibility issues when I save my NDSolve result (which is an interpolating polynomia) using DumpSave from Mathematica 8 on Windows 7 and then try ...