# Expression simplification

1. Aug 15, 2005

### mikeley

Can you please tell me how theta1 was obtained from this system:

Px=C1(a2*C2+d4*S23)-d2*S1
Py=S1(a2*C2+d4*S23)+d2*C1

theta1=atan((Py*sqrt(Px^2+Py^2-d2^2)-d2*Px)/(Px*sqrt(Px^2+Py^2-d2^2)+d2*Py))

theta1=atan((-Py*sqrt(Px^2+Py^2-d2^2)-d2*Px)/(-Px*sqrt(Px^2+Py^2-d2^2)+d2*Py))

2. Aug 15, 2005

### AKG

Please use $\LaTeX$. Also, it might help to explain what Px, C1, C2, a2, etc.. are. Also, $\theta$ doesn't occur in your first two equations, so I have no idea how it was found, unless you explain what your symbols represent.

3. Aug 15, 2005

### Fermat

since S1 and C1 don't appear in the two final expressions, then perhaps S1 is sin(theta) and C1 is cos(theta) ??

Latex would be nicer.

Last edited: Aug 15, 2005
4. Aug 15, 2005

### mikeley

Sorry AKG and Fermat. Here is my post modified:

a2, d4, Px, Py are all constants

$$Px=\cos(\theta1)*(a2*\cos(\theta2)+d4*\sin(\theta2+\theta3))-d2*\sin(\theta1)$$

$$Py=\sin(\theta1)*(a2*\cos(\theta2)+d4*\sin(\theta2+\theta3))+d2*\cos(\theta1)$$

$$\theta1=\arctan((Py*\sqrt(Px^2+Py^2-d2^2)-d2*Px)/(Px*\sqrt(Px^2+Py^2-d2^2)+d2*Py))$$

$$\theta1=\arctan((-Py*\sqrt(Px^2+Py^2-d2^2)-d2*Px)/(-Px*\sqrt(Px^2+Py^2-d2^2)+d2*Py))$$

5. Aug 16, 2005

### AKG

Are you sure this is right. Before I do anything, it looks strange that $d4,\, \theta _2,\mbox{ and }\theta _3$ don't appear anywhere in your second pair of equations. Also, just for clarity, use subscripts, so you probably want to write $d4$ as $d_4$ unless you mean the fourth power of d, $d^4$. Anyways, take the first equation for $\theta _1$ and plug in Px and Py, and see if the equations are even correct. If not, then we need not go any further. If they are, then perhaps in working backwards you can see a general method to go "forwards" if they started you off with a slightly different Px and Py.

6. Aug 16, 2005

### AKG

Also, you're telling us that you wrote "S23" and expected that anyone would understand that you meant $\sin (\theta _2 + \theta _3)$? What were you thinking?

7. Aug 19, 2005

### mikeley

Would you like some salt and pepper to go with that

in my equations I have only d4 not dA, and d2 is not d^2 and d4 is not d^4. d2 and d4 are two constants raised to the first degree. And yes, I checked my equations before posting, and they are ok. So some how in the result, t1=..., the expression containing d4 was canceled.

8. Aug 20, 2005

### Fermat

Here are some pointers for a solution.

Multiply Px by sinθ and Py by cosθ. subtract Pxsinθ from Pycosθ to get rid of the bracketed term.
You should end up with Pycosθ - Pxsinθ = d2.
Divide both sides by cosθ.
Square both sides and get a quadratic in tanθ.
Solve ...

I ended up with a simpler form for tanθ.

$$tan\theta = \left(P_xP_y \pm d_2\sqrt{P_x^2 + P_y^2 - d_2^2}\right) / (P_x^2 - d_2^2)$$

I manipulated your expression(s) for tanθ and ended up with my expression, so I suppose it could be done backwards - get your expression from mine - but it was a wee bit tedious.
Do you need to use the original form(s)?

9. Aug 20, 2005

### mikeley

Thank you very much Fermat. No, I don't have to use the original form.