### Section B: Computing the branching parameters of T(w;z)

$$\newcommand{\bint}{\displaystyle{\int\hspace{-10.4pt}\Large\mathit{8}}} \newcommand{\res}{\displaystyle{\text{Res}}} \newcommand{Log}{\text{Log}} \newcommand{Arg}{\text{Arg}} \newcommand{pLog}{\text{pLog}}$$

#### Work in progress . . .

In this section, the code for computing the branching parameters of $T_2(w;z)=w-z^{z^w}$ is reviewed. These computations are described in A systematic approach to computing and indexing the fixed points of an iterated exponential. Readers are encouraged to review this link and Section A prior to reading this section.

Recall the $1$-cycle and $2$-cycle expressions for constant $z$: \begin{equation} \begin{aligned} T_1(w;z)&=w-z^w\equiv w-e^{w\Log(z)}, \\ T_2(w;z)&=w-z^{z^w}\equiv w-e^{z^w \Log(z)}\equiv w-e^{\Log(z)e^{w\Log(z)}}, \end{aligned} \label{equation:eqn0} \end{equation} where $\Log(z)=\ln|z|+i\theta$ with $\theta=\Arg(z)$ and $-\pi\lt \Arg(z)\leq \pi$.

Letting $\Log(z)=a+bi$ and $w=x+iy$, the iterated exponent of $T_2(w;z)$ is split into a real and imaginary part:

$$\begin{equation} \begin{split} \text{imagF2B}(x,y)&=\text{exp}\bigg\{e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]\bigg\}\\ &\hspace{20pt}\times\sin\bigg\{e^{ax-by}\big[a\sin(ay+bx)+b\cos(ay+bx)\big]\bigg\} \end{split} \label{eqn:eqn100a} \end{equation}$$ $$\begin{equation} \begin{split} \text{realF2B}(x,y)&=\text{exp}\bigg\{e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]\bigg\}\\ &\hspace{20pt}\times\cos\bigg\{e^{ax-by}\big[a\sin(ay+bx)+b\cos(ay+bx)\big]\bigg\}. \end{split} \label{eqn:eqn100b} \end{equation}$$ Setting $\texttt{realF2B}(x,y)=x$ and $\texttt{imagF2B}(x,y)=y$, we can generate a (base) contour plot of $T_2$. However, this would be problematic in most cases since for most values of $z$, the branching is tilted with respect to the axes and this tilt causes plotting problems. But the problems can be eliminated by rotating the functions, plotting the rotated contour diagram, then inverting the plot data to obtain a nice base plot.

Below are three branches of the base and normal contour plots for $z=2e^{\pi i/6}$. Recall the real and imaginary contors are in red and blue respectively. $\texttt{branchF}(v,\psi)$ plots are brown and two example $\texttt{leafF}(v,\phi)$ plots are black. Seeds for the root iterations are shown as green points near the apex of each brown plot. Each branch bulb region is delineated by purple and cyan lines with the associated branch number between them. The branch numbers are determined by the asymptotes of $\texttt{branchF}$.

Refer to the cited paper for more information about the various components of the plots. We review the rotation transformation, identification of branch and leaf numbers, computation of seeds, and the auxiliary functions $\texttt{branchF}(v,\psi)$ and $\texttt{leafF}(v,\phi)$.

1. Computing the rotation angle
2. The inclination angle, the angle of the contour branch bulbs with respect to the coordinate axes, is $\alpha=\arctan(a/b)$ where $a=\ln(|z|)$ and $b=\Arg(z)$. So that if we wanted to rotate the base contour above counter clockwise so that the branching is horizontal and opening to the right, we would rotate the plot by $\beta=\pi/2-\alpha$. One important point should be noted here: in order to implement arbitrary precision arithmetic, most calculations are done symbolically and then fixed to a desired precision for the actual root computations. However, for plotting purposes, we can use machine precision. Therefore, to generate a normalized plot of the above test case, we rotate the base plot counter-clockwise by $\texttt{beta}=\pi/2-\alpha\approx 0.6469$.

3. Generating the normalized (rotated) contour plot
4. It's a simple matter to create a rotation transform in Mathematica. Given the point $\{x,y\}$, rotation of the point by $\texttt{beta}$ is coded by: $$\texttt{rotationF[\{x_, y_\}, beta_] := RotationTransform[beta][\{x, y\}];}$$ and for each term: \begin{aligned} \texttt{rotX[x_, beta_] = rotationF[{x, y}, beta][];}\\ \texttt{rotY[y_, beta_] = rotationF[\{x, y\}, beta][]}; \end{aligned} so that the Mathematica code to rotate the base contour plots is:

#### Mathematica code 1

 zSample=2 Exp[Pi I/6]; a = Log[Abs[zSample]]; b = Arg[zSample]; beta=ArcTan[a/b]; betaN=N[beta]; realF1[x_, y_] := Exp[a x - b y] Cos[a y + b x]; imagF1[x_, y_] := Exp[a x - b y] Sin[a y + b x]; realF2[x_, y_] := Exp[a realF1[x, y] - b imagF1[x, y]] Cos[a imagF1[x, y] + b realF1[x, y]]; imagF2[x_, y_] :=Exp[a realF1[x, y] - b imagF1[x, y]] Sin[a imagF1[x, y] + b realF1[x, y]]; totalPoints = 50; rotatedRealF2Plot = ContourPlot[realF2 @@ rotationF[x, y, -betaN] == rotX[x, -betaN], {x,theRotatedMinUTerm, theRotatedMaxUTerm}, {y, theRotatedMinVTerm,theRotatedMaxVTerm}, ContourStyle -> Red,PlotPoints -> totalPoints]; rotatedImagF2Plot = ContourPlot[imagF2 @@ rotationF[x, y, -betaN] == rotY[y, -betaN], {x,theRotatedMinUTerm,theRotatedMaxUTerm},y,theRotatedMinVTerm,theRotatedMaxVTerm}, ContourStyle -> Blue,PlotPoints -> totalPoints]; 

The code above does not include the plotting dimensions. And for just a rough plot, we can use $\{x,-5,5\}$ and $\{y,-15,15\}$ but will need to more precisely define these dimensions in order to avoid plotting problems. In order to do this, we first have to compute the auxiliary functions.

5. Computing the auxiliary function $\texttt{branchF}(v,\psi)$
6. The auxiliary functions $\texttt{branchF}$ and $\texttt{leafF}$ are used for several purposes:

1. Delimit the branch and leaf lobes,
2. Define branch and leaf numbers,
3. Generate precise base contour plots,
4. Locate iteration seeds close to roots.
In order to compute $\texttt{branchF}$, assign the argument of the outer exponential in (\ref{eqn:eqn100a}) to a constant: $$\begin{equation} e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]=\psi \label{eqn:eqn200} \end{equation}$$ Now solve for one variable in terms of the other. In general this cannot be done in closed form. However, if the expressions are normalized via rotation transforms, the variables become separated. We use the following steps:
1. Normalize (rotate) (\ref{eqn:eqn200}) in terms of new variables (u,v) to easily distinguish the rotated form from the base form,
2. Solve the rotated expressions for $u$ in terms of $v$. The resulting expression becomes the auxiliary function $\texttt{branchF}$ which has a trignometric logarithm. The zeros of the trignometric term become the branch numbers delineated by the corresponding asymptotes,
3. Compute the asymptotes of $\texttt{branchF}$,
4. From the asymptotes, compute branch delimiters and branch numbers,

The following Mathematica code is used. Note in particular the use of variable $\texttt{beta}$. This is the arbitrary-precision version of the transformation angle $\beta$ so that all calculation results are arbitrary precision since $\texttt{zSample}$ is defined in terms of rational or symbolic values.

#### Mathematica code 2

 branchArgumentF[x_, y_] :=Exp[a x - b y] (a Cos[a y + b x] - b Sin[a y + b x]); (* transform expression *) transformedBranchF = branchArgumentF @@ rotationF[u, v, -beta] (* solve for u in terms of v *) branchSol = u /. Solve[transformedBranchF == \[Psi], u] // FullSimplify logrule = {Log[x_] + Log[y_] :> Log[x y],Log[x_] - Log[y_] :> Log[x/y]}; branchSol = branchSol //. logrule branchF[v_, \[Psi]_] := branchSol // First (* create asymptote funtion *) branchAsyF[v_] :=Denominator@(Cases[branchSol // First, Log[logArg_] :> logArg]) //First (* solve for zeros of branchAsyF *) branchAsyZerosF[c_] = (v /. Normal@Solve[branchAsyF[v] == 0, v]) /.C -> c 

This code produces, for $z=2e^{\pi i/6}$, the following $\texttt{branchF}$ functions: \begin{aligned} \texttt{branchF}(v,\psi)&=\frac{6 \Log \left(\frac{6 \psi }{\Log (64) \cos \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)-\pi \sin \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)}\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}}\\ \texttt{branchAsyF}(v)&=\Log (64) \cos \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)-\pi \sin \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)\\ \texttt{branchAsyZerosF}(c)&=\left\{\frac{6 \left(2 \pi c+\tan ^{-1}\left(\frac{\Log (64)}{\pi }\right)\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}},\frac{6 \left(2 \pi c-\pi +\tan ^{-1}\left(\frac{\Log (64)}{\pi }\right)\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}}\right\} \end{aligned} The brown traces in Figure 1 are plots of $\texttt{branchF}(v,\psi)$ for suitably-chosen values of $\psi$. Both the branch numbers and purple and cyan branch delimiters are defined by the zeros of $\texttt{branchAsyF}$ given by the expressions of $\texttt{branchAsyZerosF}$.

The following table summarizes in machine-precision, the rotated branch parameters for $z=2e^{\pi i/6}$:

$$\begin{array}{cccc} \text{Branch Num} & \text{Branch Domain} & \text{Lower Leaf Domain} & \text{Upper Leaf Domain} \\ -3. & \{-24.252,-20.6355\} & \{-26.0603,-22.4438\} & \{-22.4438,-18.8273\} \\ -2. & \{-17.019,-13.4025\} & \{-18.8273,-15.2108\} & \{-15.2108,-11.5943\} \\ -1. & \{-9.786,-6.1695\} & \{-11.5943,-7.97775\} & \{-7.97775,-4.36125\} \\ 0. & \{-2.55299,1.06351\} & \{-4.36125,-0.744742\} & \{-0.744742,2.87176\} \\ 1. & \{4.68001,8.29652\} & \{2.87176,6.48827\} & \{6.48827,10.1048\} \\ 2. & \{11.913,15.5295\} & \{10.1048,13.7213\} & \{13.7213,17.3378\} \\ 3. & \{19.146,22.7625\} & \{17.3378,20.9543\} & \{20.9543,24.5708\} \\ \end{array}$$

Keep in mind all of the above calculations were done with respect to the normal (rotated) frame of reference. Note the Branch Domain column. These values were computed using $\texttt{branchAsyZerosF}(c)$ for $c=\{-3,-2,-1,0,1,2,3\}$. For example, note the Branch Domain for branch $0$ . This is given as $\{-2.55299,1.06351\}$. This range corresponds to the range between the purple and cyan delimiters for branch zero in the rotated frame of Figure 1. Doing a similar analysis for the leaf function $\texttt{leafF}$ produces the lower and upper leaf domains in the table. Leaf domains delimit the branch leaf lobes. Two example $\texttt{leafF}$ plots are shown as the black traces in Figure 1.

Once we have the rotated branching parameters, it's a relatively simple matter to plot the $\texttt{branchF}$ traces over the rotated contour diagram. However we first need to assign values to $\psi$ for each branch: As a first approximation, drop the trig term in $\ref{eqn:eqn100a}$ and write simply: $$\begin{equation} \text{imagF2B}(x,y)=\text{exp}\bigg\{e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]\bigg\}\approx y \label{eqn:eqn101a} \end{equation}$$ or: $$\begin{equation} e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]\approx \Log(y) \label{eqn:eqn102a} \end{equation}$$ And since the branching in normal form is horizontal, a good approximation to $y$ is simply the mean,$m_n$, of the branch range. So that we define: $$\begin{equation} e^{ax-by}\big[a\cos(ay+bx)-b\sin(ay+bx)\big]\approx \pm \Log(\pm m_n)=\psi \label{eqn:eqn103a} \end{equation}$$ The sign of $\psi$ is adjusted according to the following code:

#### Mathematica code 3

 If[Abs[mean] > 1, If[mean < 0, phi = Log[-mean]; , phi = Log[mean]; ]; , If[mean == 0, phi = -Log[1/20]; , If[mean < 0, phi = -Log[-mean]; , phi = -Log[mean]; ]; ]; ]; 

And as discussed above, in order to perserve arbritrary precision arithmetic, $m_n$ is computed symbolically but for plotting purposes, we can use machine precision: For example, branch $0$ has a branch domain of $\{-2.55299,1.06351\}$. We first derive the expression for $\texttt{branchF}$ and then substitute $\psi=-\Log(-m_0)=-\Log(0.744)$. For some values of $z$, $m_0=0$. In these cases, we simply assign $m_0$ to a small positive or negative number.

Once we've determined $\psi$ for a branch, we can then generate a rotated plot of $\texttt{branchF}(v,\psi)$. In the case of branch $0$, we could plot the function with $v$ in the range of say $(-2.4,1)$. Recall when we made the transform, we substituted $u$ for $x$ and $v$ for $y$ so in the u-v plane, we have $u=\texttt{branchF}(v,\psi)$.

#### Mathematica code 4

 myPhi = -Log[0.744] pp1 = ParametricPlot[{branchF[v, myPhi], v}, {v, -2.4, 1},PlotStyle -> Black]; 

Figure 2 shows this plot as the black trace in the contour diagram and note how the trace is a bit non-uniform. Had we used the branch range $\{-2.55299,1.06351\}$, the black trace would have over-extended the plot since we are plotting between asymptotes of $\texttt{branchF}$. We would like to plot the function out to the right side of the plot but $\texttt{branchF}$ is a function of $v$ and not $u$. We can compute $\texttt{vMin,vMax}$ to accomplish this by using $\texttt{leafF}(v,\phi)$.

7. Computing $\texttt{leafF}(v,\phi)$
8. The process for computing $\texttt{leafF}$ is similar to that of $\texttt{branchF}$ except the argument of the outer trig function in (\ref{eqn:eqn100a}) is now set to a constant: $$\begin{equation} e^{ax-by}\big[a\sin(ay+bx)+b\cos(ay+bx)\big]=\phi \label{eqn:eqn200b} \end{equation}$$ Rotating this expression, we obtain the $\texttt{leafF}$ functions: \begin{equation} \begin{aligned} \texttt{leafF}(v,\phi)&=\frac{6 \Log \left(\frac{6 \phi }{\Log (64) \sin \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)+\pi \cos \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)}\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}}\\ \texttt{leafAsyF}(v)&=\Log (64) \sin \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)+\pi \cos \left(\frac{1}{6} v \sqrt{\pi ^2+36 \Log ^2(2)}\right)\\ \texttt{leafAsyZerosF}(c)&=\left\{\frac{6 \left(2 \pi c-\tan ^{-1}\left(\frac{\pi }{\Log (64)}\right)\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}},\frac{6 \left(2 \pi c+\pi -\tan ^{-1}\left(\frac{\pi }{\Log (64)}\right)\right)}{\sqrt{\pi ^2+36 \Log ^2(2)}}\right\} \end{aligned} \end{equation}

$\texttt{leafF}$ delineates the (rotated) branch leaf lobe $n$ for $\phi=2n\pi$ for $n\in\mathbb{Z}$. Notice there is an upper and lower leaf domain column (for positive and negative $n$ respectively) for each branch in the branch table above. These correspond to the upper and lower leaf set of each branch bulb in Figure 1. Figure 3 shows the updated contour plot with now, the leaf delimiters as the dashed green and orange lines and five $\texttt{leaf}(v,\phi)$ plots for $\phi=2n\pi$ for $n$ ranging from $1$ to $5$. Consider again the branch table entry above for branch $0$ and now, the Upper Leaf Domain column for this branch: $\{-0.744742,2.87176\}$. This corresponds to the region between the green and orange dashed lines for the upper leaf plots shown in the figure.

$\texttt{leafF}$ gives us an approximation for the location of each branch leaf. And this gives us a method of choosing the plot range: we can simply compute the minimum (in terms of v) of say $\texttt{leafF}(v,40\pi)$ and this will give us the right most plot dimension of $u$ which includes $20$ leaves of each (rotated) branch. This method was used to determine the value of $u=5.72$ in the rotated contour plots of this section

9. Computing branch iteration seeds
10. Once we've computed $\texttt{branchF}(v,\psi)$, it's a simple matter to compute (rotated) iteration seeds for each branch that are close to the branch bulb heads: The seed for each branch is simply the point $\{\texttt{branchF}(\texttt{mean},\psi),\texttt{mean}\}$. Take for example branch $-1$. Referring to the branch table above, this branch has domain $\{-9.786,-6.1695\}$. So $\texttt{mean}\approx -7.977$. Thus $\psi \approx \Log(7.997)=2.0766$. Therefore the seed coordinates for this branch is $\{\texttt{branchF}(-7.977,2.0766),\texttt{mean}\}\approx \{1.00329,-7.977\}$ and this is the green point at the branch bulb head of the rotated frame in Figure 3 for this branch. Of course this is the seed coordinates in the rotated frame. In order to use this value as the starting seed for an iteration of roots for this branch, we invert it via: $$\texttt{baseSeedCoord=rotationF[rotatedSeed,-beta]}$$ to obtain the coordinates of the seed in the base frame. This turns out to be $\approx \{-4,-6.97\}$. And this is the approx. location of the green point for this branch in the base frame of Figure 1. An approximate value for this seed would then be $-4-6.97i$ but this machine-value would be wholly inadequate for high precision root calculations. As stated earlier, all computations are done with arbitrary precision with a desired precision set prior to the computations. The machine value is however adequate for generating the plots.

11. Inverting the rotated contour plot
12. In order to generate a base frame plot, we invert the rotated versions of the following:
• Real and imaginary contours,
• $\texttt{branchF}$ and $\texttt{leafF}$ plots,
• Branch delimiter lines and branch number locations,
• Iteration seed for each branch.
1. Inverting the real and imaginary contour plots
2. Inverting the contour plots consists of the following steps:
• Create the rotated plot,
• Extract the Point and Line graphic parameters from the rotated plots,
• Invert the rotated points,
• Re-construct the plot with the inverted data.
The following Mathematica code implements these steps to create the base contour plots from the rotated plots. The plotting dimensions for the base frame were computed by inverting the plotting dimensions of the rotated plot.

#### Mathematica code 5

 totalPoints = 50; rotatedRealF2Plot =ContourPlot[realF2 @@ rotationF[x, y, -beta] == rotX[x, -rotAN], {x,theRotatedMinUTerm, theRotatedMaxUTerm}, {y, theRotatedMinVTerm, theRotatedMaxVTerm}, ContourStyle -> Red,PlotPoints -> totalPoints]; (* extract the point and line data from the GraphicsComplex *) rotatedRealComplex = Cases[rotatedRealF2Plot, GraphicsComplex[x1__] :> x1, Infinity]; rotatedRealPoints = rotatedRealComplex[]; rotatedRealLines = Cases[rotatedRealComplex, Line[x2__] :> x2, Infinity]; (* now invert the rotated points into the base frame *) baseRealPoints = rotationF[#, -beta] & /@ rotatedRealPoints; (* generate the base plot from the inverted data *) baseRealF2Plot =Graphics@{Red,Thickness[0.002],GraphicsComplex[baseRealPoints, Line@rotatedRealLines]}; 

$\texttt{baseRealF2Plot}$ then becomes the red contours in the base plot of Figure 1.

3. Inverting the auxiliary plots
4. The auxiliary plots $\texttt{branchF}(v,\psi)$ and $\texttt{leafF}(v,\phi)$ are inverted by extracting the rotated data points of the rotated plots, inverting the points, then re-generating the plot in the base frame. In the following code, the rotated $\texttt{branchF}$ plot is generated, then the plot points are extracted, inverted, and then re-plotted as the base plot. A similar technique is used to invert $\texttt{leafF}$. The constant $\texttt{branchFPlotLimitDif}$ is a correction factor needed to constrain the plotting range relative to an arbitrary leaf blub, $20$, in the case explained above.

#### Mathematica code 6

 branchFPlot1=ParametricPlot[{branch[v, myPhi], v}, {v,theBranchRec[[2, 1]] + branchFPlotLimitDif, theBranchRec[[2, 2]] - branchFPlotLimitDif}, PlotStyle -> {Thickness[0.005], White}]; linePoints =Cases[branchFPlot1, Line[x1__] :> x1, Infinity] // First; baseBranchFPoints = rotationF[#, -rotAN] & /@ linePoints; baseBranchFPlot=Graphics@{Brown, Thickness[0.005], Line@baseBranchPoints} 

$\texttt{baseBranchFPlot}$ then becomes the brown contour plot encompassing this particular branch bulb in the base plot of Figure 1.

5. Inverting branch delimiters, branch numbers, leaf numbers, etc.
6. Inverting the branch and leaf delimeters are accomplished by simply inverting their equivalent rotated points.

#### 1 comment:

1. 