# MaxSteps and Computing time issue for Solving Differential equation in Mathematica

When we solve differential equation numerically using NDSolve then sometimes we get error like NDSolve::mxst: Maximum steps reached

According to Mathematica docs the solution is to increase MaxSteps. For example if you used MaxSteps -> 100 and limit of x 0 to 100 but Mathematica calculated up to the x=50 then increasing steps MaxSteps -> 200 will solve your problem.

My problem is what i got from mathematica is -

During evaluation of In[212]:= NDSolve::mxst:
Maximum number of 10000 steps reached
at the point x == 2.1685790754404513*^-14.


So even if i want to got from limit 0 to 2 for x then my steps should be 10^14 times larger. It will take a huge huge computing time. How much it may take for core i3 processor? Is there any other way to compute quickly or solve this problem of maxsteps in any other way?

My ODE:

v[x_] := {v1[x], v2[x]} ;
ini = v[0] == {1, 0};
soln = NDSolve[LogicalExpand[I v'[x] == H.v[x] && ini], {v1, v2}, {x, x1, x2}]


where H is matrix

-
Can you give the actual problem you're trying to solve? What you've mentioned isn't sufficient for us to help you. –  Ｊ. Ｍ. Jan 28 '12 at 12:25
@J.M. Thanks. But actual problem is large. Other part of the problem is actually about the construction and taking Matrix H to its final form. without construction of H its just these tree lines of codes and plotting. Then... I need to send you the whole file you need see actual thing. –  Mush Jan 28 '12 at 12:37
Then I suppose you could upload your Mathematica notebook to some file host like Sendspace or iFile. –  Ｊ. Ｍ. Jan 28 '12 at 12:45
The largest eigenvalue of H is about 7.4*10^16 which would mean that you'll get a highly oscillatory solution with a wavelength of about 10^-16 so I guess you would need a step size < 10^-18 or so (and you would need to worry about PrecisionGoal and WorkingPrecision). –  Heike Jan 28 '12 at 15:43
Thank you @Heike –  Mush Jan 28 '12 at 16:24

NDSolve uses adaptive methods to obtain a good solution. It dynamically changes the step size during integration.

I recommend you take a look at the Advanced Numerical Differential Equation Solving tutorial (ODE section), which has a very detailed description of how NDSolve work, what methods are available, and how you can tweak them.

NDSolve[..., Method -> {"FixedStep", Method -> "ExplicitEuler"}, StartingStepSize ->  ... ]
`