https://mizugadro.mydns.jp/t/index.php?title=SuZex_approximation&feed=atom&action=historySuZex approximation - Revision history2020-05-29T02:11:53ZRevision history for this page on the wikiMediaWiki 1.31.7https://mizugadro.mydns.jp/t/index.php?title=SuZex_approximation&diff=27965&oldid=prevT: Text replacement - "\$([^\$]+)\$" to "\\(\1\\)"2019-07-30T09:25:40Z<p>Text replacement - "\$([^\$]+)\$" to "\\(\1\\)"</p>
<a href="https://mizugadro.mydns.jp/t/index.php?title=SuZex_approximation&diff=27965&oldid=939">Show changes</a>Thttps://mizugadro.mydns.jp/t/index.php?title=SuZex_approximation&diff=939&oldid=prevMaintenance script at 06:01, 20 June 20132013-06-20T06:01:43Z<p></p>
<p><b>New page</b></p><div>[[File:SuZexPlot511T.jpg|140px|left|thumb| Fig.1. $y\!=\!\mathrm{SuSex}(x)~$, thick blue line, and $y\!=\!\mathrm{zex}(x)\!=\!x\mathrm e^x$, thin line]]<br />
[[File:SuZexMapT.jpg|600px|thumb|Fig.2.[[Complex map]] of function [[SuZex]]: $~u\!+\!\mathrm i v= \mathrm{SuZex}(x_1+x\!+\!\mathrm i y)$]]<br />
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.<br />
==Background==<br />
[[SuZex]] is [[superfuncton]] for the [[transfer function]] $T=\,\,$[[zex]]; <br />
<br />
(1) $~ ~ ~ T(z)=\mathrm{zex}(z) = z\,\exp(z)~$<br />
<br />
The superfunction $F=\mathrm{SuZex}$ satisfies the [[transfer equation]]<br />
<br />
(2) $ ~ ~ ~ T(F(z))=F(z\!+\!1)$<br />
<br />
and the additional condition<br />
<br />
(3) $ ~ ~ ~ F(0)=1$<br />
<br />
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)^*$,<br />
<br />
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)$).<br />
<br />
Sorry, the figure 2 is not yet loaded.<br />
<br />
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.<br />
<br />
==Taylor expansion at zero==<br />
<div class="thumb tleft"><div style="width:13em;">$\begin{array}{rl}<br />
n&c_n\\<br />
0&1.\\<br />
1& 0.7136859972397819\\<br />
2& 0.4476015977075872\\<br />
3& 0.2601727742107340\\<br />
4& 0.1435143556173126\\<br />
5& 0.0761226590985602\\<br />
6& 0.0391492705396854\\<br />
7& 0.0196328627708593\\<br />
8& 0.0096397364554956\\<br />
9& 0.0046483274109356\\<br />
10&0.0022065106994065\\<br />
11&0.0010330188519910\\<br />
12&0.0004777086233718\\<br />
13&0.0002184810190843\\<br />
14&0.0000989267835284\\<br />
15&0.0000443861459533\\<br />
16&0.0000197488866685<br />
\end{array}$<br />
</div></div><br />
<div class="thumb tright"><!--<br />
<div style="width:34em;"> !--><br />
<div style="width:500px"><br />
[[File:SuZex0map48small.png|160px]]<br />
[[File:SuZexMapSmall48c.png|160px]]<br />
[[File:SuZexTay0testT.png|160px]]<br />
<br />
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. <br />
</div></div><br />
<br />
[[File:SuZexoMapJPG.jpg|600px|thumb|Fig.4. Map od the Asymptotic approximation $Q_{20}~$ by equation ($~$); $~u\!+\!\mathrm i v= Q_{20}(x_1+x\!+\!\mathrm i y)$]]<br />
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,<br />
<br />
(4) $ ~ ~ ~ ~\displaystyle \mathrm{SuZex}(z) \approx P_{N}(z)=\sum_{n=0}^{N} \,c_n\, z^n$<br />
<br />
Approximations for the first 17 coefficients $c$ or the expansion are shown in table at left.<br />
More coefficients are available at [[SuZexTay0co.cin]] .<br />
<br />
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.<br />
<br />
For evaluation of [[SuZex]] of real argument, the polynomial approximation is sufficient, the values of function can be reconstructed applying iteratively the Transfer equation<br />
<br />
(5) $ ~ ~ ~ ~ \mathrm{SuZex}(z\!+\!1)=\mathrm{zex}\Big(\mathrm{SuZex}(z)\Big)$<br />
<br />
or its modification<br />
<br />
(6) $ ~ ~ ~ ~ \mathrm{SuZex}(z\!-\!1)=\mathrm{LambertW}\Big(\mathrm{SuZex}(z)\Big)$<br />
<br />
For function [[zex]]$(z)=z \exp(z)$ and its inverse [[LambertW]]$=\mathrm{zex}^{-1}$, the efficient compex(double) numerical implementations are available.<br />
<br />
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<br />
<br />
(7) $ ~ ~ ~ ~\displaystyle A_{48}(z)= -\lg \left( \frac<br />
{|P_{48}(z) - \mathrm{SuZex}(z)|}<br />
{|P_{48}(z)| + |\mathrm{SuZex}(z)|}<br />
\right) $<br />
<br />
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.<br />
<br />
==Expansion at infinity==<br />
[[File:SuZexo20testTjpg.jpg|600px|thumb|Fig.5. Map of agreement $B_{20}$ by equation (12) for the asymptotic approximation $Q_{20}$ by equations (9, (10);<br />
(8) $~ ~ ~ u\!+\!\mathrm i v\!=\!B_{20}(x\!+\!\mathrm i y)$]]<br />
<br />
For large values of the argument, [[SuZex]] can be approximated using the asymptotic expansion. Let<br />
<br />
(9) $~ ~ ~ \displaystyle Q_N(z)=\frac{1}{z}\, \sum_{n=0}^{N} \, z^{-n}\, \sum_{m=0}^n\, a_{m,n} \ell^m$<br />
<br />
where $\ell=\ln(-z)$. Then <br />
<br />
(10) $~ ~ ~\mathrm{SuZex}(z) \approx Q_N(x_1\!+\!z)~$<br />
<br />
where $x_1\!\approx\! -1.1259817765745028~$ is solution of the equation<br />
<br />
(11) $~ ~ ~\displaystyle \lim_{k \rightarrow \infty} \mathrm{zex}^k\Big(Q_N(x_1-k)\Big) = 1$<br />
<br />
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.<br />
<br />
The [[complex map]] of $Q(x_1\!+\!z)$ for $z\!=\!x\!+\!\mathrm i y$ <br />
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$<br />
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.<br />
<br />
Coefficients $a_{n,m}$ in the expansion:<br />
<br />
$\begin{array}{cccccccccc}<br />
~ ~ n ~ \backslash~ m\!\! & \bf 0 & \bf 1 & \bf 2 & \bf 3 &\\<br />
\!\bf 0&-1& 0 & 0 &0\\<br />
\!\bf 1& 0&1/2&0 &0\\<br />
\!\bf 2& -1/6& 1/4& -1/4 &0\\ <!--<br />
\frac{7}{48} & \frac{3}{8} & -\frac{5}{16} & \frac{1}{8} !--><br />
\!\bf 3& {-7}/{48}~ & {3}/{8} & -{5}/{16}~ & {1}/{8} <br />
\end{array}$<br />
<br />
Below the same table appears as the Mathematica output produced after calculation of the coefficients with the command <br />
<br />
<b><br />
TeXForm[Table[Table[If[n >= m, a[n, m], 0], {m, 0, 7}], {n, 0, 7}]] </b><br />
<br />
$\!\!\!\!\!\!\!\!\!\! ^{<br />
\begin{array}{ccccccccccc}<br />
-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\<br />
0 & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 & 0 \\<br />
-\frac{1}{6} & \frac{1}{4} & -\frac{1}{4} & 0 & 0 & 0 & 0 & 0 \\<br />
-\frac{7}{48} & \frac{3}{8} & -\frac{5}{16} & \frac{1}{8} & 0 & 0 & 0 & 0 \\<br />
-\frac{707}{4320} & \frac{23}{48} & -\frac{17}{32} & \frac{13}{48} & -\frac{1}{16} & 0 & 0 & 0 \\<br />
-\frac{1637}{8640} & \frac{1121}{1728} & -\frac{83}{96}<br />
& \frac{37}{64} & -\frac{77}{384} & \frac{1}{32} & 0 & 0 \\<br />
-\frac{274133}{1209600} & \frac{15427}{17280} &<br />
-\frac{1619}{1152} & \frac{443}{384} &<br />
-\frac{205}{384} & \frac{87}{640} & -\frac{1}{64} & 0 \\<br />
-\frac{4024763}{14515200} & \frac{142801}{115200} &<br />
-\frac{156559}{69120} & \frac{1915}{864} &<br />
-\frac{1307}{1024} & \frac{53}{120} &<br />
-\frac{223}{2560} & \frac{1}{128} <!--\\<br />
-\frac{633245021}{1828915200} & \frac{5019103}{2903040}<br />
& -\frac{2496407}{691200} & \frac{214009}{51840} &<br />
-\frac{157849}{55296} & \frac{4769}{3840} &<br />
-\frac{3115}{9216} & \frac{481}{8960} &<br />
-\frac{1}{256} & 0 \\<br />
-\frac{403880483}{914457600} &<br />
\frac{328194077}{135475200} &<br />
-\frac{110236243}{19353600} &<br />
\frac{31028023}{4147200} & -\frac{3357353}{552960} &<br />
\frac{196001}{61440} & -\frac{101417}{92160} &<br />
\frac{17499}{71680} & -\frac{4609}{143360} &<br />
\frac{1}{512} <br />
!--><br />
\end{array}}$<br />
<!-- The only parenthesis are suppressed in the expression above. !--><br />
<br />
The precision of the approximation through the asymptotic expansion (9) can be characterized with agreement <br />
<br />
(12) $ ~ ~ ~ \displaystyle<br />
B_{N}(z)=- \lg\left( <br />
\frac{|Q_N(x_1\!+\!z)-\mathrm{SuZex}(z)|}<br />
{|Q_N(x_1\!+\!z)|+|\mathrm{SuZex}(z)|} <br />
\right)$<br />
<br />
For $N\!=\!20$, this function is shown in figure 5. <br />
Outside the loops, the approximation provides at least 15 correct decimal digits.<br />
While $\Re(z)<5$, for $|z\!+\!2|>8$, the error of approximation of $\mathrm{SuZex}(z)$ with <br />
$Q_N(x_1\!+\!z)$ is smaller than the rounding errors at the use of the [[complex double]] arithmetics.<br />
<br />
==Taylor expansion at $z=-12+x_1$==<br />
[[File:SuZexTay2008t12MapT.jpg|600px|thumb|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)$]]<br />
[[File:SuZexTay2008deviTjpg.jpg|600px|thumb|Fig.7. Agreement $C_{80}$ by (15) of the approximation of [[SuZex]] with the Taylor expansion $\Phi_{12,80}$ at $-12+x_1$]]<br />
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$<br />
<br />
The [[Taylor approximation]] $\Phi$ of [[SuZex]] at some point $z_{12}$ can be written as the truncated [[Taylor series]],<br />
<br />
(13) $ ~ ~ ~ \Phi_{12,N}(z)=$ $<br />
\displaystyle<br />
\sum_{n=0}^N f_n (z-z_{12})^n=$ $ \displaystyle<br />
\sum_{n=0}^N f_n (z+12-x_{1})^n$<br />
<br />
The coefficients $f$ in (13) were evaluated from the asymptotic approximation, expanding expression<br />
<br />
(14) $~ ~ ~ \mathrm{zex}^8\Big( Q_{20}(-20\!+\!z) \Big)$<br />
<br />
at small values of $z$.<br />
<br />
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. <br />
<br />
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.<br />
<br />
The precision of approximation of [[SuZex]] with function $\Phi$ by (13) can be characterized with the agreement<br />
<br />
(15) $ ~ ~ ~ \displaystyle<br />
C_{N}(z)=- \lg\left( <br />
\frac{|\Phi_N(z)-\mathrm{SuZex}(z)|}<br />
{|\Phi_N(z)|+|\mathrm{SuZex}(z)|} <br />
\right)$<br />
<br />
For $N=80$, the map of agreement by (15) is shown in Figure 7. (Hope, the last figure to be loaded for this article)<br />
<br />
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).<br />
<br />
==Numerical implementation==<br />
<br />
The numerical impementation [[SuZex.cin]] in [[C++]] of function [[SuZex]] is constructed on the base of approximations described above.<br />
<br />
For $|\Im(z)|\!>\!8$ the espansion $Q$ is used.<br />
<br />
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)$<br />
<br />
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)$.<br />
<br />
If not a case, for $|z\!+\!12\!+\!x_1|<8.1$, the approximation $\Phi$ is used; and, fot positive $~\Re(z)~$, but<br />
$~|\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)$.<br />
<br />
For the rest of cases, id est, $\Re(z)<-14$, again, the asymptotic expansion $Q$ is used.<br />
<br />
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.<br />
<br />
==Keywords==<br />
[[SuZex]], [[zex]], [[Superfunction]]<br />
<br />
[[Category:Suzex]]<br />
[[Category:zex]]<br />
[[Category:Superfunction]]<br />
[[Category:Articles in English]]</div>Maintenance script