I guess the sample command can take a distribution as the first argument.
The manual does something like
In: X:=randvar(normal,stddev=9.5):; Y:=randvar(normal,stddev=1.5):;
then
In: sample(eval(X/Y,0),10):
and it works fine. But
In: sample(eval(X,0),10)
gives a bad argument error, while
In: sample(eval(1*X,0),10)
works just fine.
How is sample supposed to work with a distribution as the first argument?
sample and distributions
Modérateur : xcasadmin
Re: sample and distributions
Never mind, I guess, Everything works fine without the eval(...,0) there (and I'm a bit surprised it worked in that one case with the eval).
Re: sample and distributions
Hi,
you get different output for eval(X,0) and eval(1*X,0) because X is of type _IDNT (identifier) and 1*X is of type _SYMB (symbolic expression). The _IDNT is currently not handled by sample command and therefore it returns an error. I will modify the code so that cases like eval(X,0) are handled.
Edit: in fact, not accepting eval(X,0) is not a bug, and the code should be left as it is to avoid calling eval from sample.
you get different output for eval(X,0) and eval(1*X,0) because X is of type _IDNT (identifier) and 1*X is of type _SYMB (symbolic expression). The _IDNT is currently not handled by sample command and therefore it returns an error. I will modify the code so that cases like eval(X,0) are handled.
Edit: in fact, not accepting eval(X,0) is not a bug, and the code should be left as it is to avoid calling eval from sample.