SuZex approximation

From TORI
Jump to: navigation, search
Fig.1. $y\!=\!\mathrm{SuSex}(x)~$, thick blue line, and $y\!=\!\mathrm{zex}(x)\!=\!x\mathrm e^x$, thin line
Fig.2.Complex map of function SuZex: $~u\!+\!\mathrm i v= \mathrm{SuZex}(x_1+x\!+\!\mathrm i y)$

This article collects approximations of function SuZex, which is superfunction of zex$\,(z)=z\exp(z)~$. The complex map of SuZex is shown in figure at right. Below, it is compared to similar maps for various approximations of SuZex with elementary functions. All the maps are supposed to be displayed in the same scale.

Contents

Background

SuZex is superfuncton for the transfer function $T=\,\,$zex;

(1) $~ ~ ~ T(z)=\mathrm{zex}(z) = z\,\exp(z)~$

The superfunction $F=\mathrm{SuZex}$ satisfies the transfer equation

(2) $ ~ ~ ~ T(F(z))=F(z\!+\!1)$

and the additional condition

(3) $ ~ ~ ~ F(0)=1$

Also, it is assumed that the solution $F=\mathrm{SuZex}$ decays to the stationary point 0 of the transfer function $T$ by (1) at infinity, except some strip along the positive part of the real axis. The superfunction $F=\mathrm{SuZex}$ is real–holomorphic; $F(z^*)=F(z)^*$,

For real values of the argument, the explicit plot $y=\mathrm{SuZex}(x)$ is shown in figure 2. The function is positive and increasing along the whole real axis; all its derivatives are also positive. The function slowly raises since zero at minus infinity, passes through point (0,1) and then shows the fast growth, similar to that of the SuperFactorial and that o the tetration (to base $b\!>\! \exp^2(-1)$).

Sorry, the figure 2 is not yet loaded.

For the efficient (id est, fast and precise) evaluation of SuZex, various approximations are described below. They are used in the C++ implementation of function SuZex, called by generators of figures, and, in particular, figures 1 and 2.

Taylor expansion at zero

$\begin{array}{rl} n&c_n\\ 0&1.\\ 1& 0.7136859972397819\\ 2& 0.4476015977075872\\ 3& 0.2601727742107340\\ 4& 0.1435143556173126\\ 5& 0.0761226590985602\\ 6& 0.0391492705396854\\ 7& 0.0196328627708593\\ 8& 0.0096397364554956\\ 9& 0.0046483274109356\\ 10&0.0022065106994065\\ 11&0.0010330188519910\\ 12&0.0004777086233718\\ 13&0.0002184810190843\\ 14&0.0000989267835284\\ 15&0.0000443861459533\\ 16&0.0000197488866685 \end{array}$

SuZex0map48small.png SuZexMapSmall48c.png SuZexTay0testT.png

Fig.3. Taylor approximation (4) with 48 terms; $!u\!+\!\mathrm i v= P_{48}(x\!+\!\mathrm i y)$, left; the same and map of $u\!+\!\mathrm i v= \mathrm{SuZex}(x\!+\!\mathrm i y)$, center; and the agreement $A_{48}(x\!+\!\mathrm i y)$, right.

Fig.4. Map od the Asymptotic approximation $Q_{20}~$ by equation ($~$); $~u\!+\!\mathrm i v= Q_{20}(x_1+x\!+\!\mathrm i y)$

The simple approximation of any function is, perhaps, the truncated Taylor series, which is, actually, a polynomial. The complex map of such a polynomial of power $N\!=\!42$ is shown in the figure 3,

(4) $ ~ ~ ~ ~\displaystyle \mathrm{SuZex}(z) \approx P_{N}(z)=\sum_{n=0}^{N} \,c_n\, z^n$

Approximations for the first 17 coefficients $c$ or the expansion are shown in table at left. More coefficients are available at SuZexTay0co.cin .

The series converges, and the increase of the number of terms taken into account extends the range of approximation. However, due to the fast growth of the function at real values of the argument, practically the application of the approximation is limited by a circle $|z|\!<\!2$; for larger values, the enormous amount of coefficients should be taken into account, and the rounding errors destroy the precision of the approximation.

For evaluation of SuZex of real argument, the polynomial approximation is sufficient, the values of function can be reconstructed applying iteratively the Transfer equation

(5) $ ~ ~ ~ ~ \mathrm{SuZex}(z\!+\!1)=\mathrm{zex}\Big(\mathrm{SuZex}(z)\Big)$

or its modification

(6) $ ~ ~ ~ ~ \mathrm{SuZex}(z\!-\!1)=\mathrm{LambertW}\Big(\mathrm{SuZex}(z)\Big)$

For function zex$(z)=z \exp(z)$ and its inverse LambertW$=\mathrm{zex}^{-1}$, the efficient compex(double) numerical implementations are available.

Figures at right show the complex map of the approximation $P_{48}$, its overlap with the map of SuZex and the agreement $A_{48}$ with SuZex defined with

(7) $ ~ ~ ~ ~\displaystyle A_{48}(z)= -\lg \left( \frac {|P_{48}(z) - \mathrm{SuZex}(z)|} {|P_{48}(z)| + |\mathrm{SuZex}(z)|} \right) $

This agreement indicates, how many decimal digits does the approximation for certain $z=x\!+\!\mathrm i y$; levels $A=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15$ are drawn. In the central part, the approximation provides of order of 15 decimal digits. Outside the outher loop, the agreement is smaller than unity, id est, even first digit of the estimate of SuZex by the approximation $P_{48}$ is doubtful. This loop has light excess at the real part of the real axis bevause of huge denominator in the definition of $A_{48}$. The inner part is still sufficient for the implementation of SuZex along the real axis, using the transfer equation; the error due to the approximation is smaller than the rounding error at the double precision arithmetics. Perhaps, even less terms would be sufficient for the professional implementation of this superfunction.

Expansion at infinity

Fig.5. Map of agreement $B_{20}$ by equation (12) for the asymptotic approximation $Q_{20}$ by equations (9, (10); (8) $~ ~ ~ u\!+\!\mathrm i v\!=\!B_{20}(x\!+\!\mathrm i y)$

For large values of the argument, SuZex can be approximated using the asymptotic expansion. Let

(9) $~ ~ ~ \displaystyle Q_N(z)=\frac{1}{z}\, \sum_{n=0}^{N} \, z^{-n}\, \sum_{m=0}^n\, a_{m,n} \ell^m$

where $\ell=\ln(-z)$. Then

(10) $~ ~ ~\mathrm{SuZex}(z) \approx Q_N(x_1\!+\!z)~$

where $x_1\!\approx\! -1.1259817765745028~$ is solution of the equation

(11) $~ ~ ~\displaystyle \lim_{k \rightarrow \infty} \mathrm{zex}^k\Big(Q_N(x_1-k)\Big) = 1$

For $N\!=\!20$, the complex map of approximation (8) is shown in Figure 4. Practically, with $k\!=\! 20$, the error of evaluation of $x_1$ becomes of order of rounding errors at the "double" precision; at $\Re(z)\!<\!-20$, the last term in the asymptotic expansion is smaller than $10^{-16}$ and does not contribute to the estimated value.

The complex map of $Q(x_1\!+\!z)$ for $z\!=\!x\!+\!\mathrm i y$ is shown in figure at right. In the region $~x\!<\!0~$, $~x^2\!+\!y^2\!<\!4~$, the approximation through $Q(20)$ shows reasonable agreement with the polynomial expansion $P_{48}$ above. In particular, the same level $v\!=\!0.4$ looks in the similar way in both figures. However, the corresponding values of the argument are out of range of high precision of each of the approximations.

Coefficients $a_{n,m}$ in the expansion:

$\begin{array}{cccccccccc} ~ ~ n ~ \backslash~ m\!\! & \bf 0 & \bf 1 & \bf 2 & \bf 3 &\\ \!\bf 0&-1& 0 & 0 &0\\ \!\bf 1& 0&1/2&0 &0\\ \!\bf 2& -1/6& 1/4& -1/4 &0\\ \!\bf 3& {-7}/{48}~ & {3}/{8} & -{5}/{16}~ & {1}/{8} \end{array}$

Below the same table appears as the Mathematica output produced after calculation of the coefficients with the command

TeXForm[Table[Table[If[n >= m, a[n, m], 0], {m, 0, 7}], {n, 0, 7}]]

$\!\!\!\!\!\!\!\!\!\! ^{ \begin{array}{ccccccccccc} -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 & 0 \\ -\frac{1}{6} & \frac{1}{4} & -\frac{1}{4} & 0 & 0 & 0 & 0 & 0 \\ -\frac{7}{48} & \frac{3}{8} & -\frac{5}{16} & \frac{1}{8} & 0 & 0 & 0 & 0 \\ -\frac{707}{4320} & \frac{23}{48} & -\frac{17}{32} & \frac{13}{48} & -\frac{1}{16} & 0 & 0 & 0 \\ -\frac{1637}{8640} & \frac{1121}{1728} & -\frac{83}{96} & \frac{37}{64} & -\frac{77}{384} & \frac{1}{32} & 0 & 0 \\ -\frac{274133}{1209600} & \frac{15427}{17280} & -\frac{1619}{1152} & \frac{443}{384} & -\frac{205}{384} & \frac{87}{640} & -\frac{1}{64} & 0 \\ -\frac{4024763}{14515200} & \frac{142801}{115200} & -\frac{156559}{69120} & \frac{1915}{864} & -\frac{1307}{1024} & \frac{53}{120} & -\frac{223}{2560} & \frac{1}{128} \end{array}}$

The precision of the approximation through the asymptotic expansion (9) can be characterized with agreement

(12) $ ~ ~ ~ \displaystyle B_{N}(z)=- \lg\left( \frac{|Q_N(x_1\!+\!z)-\mathrm{SuZex}(z)|} {|Q_N(x_1\!+\!z)|+|\mathrm{SuZex}(z)|} \right)$

For $N\!=\!20$, this function is shown in figure 5. Outside the loops, the approximation provides at least 15 correct decimal digits. While $\Re(z)<5$, for $|z\!+\!2|>8$, the error of approximation of $\mathrm{SuZex}(z)$ with $Q_N(x_1\!+\!z)$ is smaller than the rounding errors at the use of the complex double arithmetics.

Taylor expansion at $z=-12+x_1$

Fig.6. Approximation of SuZex with the Taylor expansion $\Phi_{12,80}$ at $-12+x_1$ ; here $u\!+\!\mathrm i v=\Phi(x_1\!+\!12+ x\!+\!\mathrm i y)$
Fig.7. Agreement $C_{80}$ by (15) of the approximation of SuZex with the Taylor expansion $\Phi_{12,80}$ at $-12+x_1$

At positive part of the real axis, the asymptotic approximation above has the cutline; for moderate values of the real part of the argument, the Taylor expansion would be better. In addition, the precise evaluation with direct application of the asymptotic expansion requires $N$ of order of 20, and needs approximately $N^2$ (id est, of order of 400) operations. The speed of evaluation can be boosted doe an order of magnitude with the Taylor expansion at some point far from the region of fast growth of function SuZex. Such a point is chosen to be $z_{12}=-12\!+\!x_1\approx -13.1$

The Taylor approximation $\Phi$ of SuZex at some point $z_{12}$ can be written as the truncated Taylor series,

(13) $ ~ ~ ~ \Phi_{12,N}(z)=$ $ \displaystyle \sum_{n=0}^N f_n (z-z_{12})^n=$ $ \displaystyle \sum_{n=0}^N f_n (z+12-x_{1})^n$

The coefficients $f$ in (13) were evaluated from the asymptotic approximation, expanding expression

(14) $~ ~ ~ \mathrm{zex}^8\Big( Q_{20}(-20\!+\!z) \Big)$

at small values of $z$.

The complex map of the expansion (13) for $N\!=\!80$ is shown in figure 6. The point of expansion (approximately, $-13.1259817765745028$) is a little bit outside the field covered by the map. In order to simplify the comparison with other pictures, the same scale is used.

The constant 20 in expression (14) is chosen for the following reason. While doing numerical calculation with complex double variables, with 21 terms of the expansion (8), the last term does not affect the value $Q_20(z)$ for $\Re(z)<-20$. The additional misplacement of the expansion point to the left would not improve the precision of the evaluation. The precision can be improved, using some patience (to press a key, to have a tea) and the long double variables; then it would have sense to get more terms in asymptotic expansion (9) and use more iterations of function zex in (14). However, the 15 digits seem to be more than sufficient to plot all the figures. In particular, the expansion (13) reproduces such properties of function SuZex as its value unity at zero and even value 2.7.. (approximately $\mathrm e$) at unity, although $\Phi(z)$ it is designed to approximate $\mathrm{Suzex}(z)$ in vicinity of $z\!=\!-12$, id est, mainly outside of the field of the map shown.

The precision of approximation of SuZex with function $\Phi$ by (13) can be characterized with the agreement

(15) $ ~ ~ ~ \displaystyle C_{N}(z)=- \lg\left( \frac{|\Phi_N(z)-\mathrm{SuZex}(z)|} {|\Phi_N(z)|+|\mathrm{SuZex}(z)|} \right)$

For $N=80$, the map of agreement by (15) is shown in Figure 7. (Hope, the last figure to be loaded for this article)

Inside the loop, the approximation (14) gives at least 15 decimal digits, and the deviation in 16th digits (not plotted) should be attributed to the rounding errors (in particular in the evaluation of the Taylor coefficients $f$, but not to the lack of term in the Taylor polynomial (13).

Numerical implementation

The numerical impementation SuZex.cin in C++ of function SuZex is constructed on the base of approximations described above.

For $|\Im(z)|\!>\!8$ the espansion $Q$ is used.

For small values of $|z|<1.6$, the Taylor expansion (4) at zero is used, truncated keeping the 96th power of $z$, id est, $P_{96}(z)$ is used as approximation of $\mathrm{SuZex}(z)$

For positive $~\Re(z)~$, but $~|\Im(z)|\!<\!1.5~$, the iteration $~\mathrm{zex}^n( P_{96}(z\!-\!n)~$is used as approximation of $\mathrm{SuZex}(z)$, with integer $~n \!\approx\! \Re(z)$.

If not a case, for $|z\!+\!12\!+\!x_1|<8.1$, the approximation $\Phi$ is used; and, fot positive $~\Re(z)~$, but $~|\Im(z)|\!<\!1.5~$, the iteration $~\mathrm{zex}^n\!\Big( \Phi(z\!-\!n)\Big)~$is used as approximation of $\mathrm{SuZex}(z)$, with integer $~n \!\approx\! \Re(z)$.

For the rest of cases, id est, $\Re(z)<-14$, again, the asymptotic expansion $Q$ is used.

The approximations described above have wide areas of overlapping, where at least two or three of approximations above provide at least 15 correct decimal digits. This allows to use the implementation without any further worries about the error of the approximation. The SuZex can be used as any other special function with known behavior, known asymptotic and the efficient algorithm for the evaluation available.

Keywords

SuZex, zex, Superfunction