Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

nth root in Perl?

Posted on 2003-03-11
3
Medium Priority
?
427 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
  • 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

Independent Software Vendors: 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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

564 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