Question: How to select an undocumented name generated by RootOf or solve?

Even though this question is related to this one 
https://www.mapleprimes.com/questions/234781-How-Can-I-Get-The-Desired-Answer-From-solve
feel it is about a different issue. If any of you feel otherwise feel free to move it to the original one.

In this notional example  the name _Z1~ is created by RootOf: and here is an ad hoc way to catch it.

restart:

f := RootOf(cos(x)-z, x):
u := indets(f, name);
s := series(f, z):
v := remove(type, indets(s, name), constant);
w := v minus u

{z}

 

{_Z1, z}

 

{_Z1}

(1)

 

Download Example_1.mw

In this more complex example an assumption must be made on M to obtain ths desired solution g and the previous method no longer works.

restart

f := 10*cos((-1+t)/sqrt(1+M))-10*cos(t/sqrt(1+M)):
assume(M::nonnegative):
u := indets(f, name);
g := solve({diff(f, t), t>0 }, t, allsolutions)[1][1];
v := remove(type, indets(rhs(g), name), constant);
w := v minus u

{M, t}

 

t = Pi*_Z2*(1+M)^(1/2)-arctan((cos(1/(1+M)^(1/2))+1)/sin(1/(1+M)^(1/2)))*(1+M)^(1/2)

 

{M, _Z2}

 

{M, _Z2}

(1)

 

Download Example_2.mw

I have tried using select to "capture" the name _Z2~ but I can't know how to distinguish M~ from _Z2~ (is there a type which could be used?).

Can you helpm fix this?
TIA

Please Wait...