# Systems for symbolically solving expectations?

Do there exist any systems for symbolically solving expectations?

This is sort of a follow-up to my question List of Tricks for Solving Messy Expectations? Basically, I'm looking for ways to solve a messy expectation after I've exhausted all obvious routes.

EDIT: BACKGROUND

I'm trying to solve the following for $\alpha$ (constrained to be greater than 0) as a function of $\sigma_X^2$, $\sigma_Y^2$, and $p$

$E\left[\ln(F) F^\alpha X^2 (X + Y)^2 + \ln(F) F^{2\alpha}(X + Y)^4\right] = 0$

where:

$Y \sim N(0,\sigma_Y^2)$

$X = \left\{ \begin{array}{cc} N(0,\sigma_X^2) & p \\ 0 & (1-p) \end{array}\right.$ where it's assumed $\sigma_X^2 \gg \sigma_Y^2$ and that $p$ is very small. (i.e., $X$ is a jump process with most of its mass at 0)

$F = F_{|Z|}(|X+Y|)$ where $Z \sim N(0,\sigma_Y^2)$ (i.e., $F$ is the CDF for the absolute value of a normal)

EDIT: EVEN MORE BACKGROUND

The equation I'm trying to solve above is the first order condition for the min-MSE problem:

$\min_{\alpha > 0} \left(X^2 - \widehat{X^2}\right)^2$

where $\widehat{X^2} = F_{|Z|}\left(|R|\right)^{\alpha}R^2$ and $R = X + Y\,$ is the only observed variable.

Basically, I'm trying to estimate the square of the jump, $X^2$ (given that I can only observe the aggregated process $R$) by smoothing down $R^2$. If $|R|$ is large, the smoothing function $F_{|Z|}\left(|R|\right)^{\alpha}$ should be close to 1 and the estimate of $X^2$ would be close to $R^2$. If $|R|$ is small, the estimate of $X^2$ would be close to 0.

-
Where did F and alpha come from? I am trying to see how they fit into the problem. Were they brought in as empirical smoothing factors or something like that? If so, we might be able to simplify the problem by leaving them out. –  Robert Dodier Sep 7 '12 at 23:52
They were empirical smoothing factors. Sort of a hack for a non-parametric model. I ended up not going this direction with my work. I ended up fully-specifying a model in which I was able to derive a minimum MSE estimator of my quantity. –  brianjd Sep 20 '12 at 21:36

Mathematica will do integrals (and simplify the results) like no tomorrow. You have to be a little careful specifying your assumptions - that is, you should specify all of them - but it works quite well. If you're a student then your university may well have a site license but if you're just using it for a couple of problems then it's probably not worth picking it up.

Wolfram Alpha (http://www.wolframalpha.com/) is free and has many of the same facilities but it wil choke on some heavier problems. You can also pose your problems in more natural language ("integrate ... wrt x from 0 to infinity") so it's nice for one-off's.

-
Thanks for the info. I've been avoiding buying Mathematica for some time. But after the advice here I started checking some videos and looking at their site in more detail. I may have to buy it. Some great features. I'll just add that link is a nice list of Mathematica's capabilities in regards to solving expectations –  brianjd Apr 27 '11 at 15:16
@brianjd Nice link, thanks; when I've needed expectations I've just been typing out the integral but I think I'd be better off using the probability distribution facilities (via ProbabilityDistribution[]) which takes a pdf + support and gives you not just expectations but also moments, chf, etc. Needless to say I haven't properly learned the software yet :) –  JMS Apr 27 '11 at 15:46
One follow-up question for you: Does what I'm doing above (added more to the question in marked edits) look like something that might be able to be done in Mathematica? I'd like to avoid a dead end if possible. But it does look promising with the existence of the erf function. –  brianjd Apr 27 '11 at 18:46
Perhaps; $p(X,Y)$ is nice enough. Of course the problem as ever is that there may not be a simpler expression than that integral :) Why is a numeric solution no good? –  JMS Apr 27 '11 at 21:37
Oh, just because a closed form solution would be nice and convincing. I do have something of a numeric solution. I can find $\alpha$ for particular values of the parameters. I suppose the next step is to do this for many values of the parameters and do some sort of polynomial fitting to get the relationship between $\alpha$ and the other parameters. This is at the periphery of my knowledge though. –  brianjd Apr 27 '11 at 22:12