2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Changed links in examples to use def __ style links

[SVN r84321]
This commit is contained in:
Paul A. Bristow
2013-05-17 10:59:59 +00:00
parent 20d1742c4d
commit db7a1c2a55
6 changed files with 82 additions and 85 deletions

View File

@@ -22,9 +22,9 @@
/*`[h5 Using Boost.Multiprecision to generate a high-precision array of sin coefficents for use with FFT.]
The Boost.Multiprecision library can be used for computations requiring precision
exceeding that of standard built-in types such as float, double
and long double. For extended-precision calculations, Boost.Multiprecision
supplies a template data type called cpp_dec_float. The number of decimal
exceeding that of standard built-in types such as `float`, `double`
and `long double`. For extended-precision calculations, Boost.Multiprecision
supplies a template data type called `cpp_dec_float`. The number of decimal
digits of precision is fixed at compile-time via template parameter.
To use these floating-point types and constants, we need some includes:
@@ -44,8 +44,8 @@ To use these floating-point types and constants, we need some includes:
#include <fstream>
/*`Define a text string which is a C++ comment with the program licence, copyright etc.
You could of course, tailor this to your needs, including copyright claim.
There are versions of `array` provided by Boost/array in boost::array or
You could of course, tailor this to your needs, including your copyright claim.
There are versions of `array` provided by Boost.Array in `boost::array` or
the C++11 std::array, but since not all platforms provide C++11 support,
this program provides the Boost version as fallback.
*/
@@ -69,8 +69,8 @@ static const char* prolog =
using boost::multiprecision::cpp_dec_float_50;
using boost::math::constants::pi;
// VS 2010 (wrongly) requires these at file scope, not local scope in main.
// This program also requires -std=c++11 option to compile using Clang and GCC.
// VS 2010 (wrongly) requires these at file scope, not local scope in `main`.
// This program also requires `-std=c++11` option to compile using Clang and GCC.
int main()
{
@@ -174,7 +174,7 @@ Now output all the sine table, to a file of your chosen name.
fout << " " << sin_values[i];
if (i == sin_values.size()-1)
{ // next is last value.
fout << "\n}};\n"; // 2nd } needed for some GCC compiler versions.
fout << "\n}};\n"; // 2nd } needed for some earlier GCC compiler versions.
break;
}
else
@@ -188,7 +188,7 @@ Now output all the sine table, to a file of your chosen name.
std::cout << "Close file " << sines_name << " for output OK." << std::endl;
}
//`The output file generated can be seen at [@..\\sines.hpp]
//`The output file generated can be seen at [@../../example/sines.hpp]
//] [/fft_sines_table_example_1]
return EXIT_SUCCESS;

View File

@@ -132,10 +132,9 @@ although it is not required, as the various examples below show.
// A new policy, ignoring domain errors, without using a typedef.
l = find_location<normal>(z, p, sd, policy<domain_error<ignore_error> >());
/*`
If we want to use a probability that is the
[link math_toolkit.stat_tut.overview.complements complement of our probability],
If we want to use a probability that is the __complements of our probability,
we should not even think of writing `find_location<normal>(z, 1 - p, sd)`,
but, [link why_complements to avoid loss of accuracy], use the complement version.
but use the complement version, see __why_complements.
*/
z = 2.;
double q = 0.95; // = 1 - p; // complement.

View File

@@ -116,8 +116,8 @@ cout << "Setting the packer to " << nominal_mean << " will mean that "
// Setting the packer to 3.06449 will mean that fraction of packs >= 2.9 is 0.95
/*`
This calculation is generalized as the free function called
[link math_toolkit.dist_ref.dist_algorithms find_location].
This calculation is generalized as the free function called `find_location`,
see __algorithms.
To use this we will need to
*/
@@ -261,8 +261,7 @@ cout <<"Fraction of packs >= " << minimum_weight << " with a mean of " << mean
/*`
Now we are getting really close, but to do the job properly,
we might need to use root finding method, for example the tools provided,
and used elsewhere, in the Math Toolkit, see
[link math_toolkit.internals1.roots2 Root Finding Without Derivatives].
and used elsewhere, in the Math Toolkit, see __root_finding_without_derivatives
But in this (normal) distribution case, we can and should be even smarter
and make a direct calculation.
@@ -278,7 +277,7 @@ ensuring that 0.95 (95%) of packs are above the minimum weight.
Rearranging, we can directly calculate the required standard deviation:
*/
normal N01; // standard normal distribution with meamn zero and unit standard deviation.
normal N01; // standard normal distribution with mean zero and unit standard deviation.
p = 0.05;
double qp = quantile(N01, p);
double sd95 = (minimum_weight - mean) / qp;
@@ -328,7 +327,7 @@ cout << "find_scale<normal>(minimum_weight, under_fraction, packs.mean()); " <<
// find_scale<normal>(minimum_weight, under_fraction, packs.mean()); 0.0607957
/*`But notice that using '1 - over_fraction' - will lead to a
[link why_complements loss of accuracy, especially if over_fraction was close to unity.]
loss of accuracy, especially if over_fraction was close to unity. (See __why_complements).
In this (very common) case, we should instead use the __complements,
giving the most accurate result.
*/

View File

@@ -131,8 +131,7 @@ Fraction of packs >= 2.9 with a mean of 3 and standard deviation of 0.06 is 0.95
Now we are getting really close, but to do the job properly,
we could use root finding method, for example the tools provided, and used elsewhere,
in the Math Toolkit, see
[link math_toolkit.internals1.roots2 Root Finding Without Derivatives].
in the Math Toolkit, see __root_finding_without_derivatives.
But in this normal distribution case, we could be even smarter and make a direct calculation.
*/

View File

@@ -127,7 +127,7 @@ although it is not required, as the various examples below show.
/*`
If we want to express a probability, say 0.999, that is a complement, `1 - p`
we should not even think of writing `find_scale<normal>(z, 1 - p, l)`,
but [link why_complements instead], use the __complements version.
but use the __complements version (see __why_complements).
*/
z = -2.;
double q = 0.999; // = 1 - p; // complement of 0.001.

View File

@@ -127,8 +127,8 @@ using the inverse or quantile.
/*`Note that the value returned is not an integer:
if you want an integer result you should use either floor, round or ceil functions,
or use the policies mechanism.
See [link math_toolkit.pol_tutorial.understand_dis_quant
Understanding Quantiles of Discrete Distributions]
See __understand_dis_quant.
The geometric distribution is related to the negative binomial
__spaces `negative_binomial_distribution(RealType r, RealType p);` with parameter /r/ = 1.