vrastil / FastSim

Other
0 stars 1 forks source link

Aa exp handling #13

Closed vrastil closed 7 years ago

vrastil commented 7 years ago

Solved problems with overflowing by not evaluating the exponential directly but by storing the highest exponent and writing the sum as:

\sum{\exp{x_i}} = \exp{x_max} \sum{exp{x_i - x_max}}

Terms in the sum are always less (or equal) to 1 (by definition) and are evaluated only if its contribution to the sum is significant -- for now that means if they are greater than 1e-8. This accuracy will be a free parameter of simulations in the future.