3

I try to iterate complex numbers ( also inf and zero) in Maxima CAS

I use rational function and it's derivative The only one attracting cycle is the period 3-cycle consisting of the points 0, −1, and infinity.

kill(all);
display2d:false;
ratprint : false; /* remove "rat :replaced " */



define(f(z), (1 -z^2)/(z^2));




F(z0):= block(
    [z],
    if is(z0 = 0) then  z: limit(f(z),z,0)
    elseif is(z0 = infinity) then z: limit(f(z),z,inf)
    else z:f(z0),
    
    return(z)
)$



define( dz(z), ratsimp(diff(f(z),z,1)));


Dz(z0) := block(

    [m],
    if is(z0 = 0) then m: limit(dz(z),z,0)
    elseif is(z0 = infinity) then m: limit(dz(z),z,inf)
    else m:dz(z0),
    
    return(m)





)$





GiveStability(z0, p):=block(
    [z,d],
    
    /* initial values */
    d : 1,
    z : z0,
    
    for i:1 thru p step 1 do (
    
        d : Dz(z)*d,    
        z: F(z),
        print("i = ", 0, "  d =",d, "  z = ", z)
    ),
    
    return (d)
)$







GiveStability(-1,3);

The simple computations work fine:

F(0);

(%o10) inf
(%i11) F(-1);

(%o11) 0
(%i12) F(infinity);

(%o12) -1
(%i13) Dz(0);

(%o13) infinity
(%i14) Dz(infinity);

(%o14) 0
(%i15) Dz(-1);

(%o15) 2

But when I try to use the las t functionL

a:GiveStability(-1,3);

i =  0   d = 2   z =  0 
expt: undefined: 0 to a negative exponent.
#0: dz(z=0)
#1: Dz(z0=0)
#2: GiveStability(z0=-1,p=3)
 -- an error. To debug this try: debugmode(true);

How should I do it properly ?

Adam
  • 1,254
  • 12
  • 25

0 Answers0