# Find where this discrete 3D spiral converges in explict terms

I'm more of an artist than a mathmatician so please bare with me. I'm trying to find where a spiral such as the one I'm about to describe converges in explicit terms so I can plug it into my software. This is the spiral in question. i.imgur.com/UwgdDsN.mp4
A few things to note, the cube that doesn't move is located at the origin. The next cube with red, green, and blue axis lines coming out of it is what I call the parameter cube. It's location, rotation, and scale drives the spiral. i.imgur.com/YiczjTR.mp4

Each location (Lx, Ly, Lz) of the parameter cube can be any number > 0 and each one can be unique. Same for rotations (Rx, Ry, Rz). Rotations are in degrees but I can convert them on my end if that's easier for you. Scales (Sx, Sy, Sz) will all be equal Sx = Sy = Sz and we can label it k for short and it'll be between 0 and 1 exclusive.

In a simple case with no rotation or scale, if I move the parameter cube to (1, 0, 0), then the next cube would be at (2, 0, 0), the 3rd would be at (3, 0, 0). It would never converge. If the scale was 0.5, then it would converge at (2, 0, 0) because it's a geometric series. (1 + 1/2 + 1/4 + 1/8 + ...) So that's how translation and scale interact with each other. Rotation is constant. If you rotate 90 degrees and scale down by 0.5, the 3rd cube would be rotated 180 degrees. Rotations don't converge.

I've posted this question to math.stackexchange.com and got somewhat of an answer already but I don't understand it and it's not complete. Here's the post. https://math.stackexchange.com/questions/4282732 The partial answer by DinosaurEgg may help you. His answer has some imaginary units so those would have to work their way out of the problem since my software can't handle imaginary number.

Someone already solved it for 2D. i.imgur.com/sFy8KP6.mp4 Notice how the red ball stays at the tip but I need this to happen in 3D.

To be clear, the final answer should be 3 equations:
x = (some function in terms of Lx, Ly, Lz, Rx, Ry, Rz, k)
y = (some function in terms of Lx, Ly, Lz, Rx, Ry, Rz, k)
z = (some function in terms of Lx, Ly, Lz, Rx, Ry, Rz, k)

If this problem can't be solved, I'd like to know why.

If you know some better tags to label this, let me know.

• DinosaurEgg has updated his answer so it's a bit simpler but it's still so complex to me that I don't understand what most of the symbols even mean. If the current bounty is too low, let me know. I don't mind raising it to something more reasonable.

• I may not be the best person around to answer this question, but I think you should raise your offer. This seems to be a very involved problem and it would take some time to even understand what you are looking for. The offered bounty does not provide enough incentive for someone to try to understand what the problem is.

• It might be easier and more natural to compute a sequence (x_n,y_n, z_n) that converges to the limiting (x,y,z) that you are looking for. Would that work?

• @David89 that's fair, I just put 10 to get the ball rolling. I have no idea how much something like this is worth so any suggestions?

• @Philip I have no idea what would work. I'm trying to make it automatic. I could zoom in really tight in my software and get a close enough value but that's time consuming if I do lots of these. That's why I want it as a formula so my software can do it automatically like in the 2D version. I think the answer on the math.stackexchange is probably right, but it's too advanced for me to calculate.

• Well just think about how much time it could take for someone to answer and make an offer accordingly.

• If you want a solution that works for every rotation matrix, the solution provided in MSE is indeed the answer. But if you have specified rotation angles, then the solution might be easier. As I mentioned you may want to just produce a sequence $(x_n,y_y,z_n)$ that could be computed with a simple for loop, and after 10-15 iterations it will be so close to the solution that you can see the difference in your software.

• I meant you can NOT see the difference in your software.

• @Philip Maybe I'm misunderstanding but producing a sequence and computing a loop doesn't sound automatic. I could probably write a function inside the software but this isn't for me. It's for the art community so I'm trying to make it as simple as possible. I would like it to be automatic like in the 2D version seen here. i.imgur.com/sFy8KP6.mp4 but we can try the other one. The position of the red ball gets updated automatically. Or would this sequence be like to a Taylor Series expansion?

• Yes, it would be like a Taylor series expansion that and I believe the first 10-15 terms would be enough to reach a very good accuracy. Each step would involve matrix multiplication. SO it would actually be simple and understandable.

• @Philip How much would you charge for your simpler solution? And what about the MSE solution? I don't have a clue. The notion looks simple but I suspect it exploded into some hairy stuff before getting simplified. I do know some programming so I could implement the simpler solution but I'd like it to be as hassle free for other people.

• It would take at least an hour to write a simple solution. Offer whatever you would charge for an hour of work in the Unites States.

• @Philip How many hours for the MSE solution?

• One.

• Also as I mentioned, you can not compute the limiting point in general, all we can do it to write a Taylor series that converges to the limiting point. Computing the terms of the Taylor series will involve matrix multiplication. I don't think it can get simpler than this. So you should find a way ti implement it in your software.

• Would $50 cover both solutions? 25/hr for two hours. • What do you. mean by both solutions? I will just write one solution that described above. The solution in MSE can not be simplified much, and explaining it to someone who doesn't have a solid background in math is not easy.$50 would be ok for this.

• @Philip Oh, I thought there was a way to find the point in general. Is that not what the MSE solution does? In that case, how about $25 for your solution? Would it be something I can set like n = 15 and it would loop 15 times and get 15 terms? • @Philip, Ok, let's just do$50 then for your solution.

• @Philip I've updated the price to $50. Minimum wage is$7.25 but you're worth more than that.

• The simple MSE solution is simple only if you are just rotating about one axis. Such rotation can be represented by only one angle and a vector n. This does not cover all the possible rotations you may have in mind. So the general case is much more involved which is the lengthy solution explained in MSE.

Suppose each time your rotation involves $\gamma$ degrees around $x$-axis, $\beta$ degrees around $y$-axis, and $\theta$ degrees around $z$-axi. Then this rotation can be represented by a matrix $R=\begin{pmatrix} \cos \alpha \cos \beta & \cos \alpha \sin \beta\sin \gamma-\sin \alpha \cos \gamma & \cos \alpha \sin \beta \cos \gamma+\sin \alpha\sin \gamma \\ \sin \alpha \cos \beta & \sin \alpha \sin \beta \sin \gamma+\cos \alpha \cos \gamma & \sin \alpha\sin \beta \cos \gamma-\cos \alpha \sin \gamma \\ -\sin \beta & \cos \beta \sin \gamma& \cos \beta\cos \gamma \end{pmatrix}.$ Now let $r_n=\begin{pmatrix} x_n \\ y_n \\ z_n \end{pmatrix}$ be a vector representing the location of the $n^{th}$ cube. Then $r_1=0$ and $(*) r_{n}=r_{n-1}+(kR)^{n-1} a,$ here $k=S_x=S_y=S_z$ is the scaling constant, and $a$ is a fixed vector. You can indeed take $a=\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}$, or any other vector. The vector $a$ determines where the first rotation starts from. From the equation $(*)$ we get $r_n=(\sum_{j=1}^{n} (kR)^{j-1})a$ $= (kR+k^2 R^2+k^3 R^3+\dots k^{n-1}R^{n-1})a.$ Similar to geometric series of numbers you would get $(**) r_n=(I-k R)^{-1}(1- (kR)^n)a.$ Since $R$ is the rotation matrix, it preserves the norm (the length) of a vector. So $R^n a$ will have the same length as $a$. Since $k<1$, the length of $k^n R^n a$ goes to zero as $n \rightarrow \infty.$ Hence letting $n \rightarrow \infty$ in $(**)$ we get

$r_{\infty}=(I-k R)^{-1}a,$
where $(I-k R)^{-1}$ is the inverse of the matrix $I-kR=$
$\begin{pmatrix} 1- k\cos \alpha \cos \beta & -k(\cos \alpha \sin \beta\sin \gamma-\sin \alpha \cos \gamma) & -k(\cos \alpha \sin \beta \cos \gamma+\sin \alpha\sin \gamma) \\ -k(\sin \alpha \cos \beta) & 1-k(\sin \alpha \sin \beta \sin \gamma+\cos \alpha \cos \gamma) & -k(\sin \alpha\sin \beta \cos \gamma-\cos \alpha \sin \gamma \\ +k\sin \beta & -k \cos \beta \sin \gamma& 1-k\cos \beta\cos \gamma \end{pmatrix}.$
Hence all you need to do is to invert the above matrix and multiply it by your initial vector $a$ to get the location of the limiting point. Most software can do such basic matrix operations. There is no need for the complicated discussion in the MSE link.

• It turns out that you can indeed have a simple way to compute the limiting point.

• This indeed works! Thank you.

• Great! You may want to let DinosaurEgg know about this. He spend so much of his valuable time on this problem.

• Philip, since you're familiar with this problem I have another question. Is it possible to find the axis where the spiral would spin around? (see the red line in this image https://i.imgur.com/yOafKYx.png) It would need to be so that 2 of the 3 rotation variables form the axis and the 3rd one would let me spin it around that axis. I thought I could use the rotation from the cube but it doesn't give smooth results.

• Yes, I think it should be possible to compute it.

• You can try to clearly explain the question and precisely describe the information you have in a new post and I will look into it.

• I ended up finding a solution. Thanks for everything. If you're curious the solution can be found here. https://math.stackexchange.com/questions/4305567