MathGroup Archive 2006

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

Search the Archive

Re: A quick question regarding expectation rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63892] Re: A quick question regarding expectation rules
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 21 Jan 2006 01:50:39 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <dqqbo7$lso$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

and making a global list
$RandomVariables={x,y,z}

and using rules like

E[a_*x_] /; FreeQ[$RandomVariables,a]:=a*E[x]

will not help ??

Regards
  Jens

"Mark Morrissey" <mmorriss at ou.edu> schrieb im 
Newsbeitrag news:dqqbo7$lso$1 at smc.vnet.net...
|
| 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: Re: associative arrays
  • Next by Date: Re: NDSolve useless?
  • Previous by thread: A quick question regarding expectation rules
  • Next by thread: Re: A quick question regarding expectation rules