Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14747 > unrolled thread

Unexpected expectation behaviour

Started byDonagh Horgan <donagh.horgan@gmail.com>
First post2013-06-05 07:15 +0000
Last post2013-06-11 06:23 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Unexpected expectation behaviour Donagh Horgan <donagh.horgan@gmail.com> - 2013-06-05 07:15 +0000
    Re: Unexpected expectation behaviour Roland Franzius <roland.franzius@uos.de> - 2013-06-06 11:22 +0000
      Re: Unexpected expectation behaviour Donagh Horgan <donagh.horgan@gmail.com> - 2013-06-11 06:21 +0000
      Re: Unexpected expectation behaviour debguy <johnandsara2@cox.net> - 2013-06-11 06:23 +0000

#14747 — Unexpected expectation behaviour

FromDonagh Horgan <donagh.horgan@gmail.com>
Date2013-06-05 07:15 +0000
SubjectUnexpected expectation behaviour
Message-ID<komoio$1up$1@smc.vnet.net>
Hi all,

I've been playing around with the following expected value, but I've run into some odd behaviour with Expectation and NExpectation. The following example illustrates the problem:

Expectation[Abs[y - 1]^3, 
 y \[Distributed] NoncentralChiSquareDistribution[1, s]]
Plot[{%, NExpectation[Abs[y - 1]^3, 
   y \[Distributed] NoncentralChiSquareDistribution[1, s]]}, {s, 0, 
  10}]

All advice greatly appreciated.

Thanks,
Donagh

[toc] | [next] | [standalone]


#14758

FromRoland Franzius <roland.franzius@uos.de>
Date2013-06-06 11:22 +0000
Message-ID<kopreb$cgj$1@smc.vnet.net>
In reply to#14747
Am 05.06.2013 09:15, schrieb Donagh Horgan:
> Hi all,
>
> I've been playing around with the following expected value, but I've run into some odd behaviour with Expectation and NExpectation. The following example illustrates the problem:
>
> Expectation[Abs[y - 1]^3,
>   y \[Distributed] NoncentralChiSquareDistribution[1, s]]
> Plot[{%, NExpectation[Abs[y - 1]^3,
>     y \[Distributed] NoncentralChiSquareDistribution[1, s]]}, {s, 0,
>    10}]
>
> All advice greatly appreciated.

Mathematica uses algebraic knowlegde about the parameters in MarcumQ 
function, the cumulative distribution

CDF[ NoncentralChiSquareDistribution[1, s]]

Take a trace

Trace[Expectation[y - 1,
    y \[Distributed] NoncentralChiSquareDistribution[1, s]]]]

and you will see an evaluation process typical for gaussian integrals.

Unfortunately these procedures do not work for distributional 
observables like

    UnitStep[y-1]((y-1)^3) or  Abs[(y-1)^3]

and the like.

In this cases one needs the primitive integrals over the density 
function explicitely.

So Mathematica gets lost as usual in its unevaluted and never fully 
understandable evaluation processes of definite integrals.

WRI should change this odd behaviour by just implementing a table lookup 
eg in
Prudnikov/Marichev et al Tables.

The big conceptual error is to let users fill in transformed variables 
just for fun instead of stating a certain algebraic type of integral and 
the transformation rules of arguments and parameters applied.

A user friendly definite integrate processor should end the search with 
a comment and an Abort if the definite integral seems to be unknown.

As a mathematical physicist, I am quite unhappy with WRI's "Integrate 
policy": Not to cite the sources and hiding algorithmic trivialities 
clear to the community just for fear of what?

In the case of  existing notation differences eg between 
Abramovitz/Stegun und body of the mathematical literature of function 
theory - eg in the case of elliptic functions - the Mathematica function 
body itself needs much more commentaries and hints in which cases to use 
which functions.

-- 

Roland Franzius


[toc] | [prev] | [next] | [standalone]


#14796

FromDonagh Horgan <donagh.horgan@gmail.com>
Date2013-06-11 06:21 +0000
Message-ID<kp6fkv$nco$1@smc.vnet.net>
In reply to#14758
On Thursday, June 6, 2013 12:22:51 PM UTC+1, Roland Franzius wrote:
> Am 05.06.2013 09:15, schrieb Donagh Horgan:
>
> > Hi all,
>
> >
>
> > I've been playing around with the following expected value, but I've run into some odd behaviour with Expectation and NExpectation. The following example illustrates the problem:
>
> >
>
> > Expectation[Abs[y - 1]^3,
>
> >   y \[Distributed] NoncentralChiSquareDistribution[1, s]]
>
> > Plot[{%, NExpectation[Abs[y - 1]^3,
>
> >     y \[Distributed] NoncentralChiSquareDistribution[1, s]]}, {s, 0,
>
> >    10}]
>
> >
>
> > All advice greatly appreciated.
>
>
>
> Mathematica uses algebraic knowlegde about the parameters in MarcumQ
>
> function, the cumulative distribution
>
>
>
> CDF[ NoncentralChiSquareDistribution[1, s]]
>
>
>
> Take a trace
>
>
>
> Trace[Expectation[y - 1,
>
>     y \[Distributed] NoncentralChiSquareDistribution[1, s]]]]
>
>
>
> and you will see an evaluation process typical for gaussian integrals.
>
>
>
> Unfortunately these procedures do not work for distributional
>
> observables like
>
>
>
>     UnitStep[y-1]((y-1)^3) or  Abs[(y-1)^3]
>
>
>
> and the like.
>
>
>
> In this cases one needs the primitive integrals over the density
>
> function explicitely.
>
>
>
> So Mathematica gets lost as usual in its unevaluted and never fully
>
> understandable evaluation processes of definite integrals.
>
>
>
> WRI should change this odd behaviour by just implementing a table lookup
>
> eg in
>
> Prudnikov/Marichev et al Tables.
>
>
>
> The big conceptual error is to let users fill in transformed variables
>
> just for fun instead of stating a certain algebraic type of integral and
>
> the transformation rules of arguments and parameters applied.
>
>
>
> A user friendly definite integrate processor should end the search with
>
> a comment and an Abort if the definite integral seems to be unknown.
>
>
>
> As a mathematical physicist, I am quite unhappy with WRI's "Integrate
>
> policy": Not to cite the sources and hiding algorithmic trivialities
>
> clear to the community just for fear of what?
>
>
>
> In the case of  existing notation differences eg between
>
> Abramovitz/Stegun und body of the mathematical literature of function
>
> theory - eg in the case of elliptic functions - the Mathematica function
>
> body itself needs much more commentaries and hints in which cases to use
>
> which functions.
>
>
>
> --
>
>
>
> Roland Franzius

Great, thanks. That makes a lot of sense. The numerical method (using NExpectation) appears to be the correct one, so I'll stick with that for now, but it's worth bearing in mind for the future. I tend to think Mathematica is infallible (I know I shouldn't, but it's hard not to), and it's disconcerting to see obvious bugs like this.

[toc] | [prev] | [next] | [standalone]


#14801

Fromdebguy <johnandsara2@cox.net>
Date2013-06-11 06:23 +0000
Message-ID<kp6fop$nd6$1@smc.vnet.net>
In reply to#14758
I don't work for wolfram.   I agree and dissagree.

I think in first releases WRI most functions were  .m files you could
read or edit and contribute.

Also I beleive wolfram has release many functions as .m online to see
(i'm unsure about integrate).

But speed is a consideration: many things would absolutely never
finish in a lifetime if certain intter loops were not efficient.

What you are really talking about is having two.  One if your
processing, the other if manually doing formal math.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web