Christian Wolinski

MaplePrimes Activity


These are answers submitted by Christian Wolinski

The following is excessive, but it does achieve the goal:

 

e:= g^((2*(-sigma+k+1))/(-1+sigma))-tau^2;
`@`(factor, x -> combine(x, power), factor, expand)(e);

This appears to be a frequent question. This is a link to my previous response:
http://www.mapleprimes.com/questions/207267-Coefficients-Of-Differential-Polynomial#comment223370

 

function_coeffs := proc(A, v::set(name))
local S, T;
   S := indets(A, {function});
   S := select(has, S, v);
   T := {Non(map(identical, S))};
   frontend(proc(A, S) local V; [coeffs](collect(A, S, distributed), S, 'V'), [V] end proc, [A, S union v], [T, {}])
end proc;

fec:=(A,f,t)->frontend(function_coeffs,[A,f],[{Non(t)},{}]);

A:=diff(g(z),x)*g(z)^3+diff(g(z),z,z)*g(z)^4+diff(g(z),z,z,z)*g(z)^5+diff(g(z),z)/g(z)^2;
function_coeffs(A,{g});
fec(A,{g},specfunc(anything,diff));

Try this substitution. Does it produce a different outcome?

 

restart;
assume(U,complex,V,complex,x,complex);
S := {b = U*(1+V^2)/V, a = U*(V-1)*(V+1)/V};
A:=diff(y(x),x)=a*cos(y(x))+b;
B:=subs(S,A);
dsolve(B,y(x));

Radical and multivariable algebraic statements are opportune to cause obstruction, so perhaps you should prepare your constants.

I have aligned the grid with t and t+x. Perhaps this configuration is to your liking:

 

 

restart;
x:='x':y:=0:z:=0:
f:=unapply(abs(2*(-exp(-t-x-z)+exp(t+x+z))/(exp(-t-x-z)+tanh((1+I)*t+(1/2-1/2*I)*y+z)+exp(t+x+z))),t,x);
g:=(u,v)->(u,v-u);
(f@g)(u,v);
p1:=plot3d([g,f@g](u,v),u=-5..5,v=-10..10,numpoints=20000):
mp:=proc() global p1; plots[display](p1,'args'); end proc:
plots[display](
mp(style=contour,thickness=2,shading=XY,contours=[seq(i/4,i=0..12)]),
mp(style=point,symbol=POINT,color=blue),
mp(style=patchnogrid,shading=XYZ,lightmodel=light3),
scaling=constrained,orientation=[120,45],projection=0.1,axes=boxed,view=[-6..6,-6..6,0..3]);

Considering this is a residue of a rational polynomial with coefficients in Q, at a singular point.

Edited:
used evala@AFactor instead of split
corrected use of roots
replaced evala@residue with evala@coeff@series
added seq to RootOf definition

 

 

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;
    _EnvExplicit := false;
    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(R, Residue, 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);
            Wn := Wn, Z;
            Y := (evala@Norm)(Y, {Z}, indets(Y, RootOf) minus {Z})

        end do;
        ANS := frontend(factor@simplify, [ANS, [W], [Wn, k]],
            [({Non}@map)(identical, {Wn}), {}]);
        A := A, map(evalc@rationalize, subs(k = C0, ANS))
    end do;
    A
end proc:

 

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+RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2))^2/(RootOf(_Z^4+2*_Z^2+2)+
z)^2/(z-RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2))^2/(z-RootOf(_Z^4+2*_Z^2+2))^2
Pfs := [RootOf(_Z^4+2*_Z^2+2), RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2), -RootOf
(_Z^4+2*_Z^2+2), -RootOf(RootOf(_Z^4+2*_Z^2+2)^2+_Z^2+2)]

ANS := {(1/32-3/32*I)*2^(1/4)*(1/2*(2-2^(1/2))^(1/2)+1/2*I*(2+2^(1/2))^(1/2))}
ANS2 := {-1/32*k*(2+3*k^2)}, k = 2^(1/4)*(-1)^(3/8)

 

 

   But for the RootOfs, simplify/mod2 would have been sufficient, so I suggest use frontend and simplify, which are meant for this task.

 

cmod2:=`@`(
f -> collect(f mod 2, RootOf),
(f, n) -> `if`(n = [], f, frontend(simplify, [f, map(x -> x^2 - x, n), n], [{Non}(function), {}])),
f -> (f, [op](select(type, frontend(indets, [f], [{Non}(function), {}]), name))),
f -> Expand(f) mod 2
):
alias(alpha = RootOf(x^4 + x + 1));
z := add(a[i] * alpha^i, i = 0 .. 3);
seq(cmod2(z^i), i = 0 .. 15);

Counterexamples ?

@Carl Love There is no GB? I am certain there would be an equivalent. It is grobner basis modulo p.

 

 

with(share);

readshare(GB,'`mod`');
#readshare( `mod/GB` ):
L := 1+X+X^6+X^7+X^8, (X^3+X+1)*Q+Q^3+(X^7+X^6+X^4+1)*Q^2+X^7+X^6+X^4+X^3+X^2+X+1;
GB([L], [X, Q], plex) mod 2;

Results:

[X+Q^22+Q^21+Q^19+Q^17+Q^16+Q^15+Q^14+Q^9+Q^7+Q^6+Q^5+Q^2+Q, Q^19+1+Q^5+Q^21+Q^8+Q^10+Q^9+Q^12+Q^14+Q^24+Q^23+Q^13+Q^6+Q^16+Q^3+Q+Q^22]

The operator D is indexed.(and not parameterized) meaning it is a selector.

Consider:

 

D[1](f):=g;
D[1](g):=h;
D[1,1](f):=z;

and

 

(D[1]@@2=D[1,1])(f);

is a new statement altogether and not a simplification.

 

A:=(-(1/2)*ib-(1/2)*ia+ic)*vc+(-(1/2)*ia-(1/2)*ic+ib)*vb+(-(1/2)*ic-(1/2)*ib+ia)*va;
B:=va+vb+vc:
C:=ia+ib+ic:
collect(A+1/2*B*C,indets(C));

I've just inputted this command and the return was NULL response:

 

isolve({x>3/2,x<5/2},{x});

Reading from the help file "The procedure isolve solves the equations in eqns over the integers. It solves for all of the indeterminates occurring in the equations."

Try the code below and consider what it implies:

 

A := -144*z-44+12*sqrt(-12*z^3+96*z^2+24*z-15);;
B := 1728*z^2+2304*z+1024+432*z^3;


rationalize(B/A);

q := rationalize(B/A)*A-B;
evalb(rationalize(q)=0);

 

member(0,map(`@`(radnormal,unapply(A,z)),{solve}(B)));

Is the following at all close to the anticipated solution?Result of solve.

Try this code:

 

OperandsTable := proc()
local F;
    F := proc(A)
        local i, j, B;
            j := args[2 .. -1];
            if nops(A) = 1 then
                B := op(1, 'A');
                if type(B, '{indexed, list, set, `*`, `+`, `^`, function, relation, boolean, `::`, `..`, `.`, uneval}') then
                    j = eval(B, 1), procname([op(0, B)], j, 0), seq(procname([op(i, B)], j, i), i = 1 .. nops(B))
                else j = eval(B, 1)
                end if
            else j = op('A'), seq(procname([op(i, 'A')], j, i), i = 1 .. nops(A))
            end if
        end proc;
    table([F(['args'])])
end proc;

An example:

 

K:=OperandsTable('map((x->x)=SetPartitions,[op](5..6,remove(has,combinat[partition](10),1)))'):
eval(K[],1);
leafsindices:=remove(proc(L,S) hastype(S,[op(L),anything]) end,{indices}(K)$2):
leafs:=map((S,T)->eval(T[op(S)],1),leafsindices,K);
leafs_parameters:=map((S,T)->`if`( op(-1,S)=0 , NULL, eval(T[op(S)],1)),leafsindices,K);
leafs_operand0:=map((S,T)->`if`( op(-1,S)=0 , eval(T[op(S)],1), NULL),leafsindices,K);
all_operand0indices:=select(S->evalb(nops(S)>0 and op(-1,S)=0),{indices}(K)):
all_operand0:=map((S,T)->eval(T[op(S)],1),all_operand0indices,K);

Let me know if there is anything amiss.

 

Two versions of same but with small distinctions:

 

F := proc(N::nonnegint, lo::nonnegint, hi::nonnegint) local q, A, i; A := 'irem(q, 2, 'q')'; irem(N, 2^lo, 'q'), [seq(eval(A), i = lo .. hi)], q end proc;

or this:

 

F  := proc(N::nonnegint, range::(nonnegint .. nonnegint))
local q, A, i;
    A := unapply('irem(q, 2, 'q'), i'); irem(N, 2^lhs(range), 'q'), map(A, [`$`(range)]), q
end proc;


So F(8,0..7)[2]; gives [0, 0, 0, 1, 0, 0, 0, 0]

and F(11+5*256+7*256*256,8..15); gives 11, [1, 0, 1, 0, 0, 0, 0, 0], 7

Lookup ?member. This function is intended to compare expressions. In your example you are looking for matrices. The difference here is a matrx is a storage and identified by a reference and not its contents. On the other hand type listlist is an expression.

This code will match matrices only if the expressions of the elements are a match. This maybe sufficient for matrices of constants. Otherwise lookup ?iszero, ?Normalizer and test the difference.

fl:=a->convert(a,listlist):Jfl:=map(fl,J):
for i to 1 do for j to 2 do a := J[i].J[j]; member(fl(a), Jfl, 'k'); print(i, j, k, a, whattype(a)) end do end do;

 

First 17 18 19 20 21 22 Page 19 of 22