News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

logarithms

Started by Alex777, January 25, 2006, 03:20:08 AM

Previous topic - Next topic

Alex777

I would really like to see a natural logarithm function added to the Math library.  Simulations (think wargames here) have a variety of uses for random numbers with a normal (bell) curve distribution.  The only formulae I have seen for generating such random numbers contain a natural log function.

kevin

Added LOG() + LOG10()  in PB1.12

Alex777

Wow!  That must be a record for quickest response to a feature request.  21 hours, ignoring time zones!  Thanks, Kevin!

Alex777

For those who are interested, the formula I have in my notebook for generating random numbers on a normal (bell) curve is:

RandNum# = (Sqrt(- 2 * LogN(Rnd(1))) * Cos(2 * PI# * Rnd(1))) * StandardDeviation# + Mean#

where LogN is the natural logarithm function and Rnd(1) returns a random float between 0 and 1.