MathGroup Archive 2005

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

Search the Archive

Re: Use of Mathematica with Rule-based Equation Derivations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61932] Re: Use of Mathematica with Rule-based Equation Derivations
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 5 Nov 2005 01:52:14 -0500 (EST)
  • References: <dkfd8o$etv$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

mmorriss at gcn.ou.edu wrote:
> Hi All - I'm a many-year user of mathematica, but have always had one
> particular problem with it that I may have just simply missed reading
> about.
> 
> Mathematica Version: 5.2
> 
> Problem: I would like to develop a set of re-rewite rules to apply to the
> Expected Value operator.  For example:
> 
> E[a x] = a E[x]  a -> constant, x -> variable
> E[b + f[x]] = b + E[f[x]] , etc.
> 
> The issue is how does one using Mathematica distinguish a 'constant
> variable (i.e. a and b)' from a variable 'variable' (i.e. 'x')? The head
> of a, b and x is 'Symbol' and neither a, b nor x contain a number so I
> can't use a_?NumberQ to identify it as a constant.
> 
> This actually goes to the wider question of how does one use Mathematica
> for symbolic derviations where numbers are not actually substituted in the
> derviation?
> 
> E.g. E[a + E[b x]] /. Rule2
>    out= a + b E[x] etc.
> 
> Thanks all - Mark Morrissey
> University of Oklahoma
> 
> 
Hello,

It seems to me that in your notation E[f[a,x]], x has a role as a dummy 
variable. Since Mathematica can't possible be expected to know that 
fact, it might make sense to use a notation that makes this explicit. 
Suppose you make x a second argument (a subscript might look neater). 
Also, since E is a built in symbol, let us use Ex (again, a script E 
might look neater)

Ex[a x, x] /. Ex[m_ n_, x_] :> m Ex[n, x] /; FreeQ[m, x]

a Ex[x,x]

This will simplify any expectation value of a product where one 
component is a constant expression of any sort. Note that it will 
simplify Ex[x a,x] just as well because Times is commutative.

David Bailey
http://www.dbaileyconsultancy.co.uk




  • Prev by Date: Re: Mathematica GuideBooks
  • Next by Date: Re: Use of Mathematica with Rule-based Equation Derivations
  • Previous by thread: Re: Use of Mathematica with Rule-based Equation Derivations
  • Next by thread: Re: Use of Mathematica with Rule-based Equation Derivations