How to solve for angle for simultaneous "additive trigonometric" equation

874 Views Asked by At

I've been trying to study concepts from the field of inverse-kinematics, but have run into a mathematical roadblock.

To solve for an angle given a number is quite simple in itself

$$ \sin(\theta) = x $$ $$ \arcsin(x) = \theta $$ The problem I am having is for "additive function equations" like sin or log that require their inverse to solve for the inner variable:

\begin{cases} \frac X{1.5}=\cos(\theta_1)+\cos(\theta_1+\theta_2) \\ \frac Y{1.5}=\sin(\theta_1)+\sin(\theta_1+\theta_2)\end{cases} Where I would want to solve the equation for arbitrary $\theta_1$ and $\theta_2$.

Because of my programming experience, my "brute-force" solution would be to create a table of all possible combinations of thetas and their respective $x$ and $y$ values given that $\theta$ can range from $0$ to $2\pi$. But I really want to understand the process of solving for the arbitrary unknown variables and it's application to solving for the equation should it instead be something like $\log$ or some other type of function. Additionally, I would have to take more "samples" of $\theta$ in order to get more accurate $x$ and $y$ coordinates.


I've tried looking at this similar question and this question, both of which did not actually supply the method for solving the simultaneous equation and declaring them mathematically impossible.

3

There are 3 best solutions below

7
On BEST ANSWER

HINT...you could start by writing your equations as $$2\cos\frac{2\theta_1+\theta_2}{2}\cos\frac{2\theta_1-\theta_2}{2}=\frac{X}{1.5}$$ And $$2\sin\frac{2\theta_1+\theta_2}{2}\cos\frac{2\theta_1-\theta_2}{2}=\frac{Y}{1.5}$$ Now divide these equations and obtain$$2\theta_1+\theta_2=2\arctan\frac YX+n\pi$$

You can then substitute for $\theta_2$ into one of the original equations, expand the compound angle term and then use a compound angle transformation to obtain a solvable equation for $\theta_1$

1
On

here is another way to do this. square the two equations and adding them gives you $$\frac1{2.25}(x^2 + y^2) = 2 + 2(\cos \theta_1\cos(\theta_1+\theta_2)+\sin \theta_1\sin(\theta_1+\theta_2)=2+2\cos \theta_2 $$ that is $$\theta_2 = \pm\cos^{-1}\left(\frac1{4.50}(x^2+y^2) - 1\right) $$ now use this value in the equation $$\cos \theta_1 + \cos (\theta_1 + \theta_2)=\frac x{1.5} $$ to find $\theta_1.$

0
On

There is no general method for solving every system of non-linear equations. However, the system you stated does have a reasonable solution, and comes up in robotics, specifically, solving the inverse kinematics of a 2 link arm.

Suppose we have the following 2 link arm with link lengths $l_1,l_2 > 0$, and we wish to find the joint angles $\theta_1,\theta_2$ to get the end of the second joint in the desired position $(x,y)$.

http://www.cs.dartmouth.edu/~devin/cs81/lectures/lecture04/inverse2r.png

For a given $\theta_1,\theta_2$, the position of the end of the 2nd link is given by: $$x = l_1\cos\theta_1+l_2\cos(\theta_1+\theta_2)$$ $$y = l_1\sin\theta_1+l_2\sin(\theta_1+\theta_2).$$

(Note that if you substitute $l_1 = l_2 = 1.5$, you get the system in your question).

We can solve this problem either algebraically, or geometrically. I'll do it geometrically.

Using the Law of Cosines, we get that $\cos C = \dfrac{l_1^2+l_2^2-(x^2+y^2)}{2l_1l_2}$.

Hence, $\cos\theta_2 = \cos(180^{\circ}-C) = - \cos C = \dfrac{x^2+y^2-l_1^2-l_2^2}{2l_1l_2}$.

Therefore, $\theta_2 = \pm\arccos\left(\dfrac{x^2+y^2-l_1^2-l_2^2}{2l_1l_2}\right)$. Note that there are 2 solutions, one where the arm looks like the diagram above, and another where the arm is bent in the other direction.

Also, from using the Law of Cosines, we get $B = \pm \arccos\left(\dfrac{(x^2+y^2)+l_1^2-l_2^2}{2l_1\sqrt{x^2+y^2}}\right)$.

Using basic right angle trigonometry, we have $\theta_1+B = \text{atan2}(y,x)$.

Therefore, $\theta_1 = \text{atan2}(y,x) \mp \arccos\left(\dfrac{(x^2+y^2)+l_1^2-l_2^2}{2l_1\sqrt{x^2+y^2}}\right)$. Note that the $-$ solution for $\theta_1$ is paired with the $+$ solution for $\theta_2$, and the $+$ solution for $\theta_1$ is paired with the $-$ solution for $\theta_2$.