Arguments of operatorp



On 19/06/2012 4:15 PM, J?rome Laurens wrote:
> how would I walk an expression to find the integrate and diff operators ?
This routine from share/contrib/diffequations/contrib_ode.mac finds the 
first occurrence of a derivative

/* recurse through expression eq looking for a derivative
    Return the derivative if found, false otherwise
  */
ode_deriv(eq) := block(
   [u,v:false],
   eq:expand(eq),
   if atom(eq) then return(false),
   if operatorp(eq,nounify('diff)) then return(eq),
   for u in eq do
     (if (v:ode_deriv(u))#false then return(true)),
   v
)$