MathGroup Archive 2006

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

Search the Archive

A quick question regarding expectation rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63878] A quick question regarding expectation rules
  • From: "Mark Morrissey" <mmorriss at ou.edu>
  • Date: Fri, 20 Jan 2006 04:32:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Folks - A couple of months ago a lot of you helped me out with designing
a set of rules to apply to expectation operator given 'variables' and
'constants'. Below is a set of rules that work quite well.

 

However, the rules below expect 'x' or any one single default variable.  How
might one go about adjusting these rules so that the variables 'x, y, and z'
(i.e. multiple variables) can be accounted for?

 

For example:  E[a x + b y] //. rules[?]= a E[x] + b E[y]  ???

 

PLEASE note that I'm using a double stuck 'E' in the notebook (not to be
confused with the exponential function)

 

What I have now:

 

(* Expectation Rules*)

(* x, y, z, are assumed to be random variables and a, b, c are assumed to
constants *)

Clear[E,rules];

rules[x_Symbol:x] := {

      E[expr_?(FreeQ[#,x]&)] |expr,

      E[expr1_?(FreeQ[#,x]&) expr2_?(!FreeQ[#,x]&)]|

        expr1 * E[expr2],

      E[expr1_?(FreeQ[#,x]&)+expr2_?(!FreeQ[#,x]&)]|expr1+ E[expr2],
E[E[expr_?(!FreeQ[#,x]&)]]|  E[expr] 

      };

 

 

In[1]:{E[f[ x]],E[a x], E[b + f[x]], E[a + E[b y]],E[a + E[b y]]} //.
rules[]  (* using the default {rules[x],rules[y]} where  'x' or 'y' are
assumed to be variables *)

 

 

Out[1] {E[f[x]],a E[x],b+E[f[x]],a+b y,a+b y}

 

Thank you very much.

 

Regards - Mark

 

Mark Morrissey

Associate Professor, Meteorology

University of Oklahoma

EVAC, 3200 Marshall Ave., Suite 150

Norman, Oklahoma



  • Prev by Date: Recalculating values in tables?
  • Next by Date: Re: Question regarding replacement
  • Previous by thread: Re: Recalculating values in tables?
  • Next by thread: Re: A quick question regarding expectation rules