Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10577 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-06-21 09:24 +0000 |
| Last post | 2012-06-21 09:24 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Moment function Bob Hanlon <hanlonr357@gmail.com> - 2012-06-21 09:24 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-06-21 09:24 +0000 |
| Subject | Re: Moment function |
| Message-ID | <jrup83$fn7$1@smc.vnet.net> |
dist = NormalDistribution[m, s];
assume = {Element[m, Reals], Element[{n, p}, Integers], s > 0, n >= 0, p>= 0};
moment1 = Moment[dist, n*p]
moment2 = Assuming[assume, Integrate[z^(n*p)*PDF[dist, z], {z, -Infinity, Infinity}]//Simplify]
distp = TransformedDistribution[z^p, z \[Distributed] dist];
moment3 = Assuming[assume, FullSimplify[Moment[distp, n]]]
Assuming[assume, FullSimplify[moment2 == moment3]]
True
{moment1, moment2, moment3} /. {n -> 1, p -> 1}
{m, m, m}
And@@Flatten[Table[Assuming[assume, Simplify[moment1 == moment2 == moment3]], {n, 0, 5}, {p, 0, 5}]]
True
The first method is very much faster.
Bob Hanlon
On Jun 20, 2012, at 3:48 AM, paul <paulvonhippel@yahoo.com> wrote:
> I would like a formula for the mth moment of Z^p, where Z~Normal(mu,sigma) and p is a positive integer. With m=p=1, the answer should be mu -- i.e., the first moment of a normal variable is the mean mu. But that's not what I get when I do it this way:
>
> momentPN =
> FullSimplify[
> Moment[TransformedDistribution[Z^p,
> Z \[Distributed] NormalDistribution[\[Mu], \[Sigma]]], m], {m > 0,
> p > 0, Element[p, Integers], Element[m, Integers]}]
>
> FullSimplify[
> momentPN /. {p -> 1, m -> 1}, {\[Sigma] > 0, Element[\[Mu], Reals]}]
>
> I know other ways to get the right answer, but why doesn't this method work?
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web