MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Q: pattern and simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22271] Q: pattern and simplify
  • From: "H. J. Wang" <hjwang at ieas.econ.sinica.edu.tw>
  • Date: Mon, 21 Feb 2000 20:00:36 -0500 (EST)
  • Organization: Computing Center, Academia Sinica
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

   I'd like to know how to simply an expression that involves many
cumulative distribution functions (CDF) and probability density
functions
(PDF) of a standard normal variable.  In short, how can I make Mathematica
recognize the "pattern" of "2*mcdf[x]->mycdf[x]", so that it would
automatically substitute, say, "2*mcdf[x^2+1]" by "mycdf[x^2+1]"?  I'm
using Mathematica 3.0.

   The expression comes from a partial derivative of a function which
has some CDFs and PDFs.  The result returned by Mathematica is messy, and I
believe the expression can be greatly simplified if Mathematica can recognize
the CDF and PDF, and substitute them with appropriate symbols.  For
example, since a standard normal variable's CDF is "1/2*(1 +
Erf[x/Sqrt[2]])", expressions like "1 + Erf[x/Sqrt[2]]" should be
substitute with "2*myCDF[x]", for all function forms of x. Similarly,
"Exp[-(x^2)/2]" should be substituted with "Sqrt[2 Pi]*myPDF[x]".

   What I can do now is using something like

 D[ myfunc[x], x] /.{2*mcdf[x]->mycdf[x], Sqrt[2 Pi]*mpdf[-x]->mypdf[x]}

 but this works only for literal "x" in the expressions.  How can I
make Mathematica recognize the "pattern" of "2*mcdf[x]->mycdf[x]", so that it
would automatically translate, say, "2*mcdf[x^2+1]" into "mycdf[x^2+1]"?

   Thanks in advance.


  • Prev by Date: Re: Mathematica formulae as Word metafiles
  • Next by Date: Re: Front-end crashes in Redhat6.1
  • Previous by thread: Re: defining function on mathematica
  • Next by thread: [Fwd: Selecting numbers with all odd digits]