
BoostCommit : 
From: john_at_[hidden]
Date: 20070922 05:20:14
Author: johnmaddock
Date: 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
New Revision: 39472
URL: http://svn.boost.org/trac/boost/changeset/39472
Log:
Mostly minor typo fixes and some "editorial" changes.
Plus fixed some < and <= confusions.
Text files modified:
sandbox/math_toolkit/libs/math/doc/concepts.qbk  6 ++++
sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk  25 ++++++++++++
sandbox/math_toolkit/libs/math/doc/distributions/rayleigh.qbk  2 ++
sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp  2 +
sandbox/math_toolkit/libs/math/example/binomial_quiz_example.cpp  17 +++++++++++
sandbox/math_toolkit/libs/math/example/negative_binomial_example1.cpp  6 ++++++
6 files changed, 36 insertions(+), 22 deletions()
Modified: sandbox/math_toolkit/libs/math/doc/concepts.qbk
==============================================================================
 sandbox/math_toolkit/libs/math/doc/concepts.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/concepts.qbk 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 184,7 +184,9 @@
In addition, for efficient and accurate results, a __lanczos is highly desirable.
You may be able to adapt an existing approximation from
[@../../../../boost/math/special_functions/lanczos.hpp
boost/math/special_functions/lanczos.hpp]: you will need change
+boost/math/special_functions/lanczos.hpp] or
+[@../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp]:
+you will need change
static_cast's to lexical_cast's, and the constants to /strings/
(in order to ensure the coefficients aren't truncated to long double)
and then specialise `lanczos_traits` for type T. Otherwise you may have to hack
@@ 304,7 +306,7 @@
for [link math_toolkit.using_udt.concepts RealType]'s.
NTL RR is an example of a type meeting the requirements that this type
models, but note minor additions are needed  see ntl.diff and documentation
+models, but note that use of a thin wrapper class is required: refer to
[link math_toolkit.using_udt.use_ntl "Using With NTL  a HighPrecision FloatingPoint Library"].
There is no specific test case for type `real_concept`, instead, since this
Modified: sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk
==============================================================================
 sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/dist_tutorial.qbk 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 124,11 +124,10 @@
for example in a uniform, normal or triangular,
see [@http://www.boost.org/libs/random/ Boost.Random].
The distributions in the random number library are typically much faster
to compute than the quantiles provided by this library: although
in principal you can use a quantile to convert a uniformly distributed random
number to another distribution, there are much faster algorithms
available that are specific to random number generation.
+Whilst in principal there's nothing to prevent you from using the
+quantile function to convert a uniformly distributed random
+number to another distribution, in practice there are much more
+efficient algorithms available that are specific to random number generation.
] [/tip Random numbers that approximate Quantiles of Distributions]
For example, the binomial distribution has two parameters:
@@ 141,7 +140,7 @@
For this distribution the random variate is k: the number of successes observed.
The probability density\/mass function (pdf) is therefore written as ['f(k; n, p)].
[tip
+[note
[*Random Variates and Distribution Parameters]
@@ 159,14 +158,14 @@
`pdf(binomial_distribution<RealType>(n, p), k);`
The distribution (effectly the random variate) is said to be 'supported' over a range that is
+The distribution (effectively the random variate) is said to be 'supported' over a range that is
[@http://en.wikipedia.org/wiki/Probability_distribution
"the smallest closed set whose complement has probability zero"].
MathWorld uses the word 'defined' for this range.
Nonmathematicians might say it means the 'interesting' smallest range
of random variate x that has the cdf going from zero to unity.
Outside are uninteresting zones where the pdf is zero, and the cdf zero or unity.
Mathematically, the functions may make sense with an (+ or ) infinite value,
+TODO: fix this sentence: Mathematically, the functions may make sense with an (+ or ) infinite value,
but this implementation limits random variates to finite values from the `max` to `min` for the `RealType`.
(See [link math_toolkit.backgrounders.implementation.handling_of_floating_point_infinity
Handling of FloatingPoint Infinity] for rationale).
@@ 174,7 +173,7 @@
The range of random variate values that is permitted and supported can be tested by using two functions
`range` and `support`.
[tip
+[note
[*Discrete Probability Distributions]
@@ 230,7 +229,7 @@
will cause you to lose significant digits. In extreme cases, `p` may
actually be equal to `1`, even though the true value of the complement is nonzero.
[link why_complements Why complements?]
+[link why_complements See also ['"Why complements?"]]
In this library, whenever you want to receive a complement, just wrap
all the function arguments in a call to `complement(...)`, for example:
@@ 310,7 +309,7 @@
Which has no finite result.
]
[h4 Parameters can be estimated]
+[h4 Parameters can be calculated]
Sometimes it's the parameters that define the distribution that you
need to find. Suppose, for example, you have conducted a Studentst test
@@ 318,7 +317,7 @@
differ from each other, or maybe they don't; based on the result
of the test you can't be sure. A legitimate question to ask then is
"How many more measurements would I have to take before I would get
an X% probability that the difference is real?" Parameter estimators
+an X% probability that the difference is real?" Parameter finders
can answer questions like this, and are necessarily different for
each distribution. They are implemented as static member functions
of the distributions, for example:
@@ 350,7 +349,7 @@
probability as well, by wrapping the function's
arguments in a call to `complement(...)`.
* Static member functions allow the parameters of a distribution
to be estimated from other information.
+to be found from other information.
Now that you have the basics, the next section looks at some worked examples.
Modified: sandbox/math_toolkit/libs/math/doc/distributions/rayleigh.qbk
==============================================================================
 sandbox/math_toolkit/libs/math/doc/distributions/rayleigh.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/rayleigh.qbk 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 39,9 +39,11 @@
or real and imaginary components may have absolute values that are Rayleigh distributed.
The following graph illustrates how the Probability density Function(pdf) varies with the shape parameter [sigma]:
+
[$../graphs/rayleigh_pdf.png]
and the Cumulative Distribution Function (cdf)
+
[$../graphs/rayleigh_cdf.png]
[h4 Related distributions]
Modified: sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp
==============================================================================
 sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 40,7 +40,7 @@
say 0.6 for one with chewing gum on the tail,
so it is more likely to fall tails down and heads up).
First we need to some includes and using statements to be able to use the binomial distribution, some std input and output, and get started:
+First we need some includes and using statements to be able to use the binomial distribution, some std input and output, and get started:
*/
#include <boost/math/distributions/binomial.hpp>
Modified: sandbox/math_toolkit/libs/math/example/binomial_quiz_example.cpp
==============================================================================
 sandbox/math_toolkit/libs/math/example/binomial_quiz_example.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/binomial_quiz_example.cpp 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 127,7 +127,7 @@
[pre
Probability of getting none or one right is 0.0634764
]
Since the cdf is inclusive, we can get the probability of getting upto 10 right ( <= )
+Since the cdf is inclusive, we can get the probability of getting up to 10 right ( <= )
*/
cout << "Probability of getting <= 10 right (to fail) is " << cdf(quiz, 10) << endl;
/*`
@@ 162,8 +162,11 @@
[pre
Probability of getting less than 11 (< 11) answers right by guessing is 0.999715
]
and similarly to get a > rather than a >= test, because the cdf complement is also inclusive,
+and similarly to get a >= rather than a > test
we also need to subtract one from the score (and can again check the sum is unity).
+This is because if the cdf is /inclusive/,
+then its complement must be /exclusive/ otherwise there would be one possible
+outcome counted twice!
*/
cout << "Probability of getting at least " << pass_score
<< "(>= " << pass_score << ") answers right by guessing is "
@@ 208,7 +211,7 @@
16 1
]
*/
 cout << "\n" "At least (>=)""\n""Guessed OK Probability" << right << endl;
+ cout << "\n" "At least (>)""\n""Guessed OK Probability" << right << endl;
for (int score = 0; score <= questions; score++)
{
cout << setw(2) << score << " " << setprecision(10)
@@ 216,7 +219,7 @@
}
/*`
[pre
At least (>=)
+At least (>)
Guessed OK Probability
0 0.9899774042
1 0.9365235602
@@ 345,8 +348,10 @@
[link math_toolkit.policy.pol_tutorial.understand_dis_quant Understanding Discrete Quantile Policy].
We could control the policy for *all* distributions by
+
#define BOOST_MATH_DISCRETE_QUANTILE_POLICY real
at the head of the program would make this policy apply
+
+ at the head of the program would make this policy apply
to this *one, and only*, translation unit.
Or we can now create a (typedef for) policy that has discrete quantiles real
@@ 363,7 +368,7 @@
using boost::math::binomial_distribution;
typedef binomial_distribution<double, real_quantile_policy> real_quantile_binomial;
/*`
Construct a distribution of this custom ``real_quantile_binomial distribution``
+Construct an object of this custom distribution:
*/
real_quantile_binomial quiz_real(questions, success_fraction);
/*`
Modified: sandbox/math_toolkit/libs/math/example/negative_binomial_example1.cpp
==============================================================================
 sandbox/math_toolkit/libs/math/example/negative_binomial_example1.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/negative_binomial_example1.cpp 20070922 05:20:13 EDT (Sat, 22 Sep 2007)
@@ 222,6 +222,8 @@
]
Finally consider the risk of Pat not selling his quota of 5 bars
even after visiting all the houses.
+Calculate the probability that he /will/ sell on
+or before the last house:
Calculate the probability that he would sell all his quota on the very last house.
*/
cout << "Probability that Pat finishes on the " << all_houses
@@ 245,6 +247,10 @@
on or before the 30th house is 0.99849
]
+/*`So the risk of failing even after visiting all the houses is 1  this probability,
+ ``1  cdf(nb, all_houses  sales_quota``
+But using this expression may cause serious inaccuracy,
+so it would be much better to use the complement of the cdf:
So the risk of failing even at, or after, the 31th (nonexistent) houses is 1  this probability,
``1  cdf(nb, all_houses  sales_quota)``
But using this expression may cause serious inaccuracy.
BoostCommit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk