vnapply := proc (f) local ff, x, s, t, i, mflag; options `Maple Advisor Database 1.00 for Maple V Release 5`, `Copyright (c) 1998 by Robert B. Israel, all rights reserved`; ff := eval(f); if type(ff, table) then if type(ff,array) then mflag := array else mflag := table fi; ff := [op(op(ff))] fi; if nargs = 1 then ERROR(`variable name(s) missing`) fi; x := [args[2 .. nargs]]; for i to nargs-1 do t := x[i]; if type(t,constant) then ERROR(constant,t,`instead of variable name`) elif not type(t,symbol) then s := readlib(`tools/gensym`)(y.i); ff := subs(t = s,ff); x[i] := s fi od; ff:= `vnapply/convertD`(ff,x); if mflag = 'mflag' then subs(_VAR = op(x),_RES = ff, _VAR -> _RES) elif mflag = 'table' then subs(_VAR = op(x),_RES = op(ff), _VAR -> table(_RES)) else subs(_VAR = op(x),_RES = op(ff), _VAR -> array(_RES)) fi end; `vnapply/convertD` := proc(f, v) options `Maple Advisor Database 1.00 for Maple V Release 5`, `Copyright (c) 1998 by Robert B. Israel, all rights reserved`; if 2 < nargs then op( `vnapply/convertD`([args[1 .. nargs - 1]], args[nargs])) elif not (has(f, {diff, Diff}) and has(f, {op(v)})) then f elif type(f, specfunc(anything, {diff, Diff})) then convert(f, D) else map(`vnapply/convertD`, f, v) fi end;