v0.15.5
Loading...
Searching...
No Matches
lambert_w_laur.hpp
Go to the documentation of this file.
1
2// Copyright Balazs Cziraki 2016.
3// Use, modification and distribution are subject to the
4// Boost Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7#ifndef BOOST_MATH_LAMBERT_W_LAUR_HPP_INCLUDED
8#define BOOST_MATH_LAMBERT_W_LAUR_HPP_INCLUDED
9
10#include <boost/array.hpp>
11#include "lambert_w_tools.hpp"
12
13namespace boost
14{
15namespace math
16{
17namespace lambw
18{
19 //Constant that controls series evaluation length
20 const std::size_t _laur_series_L = 10;
21
22 //Computes the coefficients to use with _series_sum to calculate the Taylor series for f(z)=z/W(z)
23 //which was derived from the Laurent series for W(z)^r, hence the name.
24 template<class CoeffType>
25 /*BOOST_CONSTEXPR*/ CoeffType _laur_coeffs(std::size_t k)
26 {
27 using std::pow;
28
29 CoeffType n = (CoeffType)k;
30 switch(k)
31 {
32 case 0:
33 return 1.;
34 break;
35 case 1:
36 return -0.5;
37 break;
38 default:
39 return pow(n/(n-(CoeffType)1.),n)*((CoeffType)1.-n)/(n+(CoeffType)1.);
40 break;
41 }
42 }
43
44 //Array to store the Laurent series coefficients.
45 template<class CoeffType>
46 inline const boost::array<CoeffType,_laur_series_L>& _lw_lc()
47 {
48 static const boost::array<CoeffType,_laur_series_L> ans = _coeff_array<CoeffType,_laur_series_L>(_laur_coeffs<CoeffType>);
49 return ans;
50 }
51
52 //Returns an approximation for W(z) for abs(z)<exp(-1)
53 template<class ArgumentType,class CoeffType>
54 ArgumentType _laur(const ArgumentType &z)
55 {
56 return z/_series_sum(z,_lw_lc<CoeffType>());
57 }
58} //namespace lambw
59} //namespace math
60} //namespace boost
61
62#endif // BOOST_MATH_LAMBERT_W_LAUR_HPP_INCLUDED
const double n
refractive index of diffusive medium
FTensor::Index< 'k', 3 > k
ArgumentType _laur(const ArgumentType &z)
const boost::array< CoeffType, _laur_series_L > & _lw_lc()
ArgumentType _series_sum(const ArgumentType &z, const boost::array< CoeffType, L > &c)
const std::size_t _laur_series_L
CoeffType _laur_coeffs(std::size_t k)