sand15

360 Reputation

10 Badges

5 years, 296 days

MaplePrimes Activity


These are questions asked by sand15

Hi,

I submit you this strange result:
for somenumerical  values of a, b, c  (a, b, c real and b > a), Maple 2018 is not able to compute the mean of
c*U where U is a Uniform random variable with support [a, b].


 

restart:

with(Statistics):

interface(version);

`Standard Worksheet Interface, Maple 2018.0, Windows 7, March 10 2018 Build ID 1298750`

(1)

z := .4070716688*RandomVariable(Uniform(0.12-0.02*0.12, 0.12+0.02*0.12));
Mean(z);

.4070716688*_R

 

Error, (in Statistics:-Mean) the expression does not have a taylor expansion at t = 0

 

z := .4070716688*RandomVariable(Uniform(a, b));
Mean(z);
subs({a=0.12-0.02*0.12, b=0.12+0.02*0.12}, %);

.4070716688*_R0

 

.2035358344*a+.2035358344*b

 

0.4884860026e-1

(2)

 


 

Download Mean.mw


PLEASE: Maple still fails if I replace  a = 0.12 -0.02*0.12 by its value 0.1174
                                                                       and b = 0.12+0.02*0.12 by its value 0.1224
                   

This is incomprehensible and could hide a more profound problem.

Hi,

This more a warning to focus your attention on a specific point than a true question.
 

I submit you this test case which works in Maple 2015 and Maple 2016 but not in Maple 2018.

In a few words:

  • let X and Y two independant random variables with respective distributions Normal(mu__x, sigma__x) and  
    Normal(mu__y, sigma__y)
     
  • let Z := q -> cos(q)
     
  • You can easily verify that Maple can compute the formal expression of Mean(Z(X)) and Variance(Z(X))
    (which means that it could compute Z(X+Y) for X+Y is just another gaussian RV)
     
  • What I found is that:
    1. Mean(Z(X+Y)) returns same expressions in Maple 2015 and Maple 2016, but a different one in Maple 2018.
      Luckily the later is more readable than the former ones, and closer to the one of Mean(Z(U))  where U=X+Y is the RV of distribution Normal(mu__x+mu__y, sqrt(sigma__x^2+sigma__y^2))
      This suggest that the integration algorithm has evolved somewhere in between Maple 2016 and Maple 2018
       
    2. While Maple 2015 and Maple 2016 return an evaluated result for Variance(Z(X+Y)) Maple 2018 fails.
       

Can this "failure" be fixed by some adhoc option of Variance?
Or could it come from a "regression" in the implementation of this procedure (or of the underlying int procedure) in Maple 2018?

PS: I did not try to compute Variance(Z(X+Y)) from an explicit double integration


Stat_2015.mw

Hi,

In a recent post acer made me discover the joy of Typesetting to customize the outputs (acer, if you read this question: big thanks to you, really funny and powerful!)

I'm interested in using Typesetting for output coloring (for instance) but I would like that these outputs to be left justified.
Up to now I used to use printf to manage the outputs the way I wanted, but I failed combining Typesetting and printf.

Is it possible to exploit the capabilities of Typesetting in printf commands?
Or, at least, is it possible to "left-justify" print outputs programatically?

Thanks for your answers

Hi,


When you do this a := plot(1/x, x=0..1);  the figure contains a "smart" graph which extends roughly from 0 to 30 in the vertical direction.
(no discont=true nor smartview=false used here, numpoints set to its default falue)

If you use plottools:-getdata(a); you find that the vertical range is about  0..1800.
It seems to mean that smartview=true (the default setting) overrides the range determined from the values of discont and numpoints?
 

My question is: Is it possible to retrieve the vertical range that plot uses when it displays the graph?
 

Hi :-(

Just type this little set of lines (presently in Maple 2018, not checked for older versions)

restart:
with(Statistics):
N := ... Some integer value >= 2;  
X := RandomVariable(Binomial(N, 1/2)); 
plot(CDF(X, s), s=-1..N+1, gridlines=true, axis[1]=[gridlines=N+1]);


You will be horified by the results you obtain:
Whatever the value of n in [2, 5] the CDF is null for s < 0 (good), equal to 1 for s > N (good also) ... and equal to 1 in between

I didn't check with p = 0.5 instead of 1/2, neither for other values.
Surprinsingly the PDF is correct for any integer n



 

3 4 5 6 7 8 9 Last Page 5 of 18