detect sqrt in expression?



On Nov. 16, 2011, Stavros Macrakis wrote:
---------------
>Why are you using the internal function ?isinop -- it is in general a bad
>idea to use internal Maxima functions unless you are familiar with the Lisp
>code yourself.
>
>As for listofops, it depends how exactly you ended up defining that....
-------------------------
Dieter suggested the use of  ?isinop earlier in another context.
The current def of listofops is your code:

listofops(expr) := block([inflag:true], if mapatom(expr) then {} else
         adjoin(op(expr),xreduce(union,maplist(listofops,expr))))$

------------------
On Nov. 16, Dieter Kaiser wrote:
---------------------
>An alternativ is the Maxima function dispform, see the Maxima manual.
>This functions transforms an expression into the external representation
>which contains the SQRT function:
------------------------
Sometimes the dispform method does not work.
---------------------
(%i12) ?isinop(dispform(a*sqrt(a)),sqrt);

(%o12) false

(%i5) ?isinop(dispform(a*sqrt(a^2)),sqrt);

(%o5) false

(%i6) ?isinop(dispform(sqrt(a^2)),sqrt);

(%o6) false
------------------------------
Ted