Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Exponential Function Programming

by okram (Monk)
on Nov 22, 2007 at 16:03 UTC ( #652405=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^4: Exponential Function Programming
by ikegami (Patriarch) on Nov 22, 2007 at 19:38 UTC

    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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-01-26 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (69 votes). Check out past polls.

    Notices?