Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
|
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2004, 10:43 PM
Authorized User
 
Join Date: Dec 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kaizer Send a message via Yahoo to kaizer
Default How to determine cube root of a number...

Hi All,

Just wanted to understand how to determine the cube root of a double value. I know that to determine square root we user Math.sqrt(num).

In fact how do we determine fourth root, fifth root (nth root)??

I'd be grateful if you could let me know.

Have a great day,
BTW, Happy new year to y'all.
Kaizer.

Kaizer Billimoria
Bangalore, India
__________________
Kaizer Billimoria
Bangalore, India
 
Old January 29th, 2004, 05:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This url might help:
http://p2p.wrox.com/post.asp?method=...10&FORUM_ID=20

Cheers

Martyn
 
Old January 29th, 2004, 06:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I don't know anything about Java, but if it's got the ability to calculate the log of a number then you can easily do nth roots like this:
take the log of the number you want to find the nth root of
divide the log by n
take the exponent (inverse log) of the result and that's the nth root

so in pseudo-code:
nthroot = exponent( log(number) / n )

hth
Phil
 
Old January 29th, 2004, 08:18 AM
Authorized User
 
Join Date: Dec 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kaizer Send a message via Yahoo to kaizer
Default

Hi Martyn, pgtips,

Martyn, your url takes me to a blank reply screen... humbly suggest you retry. Thanks in advance..

pgtips, i assume that when you say log you mean log (base 10) and not log (base 2). i believe you mean common logarithms? If that is the case yup java does have that log-ability...thanks for your inputs i'll try it out anyhow.

Have a great day.
kaizer.



Kaizer Billimoria
Bangalore, India
 
Old January 29th, 2004, 08:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I was actually thinking of the natural logarithm (base e), but it doesn't matter which base of log you use as long as you use the corresponding inverse log.
 
Old January 29th, 2004, 08:41 AM
Authorized User
 
Join Date: Dec 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kaizer Send a message via Yahoo to kaizer
Default


pgtips,
Thanks for the clarification. before i run along and try it out just one more clarification... what does n represent in your solution? is it the number itself or is it something else?
kaizer

Kaizer Billimoria
Bangalore, India
 
Old January 29th, 2004, 08:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I obviously posted the wrong link. Here's what I should have posted: http://mathforum.org/library/resource_types/applets/

Cheers

Martyn
 
Old January 29th, 2004, 08:57 AM
Authorized User
 
Join Date: Dec 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kaizer Send a message via Yahoo to kaizer
Default

Thanks Martyn
Appreciate it.
Kaizer

Kaizer Billimoria
Bangalore, India
 
Old January 29th, 2004, 09:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by kaizer


pgtips,
Thanks for the clarification. before i run along and try it out just one more clarification... what does n represent in your solution? is it the number itself or is it something else?
kaizer
You wanted the nth root, so that's what n represents. If you want the cube root, set n=3. The number itself is represented by the word 'number'.
 
Old January 30th, 2004, 12:22 AM
Authorized User
 
Join Date: Dec 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kaizer Send a message via Yahoo to kaizer
Default

thanks pgtips, sometimes the obvious is not so obvious.:D

have a great day,

kaizer

Kaizer Billimoria
Bangalore, India





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add perspectives in a Cube through C# mayafantasy ADO.NET 0 February 14th, 2007 09:33 AM
Assistance with Rollup and Cube Jinn SQL Server 2000 2 November 5th, 2006 10:18 AM
Accessing cube in VB ashwinik VB Components 1 January 25th, 2005 06:09 AM
OLAP Cube question Frank79 SQL Language 1 November 3rd, 2004 03:50 PM
Determine the number of data rows in a sheet ashu_gupta75 Excel VBA 1 July 31st, 2004 03:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.