|
[Date Index]
[Thread Index]
[Author Index]
Re: Binomial Distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg71366] Re: [mg71356] Binomial Distribution
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 16 Nov 2006 00:52:44 -0500 (EST)
- References: <200611151145.GAA01517@smc.vnet.net>
On 15 Nov 2006, at 20:45, Bruce Colletti wrote:
> Re Mathematica 5.2 under WinXP.
>
> Why doesn't the code below return a rational number?
>
> X = BinomialDistribution[10, 6/10];
> F[x_] := CDF[X, x];
> Rationalize@F@4
>
> Thankx.
>
> Bruce
>
I assume what you had in mind was:
<<Statistics`
X = BinomialDistribution[10, 6/10];
F[x_] := CDF[X, x]
Rationalize[N[F[4]]]
0.166239
Note the N. Rationalize will only work on approximate numbers. The
reason why it does not work above is because there is no rational
number "sufficiently close", where the meaning of "sufficiently
close" is relative to the size of the denominator of the fraction
(the larger the denominator the closer the number has to be to the
one we are approximating to be considered "sufficiently close"). If
you just want any rational approximation, without caring about the
size of the denominator, you can use:
Rationalize[N[F[4]], 0]
75692233/455322801
Note that you got a pretty large denominator. If you would rather
have a smaller one, you can get it but the approximation will be less
accurate:
Rationalize[N[F[4]], 10^(-6)]
194/1167
Andrzej Kozlowski
Prev by Date:
Re: Function defined with If
Next by Date:
Re: Function defined with If
Previous by thread:
Re: Binomial Distribution
Next by thread:
Re: Binomial Distribution
|