Post Reply 
sqrt(1+i)
10-05-2016, 12:16 PM (This post was last modified: 10-05-2016 01:35 PM by roadrunner.)
Post: #13
RE: sqrt(1+i)
I created a little program to return the exact result for nested square roots of a complex number:

Code:

#pragma mode( separator(.,;) integer(h32) )

rootroot(a,n);

#cas
rootroot(a,n):=
BEGIN
 local x,y,ra,ia;
 ra:=RE(a);
 ia:=IM(a); 
 y=√(-ra+√(ra^2+ia^2))/√2;
 x=ia/(2*y);
 if n==1 then return x+y*i; end;
 return rootroot(x+y*i,n-1);
END;
#end


It crashes the emulator for values of n 6 or greater. Example:

rootroot(1+i,5) works but rootroot(1+i,6) crashes.

However, approx(rootroot(1+i,6)) returns the correct approximate answer, which tells me the program is returning a correct answer but the display can't handle it, and sits there with an hour glass in the corner.

What am I doing wrong?

-road
-edited a grammatical error
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
sqrt(1+i) - moonbeam - 09-26-2016, 12:35 PM
RE: sqrt(1+i) - parisse - 09-26-2016, 06:19 PM
RE: sqrt(1+i) - Helge Gabert - 09-26-2016, 08:33 PM
RE: sqrt(1+i) - dg1969 - 09-26-2016, 08:38 PM
RE: sqrt(1+i) - Helge Gabert - 09-27-2016, 04:19 AM
RE: sqrt(1+i) - Helge Gabert - 10-04-2016, 03:06 PM
RE: sqrt(1+i) - Helge Gabert - 10-04-2016, 04:50 PM
RE: sqrt(1+i) - roadrunner - 10-05-2016 12:16 PM
RE: sqrt(1+i) - Albert Chan - 07-04-2021, 03:50 PM
RE: sqrt(1+i) - roadrunner - 07-07-2021, 01:35 PM
RE: sqrt(1+i) - parisse - 10-05-2016, 01:52 PM
RE: sqrt(1+i) - DedeBarre - 10-05-2016, 05:54 PM
RE: sqrt(1+i) - Hlib - 07-05-2021, 05:31 PM



User(s) browsing this thread: 2 Guest(s)