3 ms·
To your first question: tan β_i = sin β_i / cos β_i = 2^{-i}. So cos β_i = 2^i sin β_i. Square and use Pythagoras for cos^2 β_i = 2^{2i} (1 - cos^2 β_i). Sol
by edflsafoiewq 8y ago
To your first question:
tan β_i = sin β_i / cos β_i = 2^{-i}.
So cos β_i = 2^i sin β_i. Square and use Pythagoras for cos^2 β_i = 2^{2i} (1 - cos^2 β_i).
Solve for cos^2 β_i and take the positive square root for 2^i / √(1 + 2^{2i}) = 1 / √(2^{-2i} + 1).
To your second:
I presume the author multiplied 1 by K to get c <- K. When you multiply 0 by K you still have s <- 0 though. I haven't figured out the justification for moving the multiplication from after to before the loop but if it works for c it works for s too.
edit:
If you write
c_new ← cos α[i] × (c - tan α[i] × s)
s_new ← cos α[i] × (s + tan α[i] × c)
c ← c_new
s ← s_new
with a complex variable z = c + is (changing the index variable to j) you get
z ← cos α[j] × (1 + i × tan α[j]) × z
which makes it more obvious (to me) that you can pull the multiplication by cosines out of the loop.
z <- 1 # c=1, s=0
z <- K × z # c=K, s=0
...loop...
- seedless-sensat 8y agoTo the second question, I am also struggling to follow the step "Let’s move the multiplications by cos β_i into a separate loop". The recursive construction of `c` doesn't allow the betas to be pulled out. The i-th term is multiplied by beta_i to beta_n, but not beta_0 to beta_{i-1}. Clearly the method must work, but I'm not sure what I'm missing. Edit: ignoring `direction`, I can prove this step by induction for both c(i) and s(i) together. At least to me though, this it isn't a simple algebraic simplification.
- edflsafoiewq 8y agoI got it. In terms of a complex variable, mathematically the loop before that step is z = Π_j cos β[j] (1 + i direction_j 2^{-j}) So the step corresponds to the trivial rearrangement z = ( Π_j cos β[j] ) ( Π_j (1 + i direction_j 2^{-j}) )
- edflsafoiewq 8y agoThis is what's happening mathematically: https://i.imgur.com/MclfpEN.png https://i.imgur.com/MclfpEN.png.