1. Mathematical Constants

On Fri, 12 Jun 1998, Jeff Zeitlin wrote:

> I was playing with some ideas and writing code for them, when I
> realized that I had no function exactly equivalent to exp(x),
> which returns the famous "e" raised to the x power.  Sure, this
> could be done by using the power() function and hard-coding "e" -
> but how far in do you remember "e"?
>
> So, I sat down with a piece of paper and a pen, and managed to
> derive the following function:
>
> global function exp(x)
>   return power(n,x/log(n))
> end function
>
> where n is _any_ positive number (strictly greater than zero) -
> except 1.0 exactly.
>
> If x is 1, you will get the value of "e" to the limits of
> Euphoria's precision in the power and log functions.

/Me slaps forehead at realisation of own utter stupidity.
/Me makes mental note to update mathbag.e.
/Me go away now. :)

Incidentally, I'm upgrading all of my mathematical libraries anyway, so
expect new versions coming over the horizon... (complex.e is still very
limited)

Carl

PS for those who don't have mathbag.e, Pi = arctan(1) * 4, and the ratio
of the sizes of a circle and a square of the same perimeter/circumference
= 1 / arctan(1)...

--
Carl R White
E-mail...: cyrek- at -bigfoot.com              / Remove the hyphens before
Finger...: crwhite- at -dcsun1.comp.brad.ac.uk \ mailing or fingering...
Url......: http://www.bigfoot.com/~cyrek/

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu