Does changing department affect my rank?
Proof without words: $\displaystyle\cot(\theta/2)=\frac{\color{green}{\sin(\theta)}}{\color{red}{1-\cos(\theta)}}$
$\hspace{3.5cm}$
All you need are the following formulas:
$$\sin(2A) = 2 \sin(A) \cos(A) \text{ and } \cos(2A) = 1 - 2 \sin^2(A)$$ Now take $A = \theta/2$ to get that $$\sin(\theta) = 2 \sin(\theta/2) \cos(\theta/2) \text{ and } \cos(\theta) = 1 - 2 \sin^2(\theta/2)$$ Now plugging this into your equation, we get that $$\dfrac{\sin(\theta)}{1-\cos(\theta)} = \dfrac{2 \sin(\theta/2) \cos(\theta/2)}{2 \sin^2(\theta/2)} = \dfrac{\cos(\theta/2)}{\sin(\theta/2)} = \cot(\theta/2)$$
With p=Partition[data,2,1]
, you can do any of the following :
(100*#2)/#1 & @@@ p (* parsed as Apply[ (100*#2)/#1 &, p, {1} ] *)
Apply[ (100*#2)/#1 & ] /@ p
(100*#[[2]])/(#[[1]]) & /@ p (* Credit to Nasser in the comments *)
All evaluate to {150, 150, 150, 150}
.
Your original try failed because Map
(/@
) passes only one argument to the function -- for example, #1
gets replaced by {16,24}
for the first element of p
. You need to take parts of #1
(which is equivalent to #
), as in Nasser's example (the third example I included above), or you need to use Apply
to pass 16
and 24
as the first and second arguments, as you seem to desire.