Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 579 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Higher Index Roots #464019
01/14/17 06:16
01/14/17 06:16
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I am looking for a way to calculate the root of a number beyond the square root. For instance, how would I calculate the cube-root of a number? Or the fourth root? etc...

I found sqrt(), pow(), exp() and log() in the manual, but none of these seem to do what I'm looking for.

Re: Higher Index Roots [Re: Dooley] #464020
01/14/17 06:38
01/14/17 06:38
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain


Re: Higher Index Roots [Re: txesmi] #464042
01/16/17 16:39
01/16/17 16:39
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The n-th root of a number x can be written as x^(1.0/n), so just put that in the second argument of your pow() function.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Higher Index Roots [Re: Superku] #464074
01/20/17 06:42
01/20/17 06:42
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Thanks guys.
I found this function on another thread and modified it a bit:

Quote:
function Root(var num, var expo)
{
return(exp(log(num)/expo));
}

root_number = Root(2,12);


So, if I plug any two numbers into the Root function it will give me the number that multiplies by itself "expo" times to make "num."

i.e. 1.05946309436 is the twelfth root of two. So if you multiply it by itself 12 times, you get 2. This equation can get this number if you plug in 2 as num and 12 as expo. You could do this with any two numbers.

Higher math is difficult for me, so this is a great forum to have! If anyone can use this equation for something, please go ahead.

Last edited by Dooley; 01/20/17 06:42.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1