Recently I faced the following issue.
I calculated the vector-function
,
which later I use as a right part of the system of ODEs for solving some boundary value problem with the use of DSolve function. Unexpectedly the message
No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.
appears. Previously I solved similar problems (of the same form and same order) without any issues. I suspect that a lot of terms like 0.x10^-45 cause the issue, because DSolve tries to handle all of them.
Please, suggest me the way for elimination these parasitic terms.
Hi,
Try to use Simplify[], that should simplify any expression of the form 0*… to 0.
Also Chop[] will do what you need but only for real numbers.
As it is seen from your vector you can also use the following idea:
expr1 = 1.*10^(-2) + 0.5 t + 10. Cosh[1. t] + 12. Sin[112. t]
expr2 = 1.*10^(-700) + 0.5 t + 10. Cosh[1. t]
expr3 = 1.*10^(-700) + 0.123*10^-1232 t + 10. Cosh[1. t]
expr4 = 1.*10^(-700) + 0.123*10^-1232 t + 1.*10^-242*Cosh[1. t]
Total[Chop[Apply[List, expr1] /. a_ b_ /; a < 10^-14 -> 0]]
Total[Chop[Apply[List, expr2] /. a_ b_ /; a < 10^-14 -> 0]]
Total[Chop[Apply[List, expr3] /. a_ b_ /; a < 10^-14 -> 0]]
Total[Chop[Apply[List, expr4] /. a_ b_ /; a < 10^-14 -> 0]]
I.M.
Thanks, Ivan. Chop[] function helped to solve the issue with small terms, but the issue with crash of DSolve remains. I’ll dedicate next question to it.
Output of the form 0. x 10^-45 usually indicates a loss of precision. If you’re using DSolve, you might do better if you could rewrite the problem with exact or symbolic coefficients.