How do I solve this simultaneous equation involving trigonometric functions?

84 Views Asked by At

$x = a_1\cos(\theta_1 + \theta_2) + a_2\cos(\theta_1)$

$y = a_1\sin(\theta_1 + \theta_2) + a_2\sin(\theta_1)$

Solve for $\theta_1$ and $\theta_2$,they are angles for a robot, where $x$ and $y$ are the position. I want to get the angles given a position, I know there will be multiple solutions. I've attempted to use Wolfram Alpha to no avail.

Accidentally mistyped the equation, have updated.

3

There are 3 best solutions below

1
On BEST ANSWER

You can use the sum to product identities to write $$ \cos(\theta_1 + \theta_2) + \cos(\theta_1)=2\cos\left(\frac {2\theta_1+\theta_2}2\right)\cos\left(\frac {\theta_2}2\right)\\ \sin(\theta_1 + \theta_2) + \sin(\theta_1)=2\sin\left(\frac {2\theta_1+\theta_2}2\right)\cos\left(\frac {\theta_2}2\right)\\ \frac yx=\tan\left(\frac {2\theta_1+\theta_2}2\right)\\ 2\theta_1+\theta_2=\arctan \frac {2y}x\\ \frac {x^2+y^2}{a_2^2}=\cos^2\left(\frac {\theta_2}2\right)\\ \theta_2=2\arccos \sqrt{\frac {x^2+y^2}{a_2^2}}$$

Added: with the $a$s not being the same, the above doesn't work. You can still write $\sin = \pm \sqrt {1-\cos^2}$ to get to two equations in two unknowns, $\cos \theta_1$ and $\cos (\theta_1+\theta_2)$. It will be messier.

0
On

Hint: sum to product formula will drastically simplify the problem. Then make use of $\sin^2+\cos^2=1$ to solve for $\cos(\theta_1-\theta_2/2)$. Hope that helps.

0
On

Considering the equations $$x = a_1\cos(\theta_1 + \theta_2) + a_2\cos(\theta_1)\tag 1$$ $$y = a_1\sin(\theta_1 + \theta_2) + a_2\sin(\theta_1)\tag 2$$ first let $\theta_3=\theta_1 + \theta_2$ and rewrite the equations as $$a_1\cos(\theta_3)=a_2\cos(\theta_1)-x$$ $$a_1\sin(\theta_3)=a_2\sin(\theta_1)-y$$ and square to get $$a_1^2=(a_2\cos(\theta_1)-x)^2+(a_2\sin(\theta_1)-y)^2$$ that is to say $$x \sin (\theta_1)+y \cos (\theta_1)=\frac{x^2+y^2+a_2^2-a_1^2}{2 a_2}=k$$ Use the tangent half-angle subsitution $t=\tan \left(\frac{\theta_1 }{2}\right)$ to get the quadratic in $t$ $$ (k+y)t^2-2 xt+(k-y)=0\implies t=\, ??? \implies \theta_1=2 \tan ^{-1}(t)$$ Go back to $(1)$ or $(2)$ to get $\theta_2$