Rules and patterns for dummies??




On Mon, 2 Nov 2009, Stavros Macrakis wrote:

< Nice demonstration. But problematic if X (etc.) is an expression, not just a variable, so you might want to declare X etc. to be variables.
< 
< The general case of expressions could also no doubt be fixed using patterns, but might be easier to handle using gradef.
< 
< ??????????????? -s
< 
 
Thanks, Stavros. I've modified the example as you suggest.

Leo

matchdeclare(X,symbolp,MU,symbolp,SIGMA,symbolp,DUMMY,symbolp);
tellsimpafter('diff(cdfn(X,MU,SIGMA),X,1),pdfn(X,MU,SIGMA));
tellsimpafter('diff(pdfn(X,MU,SIGMA),DUMMY,1),'diff(pdfn(X,MU,SIGMA),X,1)*diff(X,DUMMY)+'diff(pdfn(X,MU,SIGMA),MU,1)*diff(MU,DUMMY)+'diff(pdfn(X,MU,SIGMA),SIGMA,1)*diff(SIGM\
A,DUMMY));
gradef(pdfn(X,MU,SIGMA),
  -(X-MU)/SIGMA^2*pdfn(X,MU,SIGMA),
  -(X-MU)/SIGMA^2*pdfn(X,MU,SIGMA),
  (X-MU)^2/SIGMA^3*pdfn(X,MU,SIGMA));

u : pdfn(x,0,c)/c;
depends(c,t);
diff(u,t)-diff(u,x,2);
subst(c=sqrt(2*t),%);
ev(%,nouns);

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.