Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Exponential Function Programming

by Abulil (Initiate)
on Nov 22, 2007 at 15:57 UTC ( #652402=note: print w/replies, xml ) Need Help??

in reply to Re: Exponential Function Programming
in thread Exponential Function Programming

i got your program but what im looking for is how to do the basic function as it is for example i need to do X to the power of N, then divide it by N factorial and at the end add them all from (1 until the N number i entered) Thanks alot

Replies are listed 'Best First'.
Re^3: Exponential Function Programming
by okram (Monk) on Nov 22, 2007 at 16:03 UTC
    x to the power of n is done via: $x ** $n or
    sub x_power_n { my $x = shift; my $n = shift; my $result = $x; my $i = 1; while ($i < $n) { $result *= $x; $i++; } return $result; }
    You need to do this, though, "infinite" times, reason why I provided a parameter to "stop" after a certain time.

      That only works for integer exponents. The equation in the OP handles real numbers.

      Using exp and ln, it's possible to find any exponent.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://652402]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2022-08-11 12:07 GMT
Find Nodes?
    Voting Booth?

    No recent polls found