mmcdara

772 Reputation

12 Badges

3 years, 103 days

MaplePrimes Activity


These are questions asked by mmcdara

reference :

Question:Quantile function
Posted:
Mikhail Drugov 88 

 

In the reference above, Mikhail has raised a problem concerning the function Statistics:-Quantile.
A problem of the same kind exists for the function Mode.

In fact  Mode returns the value of the mode only for unimodal distributions ; but for "bimodal" distributions it does not work properly.
Theoritically the mode is the value where the PDF reaches its maximum maximorum. Except in very particular cases this maximum is unique, even if common language speaks of "bimodal distributions" instead of "two bumped distributions".

Here is an example of a two bumped distribution (Z) obtained by mixing two gaussians distributions.
It has two bumps (z=-1, z=2) but only one mode (z=-2).
It could be hopefully acceptable that Mode returns the {-2, 2} (even if only -2 is the true mode), but Mode returns also the value of z that minimizes PDF(Z, z), which is not correct at all.


 

restart:
with(Statistics):

X := RandomVariable(Normal(-2,1)):
Y := RandomVariable(Normal(2,1)):

r    := 0.4:
f__Z := unapply((1-r)*PDF(X,t)+r*PDF(Y,t), t);
Z    := Distribution(PDF=f__Z):

proc (t) options operator, arrow; .1692568750*2^(1/2)*exp(-(1/2)*(t+2)^2)+.1128379167*2^(1/2)*exp(-(1/2)*(t-2)^2) end proc

(1)

plot(PDF(Z,t), t=-4..4);

 

Mode(Z);

{-1.999102417, .1352239093, 1.997971857}

(2)

 


 

Download ProblemWithMode.mw

 

Hi everybody.

I often regret that Maple 18 and further versions (maybe some others before ?) do not represent lengthy and complex outputs by introducing substitution expressions (i.e. %1, %2, ...) as Maple 5 or 8 did.

An exemple can be found in the Maple V release 5 programming Guide (p95, expression %1 = ...)

To be more precise I provide you the output Maple 2015 gives on the same problem treated in "Introduction to Maple, André Heck (1993) Springer Verlag" ; page 86 (no advertising here !).

The problem is about solving a polynomial system in 3 indeterminates.
One of the (set of) solutions is quite complex and looks like (I represent just the beginning of the complete solution) :

{x = %1, y = -1/8*(%1^6 + 15*%1^4 ...) / %1^4 , z = ...}
%1 := RootOf(....)  

From at least Maple 18 this same solution takes this form

{x =  RootOf(....), y = -1/8*( RootOf(....)^6 + 15* RootOf(....)^4 ...) / %1^4 , z = ...}

My question is very simple : Does it exist a way to tell Maple to act as Maple 5/8 did ?

Thanks in advance.


PS1 : I tried things like subs(RootOf(....)=freeze(RootOf(....)), sols) but it is not perfect because I dit this manually, by a copy of RootOf(....) from the output and a paste into the subs(....) input (shame on me !)


PS2 : I use to work in worksheet mode, not document mode, and I would prefer an answer adapted to the worksheet mode.

 

Download Maple2015.mw

Hi everybody, 

 

Could somebody just explain me why commands L[1..5] and L[3..6] below do not seem to return "the same type of thing" ?

 

L := Array(1..10, [$(1..10)]);

L := Array(1..10, {(1) = 1, (2) = 2, (3) = 3, (4) = 4, (5) = 5, (6) = 6, (7) = 7, (8) = 8, (9) = 9, (10) = 10})

(1)

L[1..5];
whattype(%);

Array([1, 2, 3, 4, 5])

 

Array

(2)

L[3..6];
whattype(%);

Array(3 .. 6, {3 = 3, 4 = 4, 5 = 5, 6 = 6}, datatype = anything, storage = rectangular, order = Fortran_order)

 

Array

(3)

 


Thank you for your attention


Download array.mw

Could someone please explain to me why the procedure GraphTheory:-CycleBasis requires that the vertices of a graph be integers for it to work correctly ?
(while the definition of a graph supports other types of vertex names)


restart:
with(GraphTheory):

#------------------------------------------------------- test 1

g1 := Graph({{"a", 1}, {1, 3}, {"a", 3}});
DrawGraph(g1);
CycleBasis(g1);

Error, (in GraphTheory:-CycleBasis) cannot determine if this expression is true or false: "a" < 1

#------------------------------------------------------- test 2

g2 := Graph({{a, 1}, {1, 3}, {a, 3}});
CycleBasis(g2);

Error, (in GraphTheory:-CycleBasis) cannot determine if this expression is true or false: a < 1

 

#------------------------------------------------------- test 3

g3 := Graph({{4, 1}, {1, 3}, {4, 3}});
CycleBasis(g3);

[[1, 3, 4]]

 
Knowing this limitation I usually rename to integers the vertices of the graphs, next do some operations, and next go back to the original names.


Thanks for any explanation.

hello everybody, 

Is there some trick to bypass the limiited scope of the semicolon statement operator ?

More specifically, is it possible to force Maple to display (apart from the explicit use of the 'print' command) the results of the commands within two nested loops or within a loop and and a conditional statement ?


From the help page concerning statement operators it seems that it is truly impossible ...

"Note: This rule does not apply to statements enclosed in the body of another statement such as an if statement, loop, procedure, module, use statement, or try statement. In these cases, all enclosed statements must be separated by a semicolon or colon."


While not blocking it is a rather irritating limitation :-)

First 8 9 10 11 Page 10 of 11