Question: A question about type recognition

Let X1, ...XN  names of RandomVariable type and R a random variable defined as a function of  X1, ...XN.
(In Maple type(R, RandomVariable) returns false as R doesn't inherit the RandomVariable type.)

Given an expression of R I would like to determine if R is :

  • either a linear combination of X1, ...XN ,
    example R = a*X+ X+ 1
    (I know how to handle this situation)
     
  • or a linear combination of products of the X1, ...XN ,
    example R = a*X1*X+ b*X3
    (I feel I know how to handle this situation too)
     
  • or a linear combination of functions, or products of functions, of  X1, ...XN .
    example R = a*f(X1, X2) + b*X3*g(X4) + c*X1 + d*X1*X2
    (here I've no idea at all)

In the command hastype(R, some_type), how can I construct type some_type in order it returns an answer which matches the reqierements above?

RV_Type.mw

Thanks in advance for any suggestion

Please Wait...