We don't bite newbies here... much PerlMonks

Ln calculation

by dicty (Sexton)
 on Feb 05, 2013 at 17:39 UTC Need Help??
dicty has asked for the wisdom of the Perl Monks concerning the following question:

How to calculate Ln(X) with Perl? Is there any available Perl module for Ln calculation?

Thanks!

Dicty

Replies are listed 'Best First'.
Re: Ln calculation
by Arunbear (Prior) on Feb 05, 2013 at 17:45 UTC
Re: Ln calculation
by Old_Gray_Bear (Bishop) on Feb 05, 2013 at 19:22 UTC
What do you mean by "Ln(x)"? There are several polynomial series that fit that nomenclature:
1. Laguerre polynomials
2. Laurent polynomials
3. Littlewood polynomials
4. Legendre polynomials
5. etc
If you mean "ln(x)", then use the transformation rules to go from the log(x) (base 10) to ln(x) (base e).

----
I Go Back to Sleep, Now.

OGB

Re: Ln calculation
by spandox (Novice) on Feb 05, 2013 at 21:28 UTC
As a reply I will just copy a excerpt from the manual:

log EXPR

log

Returns the natural logarithm (base e) of EXPR. If EXPR is omitted, returns the log of \$_ .

To get the log of another base, use basic algebra: The base-N log of a number is equal to the natural log of that number divided by the natural log of N. For example:

```    sub log10 {
my \$n = shift;
return log(\$n)/log(10);
}

Create A New User
Node Status?
node history
Node Type: perlquestion [id://1017231]
Front-paged by Arunbear
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2018-04-21 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (81 votes). Check out past polls.

Notices?