Hello all :)(adsbygoogle = window.adsbygoogle || []).push({});

I have a matrix which I diagonalize giving me a list of eigenvalues lambda. Those are complex numbers.

After that, I calculate Exp[-lambda] and my code goes on.

For some parameters in my code, some lambdas have very large magnitude so that the exponentiation leads to quantities involving subnormal numbers (for Mathematica, those are numbers which are smaller than $MinMachineNumber). At this point, the code becomes _very_ slow (in addition to inherent hardware difficulties performing floating point operations with subnormal numbers, I understand Mathematica treat them in arbitrary precision !). After a _very_ long time though, Mathematica gives me the right answer (that can be said at least

To circumvent this situation, I apply the function If[Abs[#]<1.*^-50,0,#]& just after the exponentiation. So far, this seems to give me the right answer with no slowing down of the code.

One question though : I've chosen the value 1.*^-50 quite arbitrarily and I'm afraid that what I do might be a little bit “rough”.

Is there a rigorous and/or elegant way to avoid generation of subnormal numbers by the exponentiation?

Thanks in advance :)

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [Mathematica] Subnormal numbers handling

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**