Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/math/doc/math-sf.qbk @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 10.3 KB
Line 
1
2[def __asinh [link boost_math.math_special_functions.asinh asinh]]
3[def __acosh [link boost_math.math_special_functions.acosh acosh]]
4[def __atanh [link boost_math.math_special_functions.atanh atanh]]
5[def __sinc_pi [link boost_math.math_special_functions.sinc_pi sinc_pi]]
6[def __sinhc_pi [link boost_math.math_special_functions.sinhc_pi sinhc_pi]]
7
8[def __log1p [link boost_math.math_special_functions.log1p log1p]]
9[def __expm1 [link boost_math.math_special_functions.expm1 expm1]]
10[def __hypot [link boost_math.math_special_functions.hypot hypot]]
11
12[def __form1 [^\[0;+'''∞'''\[]]
13[def __form2 [^\]-'''∞''';+1\[]]
14[def __form3 [^\]-'''∞''';-1\[]]
15[def __form4 [^\]+1;+'''∞'''\[]]
16[def __form5 `[^\[-1;-1+'''ε'''\[]]
17[def __form6 '''ε''']
18[def __form7 [^\]+1-'''ε''';+1\]]]
19
20[def __effects [*Effects: ]]
21[def __formula [*Formula: ]]
22[def __exm1 '''<code>e<superscript>x</superscript> - 1</code>''']
23[def __ex '''<code>e<superscript>x</superscript></code>''']
24[def __te '''2&#x03B5;''']
25
26
27[section Math Special Functions]
28
29[section Overview]
30
31The Special Functions library currently provides eight templated special functions,
32in namespace boost. Two of these (__sinc_pi and __sinhc_pi) are needed by our
33implementation of quaternions and octonions.
34
35The functions __acosh, __asinh and __atanh are entirely classical,
36the function __sinc_pi sees heavy use in signal processing tasks,
37and the function __sinhc_pi is an ad'hoc function whose naming is modelled on
38__sinc_pi and hyperbolic functions.
39
40The functions __log1p, __expm1 and __hypot are all part of the C99 standard
41but not yet C++.  Two of these (__log1p and __hypot) were needed for the
42[link boost_math.inverse_complex complex number inverse trigonometric functions].
43
44The functions implemented here can throw standard exceptions, but no
45exception specification has been made.
46
47[endsect]
48
49[section Header Files]
50
51The interface and implementation for each function (or forms of a function)
52are both supplied by one header file:
53
54* [@../../boost/math/special_functions/acosh.hpp acosh.hpp]
55* [@../../boost/math/special_functions/asinh.hpp asinh.hpp]
56* [@../../boost/math/special_functions/atanh.hpp atanh.hpp]
57* [@../../boost/math/special_functions/expm1.hpp expm1.hpp]
58* [@../../boost/math/special_functions/hypot.hpp hypot.hpp]
59* [@../../boost/math/special_functions/log1p.hpp log1p.hpp]
60* [@../../boost/math/special_functions/sinc.hpp sinc.hpp]
61* [@../../boost/math/special_functions/sinhc.hpp sinhc.hpp]
62   
63[endsect]
64
65[section Synopsis]
66
67   namespace boost{ namespace math{
68
69   template<typename T>
70   T __acosh(const T x);
71
72   template<typename T>
73   T __asinh(const T x);
74
75   template<typename T>
76   T __atanh(const T x);
77   
78   template<typename T>
79   T __expm1(const T x);
80   
81   template<typename T>
82   T __hypot(const T x);
83   
84   template<typename T>
85   T __log1p(const T x);
86
87   template<typename T>
88   T __sinc_pi(const T x);
89
90   template<typename T, template<typename> class U>
91   U<T> __sinc_pi(const U<T> x);
92
93   template<typename T>
94   T __sinhc_pi(const T x);
95
96   template<typename T, template<typename> class U>
97   U<T> __sinhc_pi(const U<T> x);
98
99   }
100   }
101
102[endsect]
103
104[section acosh]
105
106   template<typename T>
107   T acosh(const T x);
108
109Computes the reciprocal of (the restriction to the range of __form1)
110[link boost_math.background_information_and_white_papers.the_inverse_hyperbolic_functions
111the hyperbolic cosine function], at x. Values returned are positive. Generalised
112Taylor series are used near 1 and Laurent series are used near the
113infinity to ensure accuracy.
114
115If x is in the range __form2 a quiet NaN is returned (if the system allows,
116otherwise a `domain_error` exception is generated).
117
118[endsect]
119
120[section asinh]
121
122   template<typename T>
123   T asinh(const T x);
124
125Computes the reciprocal of
126[link boost_math.background_information_and_white_papers.the_inverse_hyperbolic_functions
127the hyperbolic sine function].
128Taylor series are used at the origin and Laurent series are used near the
129infinity to ensure accuracy.
130
131[endsect]
132
133[section atanh]
134
135   template<typename T>
136   T atanh(const T x);
137
138Computes the reciprocal of
139[link boost_math.background_information_and_white_papers.the_inverse_hyperbolic_functions
140the hyperbolic tangent function], at x.
141Taylor series are used at the origin to ensure accuracy.
142
143If x is in the range
144__form3
145or in the range
146__form4
147a quiet NaN is returned
148(if the system allows, otherwise a `domain_error` exception is generated).
149
150If x is in the range
151__form5,
152minus infinity is returned
153(if the system allows, otherwise an `out_of_range` exception
154is generated), with
155__form6
156denoting numeric_limits<T>::epsilon().
157
158If x is in the range
159__form7,
160plus infinity is returned (if the system allows,
161otherwise an `out_of_range` exception is generated), with
162__form6
163denoting
164numeric_limits<T>::epsilon().
165
166[endsect]
167
168[section:expm1 expm1]
169
170   template <class T>
171   T expm1(T t);
172
173__effects returns __exm1.
174
175For small x, then __ex is very close to 1, as a result calculating __exm1 results
176in catastrophic cancellation errors when x is small.  `expm1` calculates __exm1 using
177a series expansion when x is small (giving an accuracy of less than __te).
178
179Finally when BOOST_HAS_EXPM1 is defined then the `float/double/long double`
180specializations of this template simply forward to the platform's
181native implementation of this function.
182
183[endsect]
184
185[section:hypot hypot]
186
187   template <class T>
188   T hypot(T x, T y);
189   
190__effects computes [$../../libs/math/doc/images/hypot.png] in such a way as to avoid undue underflow and overflow.
191
192When calculating [$../../libs/math/doc/images/hypot.png] it's quite easy for the intermediate terms to either
193overflow or underflow, even though the result is in fact perfectly representable.
194One possible alternative form is [$../../libs/math/doc/images/hypot2.png], but that can overflow or underflow
195if x and y are of very differing magnitudes.  The `hypot` function takes care of
196all the special cases for you, so you don't have to.
197
198[endsect]
199
200[section:log1p log1p]
201
202   template <class T>
203   T log1p(T x);
204   
205__effects returns the natural logarithm of `x+1`.
206
207There are many situations where it is desirable to compute `log(x+1)`.
208However, for small `x` then `x+1` suffers from catastrophic cancellation errors
209so that `x+1 == 1` and `log(x+1) == 0`, when in fact for very small x, the
210best approximation to `log(x+1)` would be `x`.  `log1p` calculates the best
211approximation to `log(1+x)` using a Taylor series expansion for accuracy
212(less than __te).
213Note that there are faster methods available, for example using the equivalence:
214
215   log(1+x) == (log(1+x) * x) / ((1-x) - 1)
216
217However, experience has shown that these methods tend to fail quite spectacularly
218once the compiler's optimizations are turned on.  In contrast, the series expansion
219method seems to be reasonably immune optimizer-induced errors.
220
221Finally when BOOST_HAS_LOG1P is defined then the `float/double/long double`
222specializations of this template simply forward to the platform's
223native implementation of this function.
224
225[endsect]
226
227[section sinc_pi]
228
229   template<typename T>
230   T sinc_pi(const T x);
231
232   template<typename T, template<typename> class U>
233   U<T> sinc_pi(const U<T> x);
234
235Computes
236[link boost_math.background_information_and_white_papers.sinus_cardinal_and_hyperbolic_sinus_cardinal_functions
237the Sinus Cardinal] of x. The second form is for complexes,
238quaternions, octonions... Taylor series are used at the origin
239to ensure accuracy.
240
241[endsect]
242
243[section sinhc_pi]
244
245   template<typename T>
246   T sinhc_pi(const T x);
247
248   template<typename T, template<typename> class U>
249   U<T> sinhc_pi(const U<T> x);
250
251Computes
252[link boost_math.background_information_and_white_papers.sinus_cardinal_and_hyperbolic_sinus_cardinal_functions
253the Hyperbolic Sinus Cardinal] of x. The second form is for
254complexes, quaternions, octonions... Taylor series are used at the origin
255to ensure accuracy.
256
257[endsect]
258
259[section Test Programs]
260
261The [@../../libs/math/special_functions/special_functions_test.cpp
262special_functions_test.cpp]
263and [@../../libs/math/test/log1p_expm1_test.cpp log1p_expm1_test.cpp] test programs test the functions for
264float, double and long double arguments ([@../../libs/math/special_functions/output.txt sample output], with message
265output enabled).
266
267If you define the symbol BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE, you will
268get additional output
269([@../../libs/math/special_functions/output_more.txt verbose output]),
270which may prove useful for
271tuning on your platform (the library use "reasonable" tolerances,
272which may prove to be too strict for your platform); this will only be
273helpfull if you enable message output at the same time, of course
274(by uncommenting the relevant line in the test or by adding `--log_level=messages`
275to your command line,...).
276
277[endsect]
278
279[section Acknowledgements]
280
281The mathematical text has been typeset with [@http://www.nisus-soft.com/
282Nisus Writer], and the
283illustrations have been made with [@http://www.pacifict.com/
284Graphing Calculator]. Jens Maurer
285was the Review Manager for this library. More acknowledgements in the
286History section. Thank you to all who contributed to the discution
287about this library.
288
289[endsect]
290
291[section History]
292
293* 1.5.0 - 17/12/2005: John Maddock added __log1p, __expm1 and __hypot.  Converted documentation to Quickbook Format.
294* 1.4.2 - 03/02/2003: transitionned to the unit test framework; <boost/config.hpp> now included by the library headers (rather than the test files).
295* 1.4.1 - 18/09/2002: improved compatibility with Microsoft compilers.
296* 1.4.0 - 14/09/2001: added (after rewrite) __acosh and __asinh, which were submited by Eric Ford; applied changes for Gcc 2.9.x suggested by John Maddock; improved accuracy; sanity check for test file, related to accuracy.
297* 1.3.2 - 07/07/2001: introduced namespace math.
298* 1.3.1 - 07/06/2001:(end of Boost review) split special_functions.hpp into atanh.hpp, sinc.hpp and sinhc.hpp; improved efficiency of __atanh with compile-time technique (Daryle Walker); improved accuracy of all functions near zero (Peter Schmitteckert).
299* 1.3.0 - 26/03/2001: support for complexes & all, for cardinal functions.
300* 1.2.0 - 31/01/2001: minor modifications for Koenig lookup.
301* 1.1.0 - 23/01/2001: boostification.
302* 1.0.0 - 10/08/1999: first public version.
303
304[endsect]
305
306[section To Do]
307
308* Add more functions.
309* Improve test of each function.
310
311[endsect]   
312[endsect]
313
314
Note: See TracBrowser for help on using the repository browser.