?
Solved

nth root in Perl?

Posted on 2003-03-11
3
Medium Priority
?
388 Views
Last Modified: 2012-06-27
Hi,

I want to get the nth root of a number in perl. I know the squared root function exists but i need to perform an operation that requires the nth root.

thanks

java gurl

*the girl of your dreams*
0
Comment
Question by:java_gurl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Expert Comment

by:pjedmond
ID: 8113229
Easy:)
--------------------------X8---------------------
#!/usr/bin/perl

my $number=8;
my $nth_root=3;

$log_e = log($number);
$answer=exp ($log_e/$nth_root);

print "$nth_root th root of $number is $answer\n";
--------------------------X8---------------------
0
 
LVL 22

Accepted Solution

by:
pjedmond earned 200 total points
ID: 8113246
Basically it uses a number of the properties of logs to find out the answer:)


...and if you really are the girl of my dreams then email me;)

(support@cb.ws)

0
 

Author Comment

by:java_gurl
ID: 8114038
thanks a million!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question