7#ifndef BOOST_MATH_LAMBERT_W_ITER_HPP_INCLUDED
8#define BOOST_MATH_LAMBERT_W_ITER_HPP_INCLUDED
21 template<
class ArgumentType,
class CoeffType,
class IndexType>
22 void _iter_frit(
const ArgumentType &x,
const IndexType&
k, ArgumentType &Wn)
28 if((
k!=0 &&
k!=-1) || (x!=(CoeffType)0. && x!=(ArgumentType)(-rec_e<CoeffType>())))
38 z_n = log(-x)-log(-Wn)-Wn;
42 z_n = log(x)-log(Wn)-Wn;
51 z_n = log(-x)-log(-Wn)-Wn;
55 z_n =
_log_k(x,
k)+log((CoeffType)1./Wn)-Wn;
59 ArgumentType q_n=(CoeffType)2.*((CoeffType)1.+Wn)*((CoeffType)1.+Wn+(CoeffType)2./(CoeffType)3.*z_n);
61 ArgumentType e_n=z_n/((CoeffType)1.+Wn)*(q_n-z_n)/(q_n-(CoeffType)2.*z_n);
63 Wn *= ((CoeffType)1.+e_n);
69 template<
class ArgumentType,
class CoeffType,
class IndexType>
74 fn += -fn/((CoeffType)1.+fn)+x/((CoeffType)1.+fn)*exp(-fn);
78 template<
class ArgumentType,
class CoeffType,
class IndexType>
88 fn += -fn/((CoeffType)1.+fn)+exp(log(-x)-log(-(CoeffType)1.-fn)-(fn));
92 fn += -fn/((CoeffType)1.+fn)-exp(log(-x)-log((CoeffType)1.+fn)-(fn));
100 fn += -fn/((CoeffType)1.+fn)-exp(log(x)-log(-(CoeffType)1.-fn)-(fn));
104 fn += -fn/((CoeffType)1.+fn)+exp(log(x)-log((CoeffType)1.+fn)-(fn));
110 template<
class ArgumentType,
class CoeffType,
class IndexType>
111 void _iter_newt(
const ArgumentType &x,
const IndexType&
k, ArgumentType &fn)
118 &&(abs(x+rec_e<CoeffType>())<7e-4))
124 if(((
k==0)&&(abs(x)<rec_e<CoeffType>()))
128 _iter_newt_nolog<ArgumentType,CoeffType,IndexType>(x,fn);
132 _iter_newt_wlog<ArgumentType,CoeffType,IndexType>(x,fn);
FTensor::Index< 'k', 3 > k
void _iter_frit(const ArgumentType &x, const IndexType &k, ArgumentType &Wn)
void _iter_newt(const ArgumentType &x, const IndexType &k, ArgumentType &fn)
void _iter_newt_nolog(const ArgumentType &x, ArgumentType &fn)
ArgumentType _log_k(const ArgumentType &z, const IndexType &k)
void _iter_newt_wlog(const ArgumentType &x, ArgumentType &fn)
CoeffType _complex_imag(const CoeffType &z)
CoeffType _complex_real(const CoeffType &z)