Non-linear equation system for a two link manipulator

If someone can kindly help me to find out the solution of this system of equations for the two angles.

Solve[{Px Cos[Subscript[\[Theta], 1][t]] -   Py Sin[Subscript[\[Theta], 1][t]] - Cos[Subscript[\[Theta], 2][t]]^2 Subscript[L, 2] +  Sin[Subscript[\[Theta], 2][t]]^2 Subscript[L, 2] - ( Cos[Subscript[\[Theta], 1][t]/2] Subscript[L, 1])/Subscript[\[Theta], 1][t] == 0, Py Cos[Subscript[\[Theta], 1][t]] + Px Sin[Subscript[\[Theta], 1][t]] - 2 Cos[Subscript[\[Theta], 2][t]] Sin[Subscript[\[Theta], 2][t]] Subscript[L, 2] - ( Sin[Subscript[\[Theta], 1][t]/2] Subscript[L, 1])/Subscript[\[Theta], 1][t] == 0}, {Subscript[\[Theta], 1][t],Subscript[\[Theta], 2][t]}]

I copied your equations in Mathematica 9 and got a syntax error.

Thanks Mr. Frank Kampas

I will try to check it and edit again, i will be thankful for any help that you can give.

thanks again

If you change all your Subscript[?, 1][ t ] to ?1, all your Subscript[L, 2] to L2, etc. then you might have a better chance at getting this to work, but even after that I was not able to find a solution. It is possible, sometimes using TrigReduce, to combine several of your trig functions into a single trig function. That might help simplify the problem, but I was not able to get all your trig functions to do that. The hope was if the problem could be simplified enough that there might be a solution found.

Thanks Mr. SImpson for your elaborated reply. i have tried a few ways to simplify the equations like to use a power series function etc, but so far i am not succeeded.

anyway, thanks a lot

Hello Mr Frank

I tried it by running it in my own laptop, now it will not give you any error. you can replace the command “Solve” in your own choice.

Thanks

waiting for any help

Suggest you rewrite the code without the subscripts, using [ ] instead. That will make it easier for us to figure out what’s going on.

Thanks Mr. Franks
To tell you that i AM NEW TO MATHEMATICA AND THIS COMMUNITY. SO NOT AWARE OF MANY THINGS LIKE HOW TO WRITE IT HERE.

ANYWAY, now i have re-written here in this format. i request if YOU CAN KINDLY WRITE IT BY YOURSELF IN MATHEMATICA AND TRY TO FIND OUT A SOLUTION FOR “?1” and
“?2”.
i will be highly relieved as my phd research is halted by this issue. thanks again for your sincere efforts and suggessions.

2cos ?1-1.5sin ?1=.08 (?cos ?2?^2 )-.08(?sin ?2?^2 )+(.05)/?1 (cos ( ?1/2))……………………………….(1)
2sin ?1+1.5cos ?1=2(.08cos ?2 sin ?2)+ sin(?1/2)…(2)

eqns = {2 Cos[\[Theta]1] - 1.5 Sin[\[Theta]1] == 
    0.08 Cos[\[Theta]2]^2 - 0.08 Sin[\[Theta]2]^2 + 
     0.05/\[Theta]1 Cos[\[Theta]1/2],
   2 Sin[\[Theta]1] + 1.5 Cos[\[Theta]1] == 
    2* 0.08 Cos[\[Theta]2] Sin[\[Theta]2] + Sin[\[Theta]1/2]};
FindRoot[eqns, {{\[Theta]1, .1}, {\[Theta]2, 1}}]
{\[Theta]1 -> 0.027134, \[Theta]2 -> 3.93797}

I’m not sure I interpreted your equations correctly. Also, a different starting point may give a different solution.

Thanks Mr. Frank for your effort.

Yes, there is a little confusion still so i should clarify that for better understanding for you to help me.

it is actually the inverse kinematic equations of a two link manipulator. having angles ?1 and ?2, L1 and L2 respectively. both the links are mobile so the values of the angles changes with the period of time. hence, SINCE THE ?1 AND ?2 ARE FUNCTIONS OF TIME i.e. ?1 and ?2, THEIR VALUES FOR A RANGE OF TIME IS DESIRED AND THEN PLOTS ARE NEEDED TO BE GRAPHED FOR THEM.

i do hope, that now you have got what i need and i am looking forward for a reply.

thanks again

Are you saying these are differential equations? In that case, you should use NDSolve, not Solve.

Also, I don’t see any time derivatives.

Hello Mr. Frank

No these are not differential equations. these are equations of two links of a robotic arm (manipulator). our job is to solve these equations for angles ?1 and ?2 which are changing with respect to time. i mean, the angles are a function of time. with every delta time, the values will change because of the movements of the links. you can define that time range and the instant value (delta time) so that we can get a lot of values for the angles at every time instant and plot the graphs.

i hope it will work now.

thanks

eqns = {
2 Cos[?1[t]] - 1.5 Sin[?1[t]] == 0.08 Cos[?2[t]]^2 - 0.08 Sin[?2[t]]^2 +0.05/?1 Cos[?1/2[t]], 
2 Sin[?1[t]] + 1.5 Cos[?1[t]] == 2* 0.08 Cos[?2[t]] Sin[?2[t]] + Sin[?1/2[t]]
};

The equations are actually to be written like this. Now, I hope you can help me get out of this trouble

thanks bro

In[1]:= \[Theta]1[t_] := 2 Sin[t]; \[Theta]2[t_] := 3 Cos[t];

In[2]:= SumOfSqr = ((2 Cos[\[Theta]1[t]] - 1.5 Sin[\[Theta]1[t]]) - (0.08 Cos[\[Theta]2[t]]^2 - 0.08 Sin[\[Theta]2[t]]^2 + 0.05/\[Theta]1[t] Cos[\[Theta]1[t]/2]))^2 + ((2 Sin[\[Theta]1[t]] + 1.5 Cos[\[Theta]1[t]]) - (2*0.08 Cos[\[Theta]2[t]] Sin[\[Theta]2[t]] + Sin[\[Theta]1[t]/2]))^2;

In[3]:={\[Theta]1[t], \[Theta]2[t], t, SumOfSqr} /. NMinimize[SumOfSqr, t, Method->"RandomSearch"][[2]]

Out[3]= {-1.97796, -0.44415, -1.71939, 2.65114}

In[4]:= {\[Theta]1[t], \[Theta]2[t], t, SumOfSqr} /. NMinimize[{SumOfSqr, {\[Theta]1[t]>0, t>0}}, t, Method->"RandomSearch"][[2]]

Out[4]= {0.0261052, 2.99974, 0.013053, 2.43784}

Given well defined functions of time for Theta1 and Theta2 this rapidly tries to find {Theta1, Theta1, time, sum of squares for those values}.
Notice that I have formed a single sum of squares from your original set of equations to be able to minimize a magnitude and try to find the solution.
As you can see from the second example, you are also free to introduce constraints on the value ot Theta1, Theta2 and t if needed for your system.
Study all the details of NMinimize in the help page and click on all the tabs and little triangles to see additional hidden information.
You can also put the NMinimize inside a Table[] function and use the iteration value of the Table to define the constraints for each solution you desire.

The problem with this approach is that there are many local minima that NMinimize is happy to find, thus a non-zero sum of squares.
Perhaps if you work with the constraints enough you can find real solutions to your system, possibly by doing a large table with small increments in time and then selecting the results that have a very small SumOfSqr.
I had expected and hoped that this approach would be better at easily finding real solutions for your system.
Perhaps your actual functions for Theta1 and Theta2 will provide much better results.

eqns = {2 Cos[\[Theta]1] - 1.5 Sin[\[Theta]1] == 
   0.08 Cos[\[Theta]2]^2 - 0.08 Sin[\[Theta]2]^2 + 
    0.05/\[Theta]1 Cos[\[Theta]1/2], 
  2 Sin[\[Theta]1] + 1.5 Cos[\[Theta]1] == 
   2*0.08 Cos[\[Theta]2] Sin[\[Theta]2] + Sin[\[Theta]1/2]}
NSolve[eqns /. \[Theta]1 -> 0.1]
{{Cos[\[Theta]2] -> 0. + 2.20681 I, 
  Sin[\[Theta]2] -> 0. - 4.65092 I}, {Cos[\[Theta]2] -> 
   0. - 2.20681 I, 
  Sin[\[Theta]2] -> 0. + 4.65092 I}, {Cos[\[Theta]2] -> -4.65092, 
  Sin[\[Theta]2] -> -2.20681}, {Cos[\[Theta]2] -> 4.65092, 
  Sin[\[Theta]2] -> 2.20681}}

These results do not seem to be consistent. If I make the NSolve variable theta2, I don’t get any solution.

Thanks Mr. Bill Simpson for your comprehensive analysis and the hard work that you put in my the solution of my problem.

Ah, to elaborate the sitaution, these equations are a set of non-linear trancidenetal equations with unknown functions ?1 and ?2 corresponding to the two angles of the
two links manipulator. To find the single values for the angles is actually not the desired solution, since when the links of the manipulator moves, the angles do change. hence, the solution of angles ?1 and ?2 is required as a function of time, which will be plotted in some certain time range. resultantly, velocity and acceleration graphs will also be achiveable from the angles.

I hope, now it will be helpful for you and you can try to get me out of this difficult situation.

thanks a lot again

To get the two angles to be functions of time you need their derivatives in a differential equation.

Thanks Mr. Frank

Yes, but the problem is that my equations are not having any derivatives nor differential equations so how how to plot the solutions of the angles.?

You could calculate one angle as a function of another angle using your equations, but you will not be able to compute time dependence without derivatives. What is your problem formulation? Do you have a Lagrangian for the system? If so, Lagrange’s equations will give you the time derivatives.