Skip to content

Commit 3d32b38

Browse files
authored
Merge pull request #724 from boostorg/more_docs_tuning
Fix #718 via more docs tuning
2 parents 3675c9e + 2ad2822 commit 3d32b38

File tree

3 files changed

+72
-73
lines changed

3 files changed

+72
-73
lines changed

doc/multiprecision.qbk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
[def __compiler_support [@https://en.cppreference.com/w/cpp/compiler_support compiler support]]
133133
[def __ULP [@http://en.wikipedia.org/wiki/Unit_in_the_last_place Unit in the last place (ULP)]]
134134
[def __Mathematica [@http://www.wolfram.com/products/mathematica/index.html Wolfram Mathematica]]
135-
[def __WolframAlpha [@http://www.wolframalpha.com/ Wolfram Alpha]]
135+
[def __WolframAlphaGLCoefs [@https://www.wolframalpha.com/input?i=Fit%5B%7B%7B21.0%2C+3.5%7D%2C+%7B51.0%2C+11.1%7D%2C+%7B101.0%2C+22.5%7D%2C+%7B201.0%2C+46.8%7D%7D%2C+%7B1%2C+d%2C+d%5E2%7D%2C+d%5D+FullSimplify%5B%25%5D Wolfram Alpha Gauss-Laguerre coefficients]]
136136
[def __Boost_Serialization [@https://www.boost.org/doc/libs/release/libs/serialization/doc/index.html Boost.Serialization]]
137137
[def __Boost_Math [@https://www.boost.org/doc/libs/release/libs/math/doc/index.html Boost.Math]]
138138
[def __Boost_Multiprecision [@https://www.boost.org/doc/libs/release/libs/multiprecision/doc/index.html Boost.Multiprecision]]

doc/tutorial_float_eg.qbk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ needed for convergence when using various counts of base-10 digits.
108108

109109
Let's calibrate, for instance, the number of coefficients needed at the point `x = 1`.
110110

111-
Empirical data were used with __WolframAlpha :
111+
Empirical data were used with __WolframAlphaGLCoefs :
112112
``
113-
Fit[{{21.0, 3.5}, {51.0, 11.1}, {101.0, 22.5}, {201.0, 46.8}}, {1, d, d^2}, d]FullSimplify[%]
113+
Fit[{{21.0, 3.5}, {51.0, 11.1}, {101.0, 22.5}, {201.0, 46.8}}, {1, d, d^2}, d] FullSimplify[%]
114114
0.0000178915 d^2 + 0.235487 d - 1.28301
115115
or
116116
-1.28301 + (0.235487 + 0.0000178915 d) d
@@ -127,7 +127,7 @@ followed by calculation of accurate abscissa and weights is:
127127
[gauss_laguerre_quadrature_output_1]
128128

129129
Finally the result using Gauss-Laguerre quadrature is compared with a calculation using `cyl_bessel_k`,
130-
and both are listed, finally confirming that none differ more than a small tolerance.
130+
and both are listed, conclusively confirming that none differ by more than a small tolerance.
131131
[gauss_laguerre_quadrature_output_2]
132132

133133
For more detail see comments in the source code for this example at [@../../example/gauss_laguerre_quadrature.cpp gauss_laguerre_quadrature.cpp].

example/cpp_complex_examples.cpp

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,102 +6,101 @@
66
// Software License, Version 1.0. (See accompanying file
77
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
88

9-
/*`This example demonstrates the usage of the MPC backend for multiprecision complex numbers.
10-
In the following, we will show how using MPC backend allows for the same operations as the C++ standard library complex numbers.
9+
/*`This example demonstrates the usage of the complex_adaptor backend for multiprecision complex numbers.
10+
In the following, we will show how using the complex_adaptor backend together with number allows for the same operations as the C++ standard library complex numbers.
1111
*/
1212

1313
//[cpp_complex_eg
14-
#include <boost/multiprecision/cpp_complex.hpp>
15-
16-
#include <complex>
1714
#include <iostream>
15+
#include <complex>
16+
#include <boost/multiprecision/cpp_complex.hpp>
1817

1918
template<class Complex>
2019
void complex_number_examples()
2120
{
2221
Complex z1{0, 1};
2322
std::cout << std::setprecision(std::numeric_limits<typename Complex::value_type>::digits10);
2423
std::cout << std::scientific << std::fixed;
25-
std::cout << "Print a complex number: " << z1 << std::endl;
26-
std::cout << "Square it : " << z1*z1 << std::endl;
27-
std::cout << "Real part : " << z1.real() << " = " << real(z1) << std::endl;
28-
std::cout << "Imaginary part : " << z1.imag() << " = " << imag(z1) << std::endl;
29-
using std::abs;
30-
std::cout << "Absolute value : " << abs(z1) << std::endl;
31-
std::cout << "Argument : " << arg(z1) << std::endl;
32-
std::cout << "Norm : " << norm(z1) << std::endl;
33-
std::cout << "Complex conjugate : " << conj(z1) << std::endl;
34-
std::cout << "Projection onto Riemann sphere: " << proj(z1) << std::endl;
24+
std::cout << "Print a complex number : " << z1 << std::endl;
25+
std::cout << "Square it : " << z1*z1 << std::endl;
26+
std::cout << "Real part : " << z1.real() << " = " << real(z1) << std::endl;
27+
std::cout << "Imaginary part : " << z1.imag() << " = " << imag(z1) << std::endl;
28+
std::cout << "Absolute value : " << abs(z1) << std::endl;
29+
std::cout << "Argument : " << arg(z1) << std::endl;
30+
std::cout << "Norm : " << norm(z1) << std::endl;
31+
std::cout << "Complex conjugate : " << conj(z1) << std::endl;
32+
std::cout << "Proj onto Riemann sphere : " << proj(z1) << std::endl;
3533
typename Complex::value_type r = 1;
3634
typename Complex::value_type theta = 0.8;
35+
36+
// We need a using declaration here, since polar is called with a scalar:
3737
using std::polar;
38-
std::cout << "Polar coordinates (phase = 0) : " << polar(r) << std::endl;
39-
std::cout << "Polar coordinates (phase !=0) : " << polar(r, theta) << std::endl;
38+
39+
std::cout << "Polar coord phase = 0 : " << polar(r) << std::endl;
40+
std::cout << "Polar coord phase != 0 : " << polar(r, theta) << std::endl;
4041

4142
std::cout << "\nElementary special functions:\n";
42-
std::cout << "exp(z1) = " << exp(z1) << std::endl;
43-
std::cout << "log(z1) = " << log(z1) << std::endl;
44-
std::cout << "log10(z1) = " << log10(z1) << std::endl;
45-
std::cout << "pow(z1, z1) = " << pow(z1, z1) << std::endl;
46-
std::cout << "Take its square root : " << sqrt(z1) << std::endl;
47-
std::cout << "sin(z1) = " << sin(z1) << std::endl;
48-
std::cout << "cos(z1) = " << cos(z1) << std::endl;
49-
std::cout << "tan(z1) = " << tan(z1) << std::endl;
50-
std::cout << "asin(z1) = " << asin(z1) << std::endl;
51-
std::cout << "acos(z1) = " << acos(z1) << std::endl;
52-
std::cout << "atan(z1) = " << atan(z1) << std::endl;
53-
std::cout << "sinh(z1) = " << sinh(z1) << std::endl;
54-
std::cout << "cosh(z1) = " << cosh(z1) << std::endl;
55-
std::cout << "tanh(z1) = " << tanh(z1) << std::endl;
56-
std::cout << "asinh(z1) = " << asinh(z1) << std::endl;
57-
std::cout << "acosh(z1) = " << acosh(z1) << std::endl;
58-
std::cout << "atanh(z1) = " << atanh(z1) << std::endl;
43+
std::cout << "exp(z1) : " << exp(z1) << std::endl;
44+
std::cout << "log(z1) : " << log(z1) << std::endl;
45+
std::cout << "log10(z1) : " << log10(z1) << std::endl;
46+
std::cout << "pow(z1, z1) : " << pow(z1, z1) << std::endl;
47+
std::cout << "Take its square root : " << sqrt(z1) << std::endl;
48+
std::cout << "sin(z1) : " << sin(z1) << std::endl;
49+
std::cout << "cos(z1) : " << cos(z1) << std::endl;
50+
std::cout << "tan(z1) : " << tan(z1) << std::endl;
51+
std::cout << "asin(z1) : " << asin(z1) << std::endl;
52+
std::cout << "acos(z1) : " << acos(z1) << std::endl;
53+
std::cout << "atan(z1) : " << atan(z1) << std::endl;
54+
std::cout << "sinh(z1) : " << sinh(z1) << std::endl;
55+
std::cout << "cosh(z1) : " << cosh(z1) << std::endl;
56+
std::cout << "tanh(z1) : " << tanh(z1) << std::endl;
57+
std::cout << "asinh(z1) : " << asinh(z1) << std::endl;
58+
std::cout << "acosh(z1) : " << acosh(z1) << std::endl;
59+
std::cout << "atanh(z1) : " << atanh(z1) << std::endl;
5960
}
6061

6162
int main()
6263
{
63-
std::cout << "First, some operations we usually perform with std::complex:\n";
64+
std::cout << "First, some operations performed with std::complex:\n";
6465
complex_number_examples<std::complex<double>>();
65-
std::cout << "\nNow the same operations performed using quad precision complex numbers:\n";
66-
complex_number_examples<boost::multiprecision::cpp_complex_quad>();
6766

68-
return 0;
69-
}
70-
//]
67+
std::cout << "\nNow the same operations performed with quad precision complex numbers:\n";
68+
complex_number_examples<boost::multiprecision::cpp_complex_quad>();
69+
}//]
7170

7271
/*
7372
7473
//[cpp_complex_out
75-
76-
Print a complex number: (0.000000000000000000000000000000000,1.000000000000000000000000000000000)
77-
Square it : -1.000000000000000000000000000000000
78-
Real part : 0.000000000000000000000000000000000 = 0.000000000000000000000000000000000
79-
Imaginary part : 1.000000000000000000000000000000000 = 1.000000000000000000000000000000000
80-
Absolute value : 1.000000000000000000000000000000000
81-
Argument : 1.570796326794896619231321691639751
82-
Norm : 1.000000000000000000000000000000000
83-
Complex conjugate : (0.000000000000000000000000000000000,-1.000000000000000000000000000000000)
84-
Projection onto Riemann sphere: (0.000000000000000000000000000000000,1.000000000000000000000000000000000)
85-
Polar coordinates (phase = 0) : 1.000000000000000000000000000000000
86-
Polar coordinates (phase !=0) : (0.696706709347165389063740022772448,0.717356090899522792567167815703377)
74+
Now the same operations performed using quad precision complex numbers:
75+
Print a complex number : (0.000000000000000000000000000000000,1.000000000000000000000000000000000)
76+
Square it : -1.000000000000000000000000000000000
77+
Real part : 0.000000000000000000000000000000000 = 0.000000000000000000000000000000000
78+
Imaginary part : 1.000000000000000000000000000000000 = 1.000000000000000000000000000000000
79+
Absolute value : 1.000000000000000000000000000000000
80+
Argument : 1.570796326794896619231321691639751
81+
Norm : 1.000000000000000000000000000000000
82+
Complex conjugate : (0.000000000000000000000000000000000,-1.000000000000000000000000000000000)
83+
Proj onto Riemann sphere : (0.000000000000000000000000000000000,1.000000000000000000000000000000000)
84+
Polar coord phase = 0 : 1.000000000000000000000000000000000
85+
Polar coord phase != 0 : (0.696706709347165389063740022772448,0.717356090899522792567167815703377)
8786
8887
Elementary special functions:
89-
exp(z1) = (0.540302305868139717400936607442977,0.841470984807896506652502321630299)
90-
log(z1) = (0.000000000000000000000000000000000,1.570796326794896619231321691639751)
91-
log10(z1) = (0.000000000000000000000000000000000,0.682188176920920673742891812715678)
92-
pow(z1, z1) = 0.207879576350761908546955619834979
93-
Take its square root : (0.707106781186547524400844362104849,0.707106781186547524400844362104849)
94-
sin(z1) = (0.000000000000000000000000000000000,1.175201193643801456882381850595601)
95-
cos(z1) = 1.543080634815243778477905620757062
96-
tan(z1) = (0.000000000000000000000000000000000,0.761594155955764888119458282604794)
97-
asin(z1) = (0.000000000000000000000000000000000,0.881373587019543025232609324979793)
98-
acos(z1) = (1.570796326794896619231321691639751,-0.881373587019543025232609324979793)
99-
atan(z1) = (0.000000000000000000000000000000000,inf)
100-
sinh(z1) = (0.000000000000000000000000000000000,0.841470984807896506652502321630299)
101-
cosh(z1) = 0.540302305868139717400936607442977
102-
tanh(z1) = (0.000000000000000000000000000000000,1.557407724654902230506974807458360)
103-
asinh(z1) = (0.000000000000000000000000000000000,1.570796326794896619231321691639751)
104-
acosh(z1) = (0.881373587019543025232609324979792,1.570796326794896619231321691639751)
105-
atanh(z1) = (0.000000000000000000000000000000000,0.785398163397448309615660845819876)
88+
exp(z1) : (0.540302305868139717400936607442977,0.841470984807896506652502321630299)
89+
log(z1) : (0.000000000000000000000000000000000,1.570796326794896619231321691639751)
90+
log10(z1) : (0.000000000000000000000000000000000,0.682188176920920673742891812715678)
91+
pow(z1, z1) : 0.207879576350761908546955619834979
92+
Take its square root : (0.707106781186547524400844362104849,0.707106781186547524400844362104849)
93+
sin(z1) : (0.000000000000000000000000000000000,1.175201193643801456882381850595601)
94+
cos(z1) : 1.543080634815243778477905620757062
95+
tan(z1) : (0.000000000000000000000000000000000,0.761594155955764888119458282604794)
96+
asin(z1) : (0.000000000000000000000000000000000,0.881373587019543025232609324979792)
97+
acos(z1) : (1.570796326794896619231321691639751,-0.881373587019543025232609324979792)
98+
atan(z1) : (0.000000000000000000000000000000000,inf)
99+
sinh(z1) : (0.000000000000000000000000000000000,0.841470984807896506652502321630299)
100+
cosh(z1) : 0.540302305868139717400936607442977
101+
tanh(z1) : (0.000000000000000000000000000000000,1.557407724654902230506974807458360)
102+
asinh(z1) : (0.000000000000000000000000000000000,1.570796326794896619231321691639751)
103+
acosh(z1) : (0.881373587019543025232609324979792,1.570796326794896619231321691639751)
104+
atanh(z1) : (0.000000000000000000000000000000000,0.785398163397448309615660845819876)
106105
//]
107106
*/

0 commit comments

Comments
 (0)