Question: how to use alternatives inside a patmatch?

I use patmatch to look for certain expression inside a larger expression.

I find sometimes I need to repeat the same code to check for  "... + ..."   and also ".... * .....", since I do not know to tell Maple to look for + or * in the same code. *Luckily, I do not have to check for "-" or "/" operators, since "+" match with "-" and "*" match with "/").

An example will make things more clear.

Suppose I want to see if sin(x)*sqrt(x*y) has sqrt(x*y) anywhere in it. So I first try

restart;
expr:= sin(x)*sqrt(x*y);
if patmatch(expr,a::anything+(b::anything*x*y)^(c::anything),'la') then
    assign(la);
    if c =1/2 or c=-1/2 then
       print("found sqrt(x*y)");
    else
       print("did not find sqrt(x*y)");
    fi;
 else
   print("did not find sqrt(x*y)");
 fi;

And this fails, since I used "+" inside the patmatch. Then I try '*" instead

if patmatch(expr,a::anything*(b::anything*x*y)^(c::anything),'la') then

And now it does match.

What I'd like to write, is something like this (which ofcourse does not work)

if patmatch(expr,a::anything (* or +) (b::anything*x*y)^(c::anything),'la') then

I looked at conditional in patmatch, but it does not seem to apply for the above.

Any suggestions?

Maple 2019.1 on windows 10

 

Please Wait...