f



Why can't I call Random[NormalDistribution[10.0,0.0]]?

Why can't I call Random[NormalDistribution[10.0,0.0]]?

I get the error:
NormalDistribution::posscale: The scale parameter 0.` is expected to be
positive.

It seems like I should get a random number with mean 10 and sigma 0. Or
in other words, the result should 10 every time.

In my program I want an array of number taken from different
distributions
Map[Random,Thread[NormalDistribution[Array1,Array2]]]

And elements of Array2 may be 0 for which I woudl ike the corresponding
value in Array1 returned. In fact,
Random[NormalDistribution[10.0,0.000000001]]
does return 10.0 as expected.

This worked in 5.1, but now returns this error in 5.1.1.

Anyone have an easy workaround?

Thanks,
Ben Barrowes

0
barrowes (233)
4/15/2005 9:14:47 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

1 Replies
397 Views

Similar Articles

[PageSpeed] 34

you wrote

>It seems like I should get a random number with mean 10 and sigma 0. Or
>in other words, the result should 10 every time.

    >Map[Random,Thread[NormalDistribution[Array1,Array2]]]

>Anyone have an easy workaround?

My suggestion is to build your random function in such a way that it can
handle special cases:

    myRandom[mean_, 0] := mean
    myRandom[mean_, 0.] := N[mean]
    myRandom[mean_, std_] := Random[NormalDistribution[mean, std]]

    MapThread[myRandom, {Array1,Array2}]

cheers,
Peltio
Invalid address in reply-to. Crafty demunging required to mail me.




0
peltio1 (32)
4/16/2005 8:17:48 AM
Reply: