Christian Wolinski

MaplePrimes Activity


These are replies submitted by Christian Wolinski

@Carl Love There is one in the previous post.

Output list from op Command

Also, can you tell me how the new ~ is interpreted typewise, ex: a ~= b?

 

 

 

 

restart;
N:=20000;

T:=table():
i:=1:
for i from i to N
do
   T[i]:=T[i+1]:
   if irem(i,100)=0 then
      T[i+1]:=1;
      evaln(T[1]);
   fi;   
od:
i,eval(T[1],i-1),eval(T[1],i);

U:=table():
i:=1:
for i from i to N
do
   U[i]:=U[i+1]:
   if irem(i,100)=0 then
      U[i+1]:=1;
      eval(U[1],N+1);
   fi;   
od:
i,eval(U[1],N),eval(U[1],N+1);;


gives:
N := 20000
20001   T[20001]   1
20001   U[20001]   1


evaln(expression) and eval(expression, length) make no obstacles. This is what I was anticipating.
eval(expression) is different indeed.

@roman_pearce Thank You. I do not understand what you mean when you say it is a "C function". I always believed Maple is database based, so to overcome common limits of linear storage, so why these limits? Is there a limit on recursion in the newer kernels?

Also see below. Why are all the limits observed distinct?

 

 

restart;

f:=unapply('cat(a,i),i');
g:=unapply('assign(f(i),f(i+1)),i');
 
i:=1:N:=5000;
for i from i to N  
do
   g(i);
   eval(a1);
od:
print(i);

for i from i to N  
do
   g(i);
   eval(a1);
od:
print(i);

gives:

N := 5000
Error, too many levels of recursion
2824
Error, too many levels of recursion
2824

@Art Kalb
type & typematch observe an expression, each type given identifies a single element in the exression.
patmatch observes the expression and subexpressions as aggregates, each type given may be identified by a composite of elements in the expression.

@Preben Alsholm "For i from i do" means "resume i". Initially I reused that loop to get the result I wanted. Now I've simply copied it twice.

@Carl Love I just saw this: PolynomialTools, Split. Thats what it is.

@Preben Alsholm Maple V, Release 4 (1996).


It looks like a coding slip up, easy fixed.

@Carl Love `evala/toprof` given a parameter containing RootOfs chooses one RootOf in the expression, not used in parameter of any other RootOfs or functions in the expression.

@Markiyan Hirnyk Oh, I see now, residue introduces radicals. That should not be. Can you keep it in RootOf notation, for example using series and coeff?

Still I do not know what has caused the divergence. Also, I seem to have somehow omitted an important element regarding use of RootOfs. I added seq((evala@Expand)(Y*Z^i), i = 0 .. d - 1).

 

alias(beta=RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2),alpha=RootOf(_Z^4+2*_Z^2+2));
C0 := rationalize(expand(2^(1/4)*exp(3/8*I*Pi)));
P := z^2 / (z^4 + 2*z^2 + 2)^2;
Pf := numer(P) / (evala@AFactor)(denom(P),z);
Pfs := select(`@`(evalb, 0 = evalc, evala, Norm, `+`), map2(op, 1, (roots@denom)(Pf)), -C0);


QRatpolyResidue := proc(Pf, z, Pfs, C0)
local ANS, R, X, Y, Z, W, Wn, A, k, d, i;
    A := NULL;
    for R in Pfs do
        #ANS := evala(residue(Pf, z = R));
        ANS := evala(coeff(series(Pf, z = R, 1 + degree(numer(Pf), z) + degree(denom(Pf), z)), z - R, -1));
        print(Residue, R, ANS);
        X := R - k;
        Y := X;
        W := NULL;
        Wn := NULL;
        while hastype(Y, RootOf) do
            Z := `evala/toprof`(Y);
            d := frontend(degree, [op(1, Z), _Z], [{Non}(function), {}]);
            W := W, seq((evala@Expand)(Y*Z^i), i = 0 .. d - 1);
            print(Degree, Z, d);
            Wn := Wn, Z;
            Y := (evala@Norm)(Y, {Z}, indets(Y, RootOf) minus {Z})
        od;
        print(Basis, W);
        print(Ordering, Wn);
        ANS := frontend(factor@simplify, [ANS, [W], [Wn, k]],
            [({Non}@map)(identical, {Wn}), {}]);
        print(Simplified, ANS);
        ANS := map(radnormal, subs(k = C0, ANS));
        print(Result, ANS);
        A := A, ANS
    od;
    A
end;

ANS := {QRatpolyResidue}(Pf, z, Pfs, C0);
ANS2 := {QRatpolyResidue}(Pf, z, Pfs, k), k = C0;

returns:

C0 := 2^(1/4)*(-1)^(3/8)
P := z^2/(z^4+2*z^2+2)^2
Pf := z^2/(z-beta)^2/(z+alpha)^2/(z+beta)^2/(z-alpha)^2
Pfs := [alpha, -beta, -alpha, beta]

Residue   alpha   -3/32*alpha^3-1/16*alpha
Degree   alpha   4
Basis   alpha-k   alpha^2-alpha*k   alpha^3-alpha^2*k   -2*alpha^2-2-alpha^3*k
Ordering   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   (1/32-3/32*I)*2^(1/4)*(-1)^(3/8)
Residue   -beta   -3/32*alpha^2*beta-1/8*beta
Degree   beta   2
Degree   alpha   4
Basis   -beta-k   alpha^2+2-beta*k   alpha^2+2+k^2   alpha^3+2*alpha+alpha*k^2
  -2+alpha^2*k^2   -2*alpha+alpha^3*k^2
Ordering   beta   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   (1/32-3/32*I)*2^(1/4)*(-1)^(3/8)
Residue   -alpha   3/32*alpha^3+1/16*alpha
Degree   alpha   4
Basis   -alpha-k   -alpha^2-alpha*k   -alpha^3-alpha^2*k   2*alpha^2+2-alpha^3
*k
Ordering   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   (1/32-3/32*I)*2^(1/4)*(-1)^(3/8)
Residue   beta   3/32*alpha^2*beta+1/8*beta
Degree   beta   2
Degree   alpha   4
Basis   beta-k   -alpha^2-2-beta*k   alpha^2+2+k^2   alpha^3+2*alpha+alpha*k^2
  -2+alpha^2*k^2   -2*alpha+alpha^3*k^2
Ordering   beta   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   (1/32-3/32*I)*2^(1/4)*(-1)^(3/8)
ANS := {(1/32-3/32*I)*2^(1/4)*(-1)^(3/8)}
Residue   alpha   -3/32*alpha^3-1/16*alpha
Degree   alpha   4
Basis   alpha-k   alpha^2-alpha*k   alpha^3-alpha^2*k   -2*alpha^2-2-alpha^3*k
Ordering   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   -1/32*k*(2+3*k^2)
Residue   -beta   -3/32*alpha^2*beta-1/8*beta
Degree   beta   2
Degree   alpha   4
Basis   -beta-k   alpha^2+2-beta*k   alpha^2+2+k^2   alpha^3+2*alpha+alpha*k^2
  -2+alpha^2*k^2   -2*alpha+alpha^3*k^2
Ordering   beta   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   -1/32*k*(2+3*k^2)
Residue   -alpha   3/32*alpha^3+1/16*alpha
Degree   alpha   4
Basis   -alpha-k   -alpha^2-alpha*k   -alpha^3-alpha^2*k   2*alpha^2+2-alpha^3
*k
Ordering   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   -1/32*k*(2+3*k^2)
Residue   beta   3/32*alpha^2*beta+1/8*beta
Degree   beta   2
Degree   alpha   4
Basis   beta-k   -alpha^2-2-beta*k   alpha^2+2+k^2   alpha^3+2*alpha+alpha*k^2
  -2+alpha^2*k^2   -2*alpha+alpha^3*k^2
Ordering   beta   alpha
Simplified   -1/32*k*(2+3*k^2)
Result   -1/32*k*(2+3*k^2)
ANS2 := {-1/32*k*(2+3*k^2)}, k = 2^(1/4)*(-1)^(3/8)

@Carl Love What does `evala/toprof`(Pf); `evala/toprof`(indets(Pf,RootOf)); return? ANS2 should contain variable k. If it does not then what would explain this? Also I added a print command.

I am editing too much. The codes work flawlessly in Maple V R4. I wonder in which version the discontinuity occurs.

@Markiyan Hirnyk It appears _EnvExplicit:=true; is being used, converting all RootOfs into radicals. Lets see if _EnvExplicit:=false; would change that.

@Carl Love roots or evala@Roots or another? Which is better?

@Carl Love Thank you for your help. It appears roots command does not succeed. I'll change it to evala@Roots.

I ask, what command would you use to obtain roots of a factored polynomial?

@Carl Love I suppose split is the same thing as evala@AFactor. I tested it. It seems to work. I already edited my original answer.

4 5 6 7 8 9 Page 6 of 9