mmcdara

7891 Reputation

22 Badges

9 years, 54 days

MaplePrimes Activity


These are replies submitted by mmcdara

@Mariusz Iwaniuk 

Great work Mariusz, congratulations

@acer 

Thank's for your analysis and your final decision.

 

@vv 

Sorry, you're right, I get the mean value of FM.
It was simpler to do the integration in polar coordinates but I've missed that "r" then is the "radius vector" (I'm not sure of this term, immediate translation of the french term "rayon vecteur").

Thanks for having corrected my mistake.

PS1: according to the pictures given by herclau, it seems the OP would be most interested in "OM" than in "FM"

PS2: I realize that even the term radius is ambiguous, not to speak about its mean

PS3: I've corrected the file attached to my first answer in accordance with your remark

@acer 

You cannot get typeset 2D Math displayed using the printf command (which left-aligns), since that line-prints.
You confirm my fears, thank you

Your left.tools.mw file gives me entire satisfaction.
You did a great job, thanks a lot.

outputleft.mw lets me dubious
I opened it , saw nothing at all, but any command returns a left justified output.
A complete mystery
 

@vv 

Too much self confidence and blindness are the mother of all vices.
Apologies for having treated you so rudely

@acer 

Cristal clear.

Contrary to what you've writtten above, the inert option to the CDF command is documented.
Right, I did not pay enough attention

Apart from the explicit value of 1 for s>3 I don't see why the Maple 2015 symbolic result is significantly better
Not "significantly".
For continuous TV, the cdf is a function from ]-infinity, +infinity[ onto [0, 1], whatever the support of the RV is. 
For instance CDF(Uniform(9, 1), s) has clearly 3 items, one for s<0 and the otherfor s>1, even if the support of thus RV is [0, 1] and that "in practice", no output outside of [0, 1] can be realized.
For discrete RV the definition of the cdf is the same.
So, extending the cdf to the value of 1 for s>3 would seem correct. 
Another argument it that, doing this, would treat symetrically the cases s > 3 and s < 0: if we suppose that the cdf is 1 for every s > 3, why don't suppose it is 0 for s > 0?

If you think that a result such as vv showed is incorrect then it would help if you were more clear about which of those ways you found it lacking (I guess it is the second)
Specifically If you think that a result such as vv showed is incorrect : I've just presented my apologies to vv and Carl Love, mainly vv, whose workaround indeed gives a correct result (if I put aside the few points already discussed above).
I was probably caught in a vicious circle, uncapable to clearly see the difference between vv's code and mine, and getting more and more suspicious about his solution.
So, vv's workaround gives the good result, just as yours does too, period.

To conclude, I would personally prefer to obtain directly the CDF of a RV (here binomial but this could apply to all the other discrete RV) with valuated parameters instead of using any workaround.

If I really want to use the cdf for further symbolic computation, I will use non valuated parameters (I.e CDF(Binomial(n,p)), s), but if I want to illustrate what a Binomial RV is, I will use for instance plot(CDF(Binomial(3, 1/2), s), s=-1..4).
Here is the origin of my first post, when I realized that plot(CDF(Binomial(3, 1/2), s), s=-1..4). didn't give me the expected figure.


 

@Carl Love  @vv

APOLOGIES TO BOTH OF YOU

This last reply opened my eyes.

Really sorry for all this mess

@Carl Love 

restart:
with(Statistics):
X := RandomVariable(Binomial(3, 1/2)):
CDF(X, s);

doesn't return the good answer on my professional laptop.

Once at the office I will send you in a few hours a file to confirm this

@vv 

It's incredible this race to the "I'm the first to answer" some people play here, just to see their score augmented.

"discont" is not the point!

I suspect you didn't type the commands on your own computer, or yu do not have Maple 2018, or you don't know what is the correct expression of the cdf of a binomial random variable?
To enlight you, a binomial RV X with parameters ( N, p) has N+1 different outcomes: 0, 1, ..., N. It's cdf F[X](x) is piecewise constant with breaks at x=0, x=1, ...x=N
Let X ~ Binomial(3, 1/2): Maple 2018 returns a CDF with only one breaking point at x=0

The "plot" was just here to visualize the bug

 

(I'm sand15 now at home)

It works correctly in Maple 2015
I suspect that the definition of the CDF has changed somewhere in between Maple 2016 ... Maple 2018.

You wll see below that the CDF is expressed in terms of a discrete sum, while in Maple 2018 it is (I cite from memory because I do not have Maple 2018 right now) a combination of Heaviside functions (plus, very strangely, the Psi function for "large enough" values of N, take for instance N:=11).

I tried (Maple 2018) to integrate the PDF (a collection of Dirac "functions")  as a workaround of the poor CDF mentioned in the previous post.
Unfortunately this was a false good idea which seemed to reveal another issue: the case N=3 gives an integral made of a sum of Heaviside functions plus a constant (of value 1/8, here again from memory).

In the code below, there is no formal relation between the PDF and the CDF: in Maple 2015 the CDF relies upon the (correct) binomial formula/theorem (I don(t know what is the correct term to use in english).
As the opposite, in Maple 2018, the  CDF is the formal integral of the PDF.

To complete the picture I would say that the formal representation of the PDF is not correct in any version of Maple. The use of the Dirac "function" is an objectionable custom and a dangerous shortcut for the Kronecker delta symbol or the characteristic function.
For instance, instead of writing the PDF in the Dirac form it would be better to adopt the 
KroneckerDelta from the Physics package:

with(Physics):
pdf := t -> (1/8)*KroneckerDelta[t, 0]+(3/8)*KroneckerDelta[t, 1]+(3/8)*KroneckerDelta[t, 2]+(1/8)*KroneckerDelta[t, 3]

for t in [$(-1..4)] do
printf("%a, %a\n", t,  pdf(t))
end do;

-1, 0
0, 1/8
1, 3/8
2, 3/8
3, 1/8
4, 0

 



 

restart:

with(Statistics):

N := 3;
p := 1/2:
X := RandomVariable(Binomial(N, p));

3

 

_R

(1)

CDF(X, s)

piecewise(s < 0, 0, 3 <= s, 1, sum(binomial(3, i)*(1/2)^i*(1/2)^(3-i), i = 0 .. floor(s)))

(2)

plot(%, s=-1..N+1, gridlines=true, axis[1]=[gridlines=N+1])

 

PDF(X, t)

(1/8)*Dirac(t)+(3/8)*Dirac(t-1)+(3/8)*Dirac(t-2)+(1/8)*Dirac(t-3)

(3)

F := int(PDF(X, t), t=-1..s);

(1/8)*Heaviside(s)+(3/8)*Heaviside(s-1)+(3/8)*Heaviside(s-2)+(1/8)*Heaviside(s-3)

(4)

 


 

Download Binomial_Maple_2015.mw

@acer 

Thank you acer 

@tomleslie 


And I could also redefine all discrete distributions in order they return integers and not floats.
Or I could also use another CAS

@vv 

No, I didn't.
I don't know how to notice a bug...

@vv 

Not in this case, here Maple is the exception!

 

There is a conenction with the so-called generator of a distribution fonction and this distribution itself.
As a universally adopted definition the former is the iLaplace-Stieljes transporm of the later.
Unfortunately, thanks to its own definition, this remlation doesn't hold in Maple.

Broadly speaking the Statistics package suffer s some of imprecisions and of a lack of rigor


 

The attached file contains some info about the GammaDistribution and it's Laplace-Stieljes transform

GammaDistribution.mw

 

By the way: The Erlang distribution suffers the same flaw than the GammaDistribution (it's normal Erlang is just the other name for Gamma...)
 

First 137 138 139 140 141 142 143 Last Page 139 of 154