How can we remove the accuracy variable from this periodic real function?

55 Views Asked by At

Let $M(\alpha,\beta, \gamma)$ be the Euler Matrix and $f_A(\vec{v})$ the function that returns the azimuthal angle (spherical coordinate) corresponding to the Cartesian coordinates $(x,y,z)$ of the vector $\vec{v}$.

Now let us define the function $g$ as follows:

$$ g(\epsilon_x,\epsilon_y,\epsilon_z,s,t)=\min(\left|a_1-a_2\right|,2\pi-\left|a_1-a_2\right|) $$

where

$$ a_1=f_A\left(\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\cdot M\left(\frac{2\pi}{s},\frac{2\pi}{s},\frac{2\pi}{s}\right)^t\right) $$

and

$$ a_2=f_A\left(\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\cdot M\left(\epsilon_x,\epsilon_y,\epsilon_z\right)\cdot M\left(\frac{2\pi}{s},\frac{2\pi}{s},\frac{2\pi}{s}\right)^t\right) $$

The variables $\epsilon_x$, $\epsilon_y$, $\epsilon_z$ are just parameters affecting the curve shape. We could also specify these three variables as (fixed) subscripted parameters. The time variable (run variable along $x$-axis) is $t$. The variable $s$ only specifies the resolution. Let us set for example $\epsilon_x=1.5$, $\epsilon_y=2$, $\epsilon_z=0.5$. In this concrete case, the curve is given by $g(1.5,2,0.5,s,t)$ and it looks as follows (when we set $s=200$ and let $t$ run from $0$ to $200$).

enter image description here

The curve does not change if, for example, we set $s=100$ and let $t$ run from $0$ to $100$ and so forth.

My question: How can we get rid of this variable $s$?

Some Background Information: To give a motivation for this problem, I would like to share the idea behind this problem. What happens here is that we rotate two vectors, a vector $\vec{v}=\big(\begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix}\big)$ and a slightly (via rotation around $\epsilon_x$, $\epsilon_y$, $\epsilon_z$) "manipulated" version of this vector $\vec{v}$ in synchronism and we look at how the azimuthal angle between both vectors changes over time $t$ according to the curve shown above.

To understand the function or even to play around with it oneself, I have included the Wolfram code:

subtractAngles[a1_, a2_] := (
   d = Abs[a1 - a2];
   Return[Min[d, 2*Pi - d]];
   );

azimuthalError[errx_, erry_, errz_, s_, t_] := (
   mp = MatrixPower[N[EulerMatrix[{2 Pi/s, 2 Pi/s, 2 Pi/s}]], t];
   sphericalVec = ToSphericalCoordinates[{1, 0, 0} . mp];
   sphericalVecError = 
    ToSphericalCoordinates[{1, 0, 0} . 
      EulerMatrix[{errx, erry, errz}] . mp];
   Return[subtractAngles[sphericalVec[[3]], sphericalVecError[[3]]]];
   );
Plot[azimuthalError[1.5, 2, 0.5, 200, t], {t, 0, 200}, 
 PlotRange -> All]
1

There are 1 best solutions below

0
On BEST ANSWER

I could eliminate the variable s by solving the following limit of the Euler Matrix power:

$$ \lim_{s\to\infty} M\left(\frac{1}{s},\frac{1}{s},\frac{1}{s}\right)^{s\cdot t}=\left( \begin{array}{ccc} \cos \left(\sqrt{5} t\right) & -\frac{2 \sin \left(\sqrt{5} t\right)}{\sqrt{5}} & \frac{\sin \left(\sqrt{5} t\right)}{\sqrt{5}} \\ \frac{2 \sin \left(\sqrt{5} t\right)}{\sqrt{5}} & \frac{1}{5} \left(4 \cos \left(\sqrt{5} t\right)+1\right) & \frac{1}{5} (-2) \left(\cos \left(\sqrt{5} t\right)-1\right) \\ -\frac{\sin \left(\sqrt{5} t\right)}{\sqrt{5}} & \frac{1}{5} (-2) \left(\cos \left(\sqrt{5} t\right)-1\right) & \frac{1}{5} \left(\cos \left(\sqrt{5} t\right)+4\right) \\ \end{array} \right)=M_P(t) $$

As a result the desired function simplifies as follows:

$$ g(\epsilon_x,\epsilon_y,\epsilon_z,t)=\min(\left|a_1-a_2\right|,2\pi-\left|a_1-a_2\right|) $$

where

$$ a_1=f_A\left(\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\cdot M_P(t)\right) $$

and

$$ a_2=f_A\left(\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\cdot M\left(\epsilon_x,\epsilon_y,\epsilon_z\right)\cdot M_P(t)\right) $$

The corresponding (simplified) code yields the same plot:

mp[t_] := {{Cos[Sqrt[5] t], -((2 Sin[Sqrt[5] t])/Sqrt[5]), 
Sin[Sqrt[5] t]/Sqrt[5]}, {(2 Sin[Sqrt[5] t])/Sqrt[5], 
1/5 (1 + 4 Cos[Sqrt[5] t]), -(2/5) (-1 + Cos[Sqrt[5] t])}, {-(
 Sin[Sqrt[5] t]/Sqrt[5]), -(2/5) (-1 + Cos[Sqrt[5] t]), 
1/5 (4 + Cos[Sqrt[5] t])}};

azimuthalErrorSimplified[errx_, erry_, errz_, t_] := (
   sphericalVec = ToSphericalCoordinates[{1, 0, 0} . mp[t]];
   sphericalVecError = 
    ToSphericalCoordinates[{1, 0, 0} . 
      EulerMatrix[{errx, erry, errz}] . mp[t]];
   Return[subtractAngles[sphericalVec[[3]], sphericalVecError[[3]]]];);
Plot[azimuthalErrorSimplified[1.5, 2, 0.5, t], {t, 0, 2 Pi}, 
 PlotRange -> All]