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 - The Fusion of Science and Community**

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

Loading...

Similar Threads - Mathematica Subnormal numbers | Date |
---|---|

Mathematica Cannot do the integral of the Hyper-geometric function? | Mar 11, 2018 |

Mathematica Cannot Plot This Function in Mathematica | Feb 26, 2018 |

Mathematica While Loop in Mathematica | Feb 25, 2018 |

Mathematica Mathematica Real Part | Feb 24, 2018 |

Mathematica Number of extensions with Free Trial of Mathematica | Nov 6, 2017 |

**Physics Forums - The Fusion of Science and Community**