Symbolic Linear Function
- To: mathgroup at smc.vnet.net
- Subject: [mg91457] Symbolic Linear Function
- From: yatesd at mac.com
- Date: Fri, 22 Aug 2008 03:13:31 -0400 (EDT)
I could not find anything in this group or on the internet about
defining a generic linear function in Mathematica. I wanted a symbolic
simplification of an expression where I had an (undefined) function
that I knew was linear. I did the following:
SetAttributes[e,{Flat, Orderless}];
e[a_?NumericQ * x_]:= a * e[x];
e[x_Plus]:=e/@x;
This seemed to work fine and gave me the insight I wanted, but I was
wondering if other people have thought about this and have different
solutions or have any comments on my solution.
Thanks.
p.s. The expression I was interested in was Variance[Log[1+x]]. I
defined
Variance[x_]:=e[x^2]-e[x]^2 where e is representing expectation,
although I am not using any properties of expectation other than its
linearity.
I then looked at the Taylor expansion to order 5 with
Variance[Normal[Series[Log[1+x],{x,0,5}]]]