Christian Wolinski

MaplePrimes Activity


These are answers submitted by Christian Wolinski

Use this:

sol := solve([seq(E[i] = 0, i = 1 .. 5)], [S, H, r, E, P]):
sol := collect(evala(sol), [RootOf, mu, a, b], factor):
alias(Q = indets(sol, RootOf)[1]):
subs(Q = q, sol);
collect(collect((evala@Norm)(q - Q), q, normal), [q, nu, a, b] ,factor);

Also notice that you are using E as a table (defining E[1..5]) and as variable in equations. This will fail you eventually.


Thumb if You like.

Lookup primpart, content. These can be used to separate variables from coefficients of a monomial. Likewise you could use coeff.

Example
 

K := proc(monomials :: set, V :: {set, list})
   description "Test if the set is a set of multiples of the same monomial in variables V";
   map((x -> primpart(collect(x, V, distributed), V)), monomials);
   if not type(`%`, set(monomial)) then error "Input is not a set of monomials"; fi;
   evalb(nops(`%`) = 1);
end;

K({3*(a+b)*(a-b)+3*b^2, q*a^2}, {a, b});
K({3*(a+b)*(a-b)+3*b^2, q*a^2}, {q});


Thumb if You like.

 

S := remove(type, remove(has, indets(B, function), diff), trig);
frontend(proc(E, S) local V; [coeffs(collect(E, S, distributed), S, 'V')], [V]; end, [B, S], [{Non(function)}, {}]):
V := collect([%], [diff], distributed, factor);

or like this:

S := remove(type, indets(B, function), trig);
frontend(proc(E, S) local V; [coeffs(collect(E, S, distributed), S, 'V')], [V]; end, [B, S], [{Non(function)}, {}]):
V := collect([%], [diff], distributed, factor);
W := ListTools[Classify](proc(E) op(0, convert(E[2], D)); indets(%, name); end, zip(() -> [args], op(V))):
W := map(proc(S) [op](S); map2(map2, op, [1,2], %) end, W);

Thumb if You like.

 

Read the title.
                      

Comonly you would use evalc under assuming real.

For example:
evalc(%) assuming real, R+r*cos(theta)>0, r>0;

Thumb if You like.

The command roots was specifically designed for finding rational roots:
 

P:=`*`('(x*rand(-99..99)()+rand(-99..99)())^op(rand(1..4)(),[1$3,2])'$8)*
   `*`('(x^2*rand(-99..99)()+rand(-99..99)())^op(rand(1..4)(),[1$3,2])'$8);
expand(P);
roots(expand(P));


Thumb if You like.

Note: the use of has can be weak.

seq(i = nops(ListTools[Classify](has, Set, i)[true]), i = (`union`@op)(Set));

seq(i = nops(ListTools[Classify]((s,i)->member(i,s), Set, i)[true]), i = (`union`@op)(Set));


This one looks cleanest:

map((i->i) = ListTools[Occurrences], ((`union`@op) , [op])(Set), member);


Without ListTools:

F:=(Set::{set,list}({set,list})) -> map((i->i) = (i-> (nops@select)(has, Set, i)), ({op}@map)(op, Set));
F(Set);

F:=(Set::{set,list}({set,list})) -> map((i->i) = (i-> (nops@select)((s,i)->member(i,s), Set, i)), ({op}@map)(op, Set));
F(Set);

Thumb if You like.

This is the way to these substitutions, although I do not approve of using eval:

expression_ABC:=eval(expression,[x^(-(3*c)/2 + a/2 + 1/2)*(c + a + 1)*b^(-(3*c + a + 1)/(2*c))=A,c*x^(a/2 + 1/2 - c/2)*b^(-(c + a + 1)/(2*c))=B]);
simplify(%, [((a + 1)*(c + a + 1)*(2*c + a + 1))=C]);

Thumb if You like.

There was a typo in your code.

MapleQuestions_227394.mw

Thumb if You like.

I would expect LCState is a variable that belongs the module containing the GetState proc. That would be one of the modules:  RandomTools:-LinearCongruence and RandomTools.

MapleQuestions_227381.mw

I do not have the shoot library. Where is it stored?

Perhaps this gives the correct values:

F := proc(f) Re(evalf(convert(f, Sum), 20)); end proc;
seq(sum(((binomial(2*k, k))/(4^k))^d, k = 1 .. infinity), d = [3, 4, 5, 6]);
F~([%]);

Thumb if You like.

[seq(convert(X, set), X = n__a)];
map(convert, [n__a], set);

or

[seq(convert(X, list), X = n__a)];
map(convert, [n__a], list);

The anser appears to be:
E__fv = -48.46001884+(6.283185307*I)*n, E__fv = -46.13690406+3.141592654*I+(6.283185307*I)*n;
So the first one gives
E__fv = -48.46001884;
as the one real solution.


Thumb if you like.

 

 frontend(collect, [eqq, [d+H, H, A, a], factor], [({Non})(identical(d+H)), {}]);
 subs(`d+H` = d+H, collect(simplify(eqq, [d+H-`d+H`], [d, `d+H`]), [`d+H`, H, A, a], factor));


Thumb if You like.

Edit:
I also managed to obtain this form:

Full Sized


https://www.mapleprimes.com/DocumentFiles/260082_Answer/Annotation_2019-06-19_230004.png

First 12 13 14 15 16 17 18 Page 14 of 21