How to find symbolic solution for theta1?

clc
clear all
syms m_c_theta1 m_c0 M theta1 j_L0 j_L_theta1 l j_Lm_gama
syms m_c_theta2 theta2 j_L_theta2 m_c_gama k1 gama j_L_gama j_Lm0 j_Lm_theta1 j_Lm_theta2 fi
% k1=0.423;
% F=0.95;
% gama=pi/F;
% theta2=10,
% l=0.218;
% M=0.7;
eqn1=m_c_theta1==(m_c0-1/M-1)*cos(theta1)+j_L0*sin(theta1)+1/M+1;
eqn2=j_L_theta1==(-m_c0+1/M+1)*sin(theta1)+j_L0*cos(theta1);
%eqn3=m_m_theta1==1;
%eqn3=j_Lm_theta1==j_Lm0-l*theta1;
Hi all,
Can anyone help of finding a solution specially theta1 because I found others except theta1?

1 Comment

Hello umme mumtahina,
please send me an personal message. I am also interested in the solutions of your questions.
Sometimes you just write: "Got it!", but you don't give the final solution. Due to the fact, that this is a public community, you should provide the corresponding answers to your questions.
So please send me ASAP a personal message.

Sign in to comment.

 Accepted Answer

No.
If you solve the first 5 equations for m_c0, j_L0, m_c_theta1, j_L_theta2, m_c_theta2 and substitute that into the 6th equation, then the right hand side will equal the left hand side.
In other words you only have 5 independent equations, not 6.

14 Comments

safi58
safi58 on 10 Apr 2017
Edited: Walter Roberson on 10 Apr 2017
IS there any way to find a solution for theta1? after finding m_c0, j_L0, I have put it in eqn 2 where j_L_theta1=-(gama*l)/2; but it is giving me some weird answer like this:
-log((exp((theta2*1i)/2)*(exp(gama*2i) + 2*exp(gama*3i) + exp(gama*4i) + exp(theta2*2i) + M^2*exp(theta2*1i) + 2*exp(gama*1i)*exp(theta2*1i) + 2*exp(gama*1i)*exp(theta2*2i) + 4*exp(gama*2i)*exp(theta2*1i) + exp(gama*2i)*exp(theta2*2i) + 2*exp(gama*3i)*exp(theta2*1i) - 2*M^2*exp(gama*2i)*exp(theta2*1i) + M^2*exp(gama*4i)*exp(theta2*1i) - 4*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i) + M^2*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*4i - M^2*j_L_theta1*exp(gama*3i)*exp(theta2*1i)*4i - 8*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i)*cos(gama) - 4*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i)*cos(gama)^2 + M^2*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*cos(gama)*4i - M^2*j_L_theta1*exp(gama*3i)*exp(theta2*1i)*cos(gama)*4i)^(1/2) + M*exp(theta2*1i) - M*exp(gama*2i)*exp(theta2*1i) + M*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*2i + M*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*cos(gama)*2i)/(exp(gama*1i) + exp(gama*2i) + exp(theta2*1i) + exp(gama*1i)*exp(theta2*1i)))*1i
-log((- exp((theta2*1i)/2)*(exp(gama*2i) + 2*exp(gama*3i) + exp(gama*4i) + exp(theta2*2i) + M^2*exp(theta2*1i) + 2*exp(gama*1i)*exp(theta2*1i) + 2*exp(gama*1i)*exp(theta2*2i) + 4*exp(gama*2i)*exp(theta2*1i) + exp(gama*2i)*exp(theta2*2i) + 2*exp(gama*3i)*exp(theta2*1i) - 2*M^2*exp(gama*2i)*exp(theta2*1i) + M^2*exp(gama*4i)*exp(theta2*1i) - 4*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i) + M^2*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*4i - M^2*j_L_theta1*exp(gama*3i)*exp(theta2*1i)*4i - 8*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i)*cos(gama) - 4*M^2*j_L_theta1^2*exp(gama*2i)*exp(theta2*1i)*cos(gama)^2 + M^2*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*cos(gama)*4i - M^2*j_L_theta1*exp(gama*3i)*exp(theta2*1i)*cos(gama)*4i)^(1/2) + M*exp(theta2*1i) - M*exp(gama*2i)*exp(theta2*1i) + M*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*2i + M*j_L_theta1*exp(gama*1i)*exp(theta2*1i)*cos(gama)*2i)/(exp(gama*1i) + exp(gama*2i) + exp(theta2*1i) + exp(gama*1i)*exp(theta2*1i)))*1i
You have 5 independent equations. You can solve for at most 5 variables. Throw away the last equation; it is redundant. Pick the variable you are willing to give up solving for.
safi58
safi58 on 10 Apr 2017
Edited: safi58 on 10 Apr 2017
If I did not put the values of j_L_theta1=-(gama*l)/2; then I will have 6 equations and I need all of these variable.
is there any other way to solve theta1?
If you comment out j_L_theta1=-(gama*I)/2 then the solution for theta1 appears to be
arctan((2^(1/2)*(-(cos(gama-theta2)-1)*(cos(theta2)-1)*((M^2*(j_L_theta1^2-1)*cos(theta2)-2*M^2*sin(theta2)*j_L_theta1-1)*cos(gama-theta2)-M^2*(2*j_L_theta1*cos(theta2)+sin(theta2)*(j_L_theta1^2-1))*sin(gama-theta2)-1+(j_L_theta1^2+1)*M^2))^(1/2)+M*((j_L_theta1*cos(theta2)+j_L_theta1-sin(theta2))*sin(gama-theta2)+(cos(gama-theta2)-1)*(sin(theta2)*j_L_theta1+cos(theta2)+1)))/sin(gama-theta2), (2^(1/2)*(cos(theta2)+1)*(-(cos(gama-theta2)-1)*(cos(theta2)-1)*((M^2*(j_L_theta1^2-1)*cos(theta2)-2*M^2*sin(theta2)*j_L_theta1-1)*cos(gama-theta2)-M^2*(2*j_L_theta1*cos(theta2)+sin(theta2)*(j_L_theta1^2-1))*sin(gama-theta2)-1+(j_L_theta1^2+1)*M^2))^(1/2)+M*((j_L_theta1*cos(theta2)+j_L_theta1-sin(theta2))*sin(gama-theta2)+(cos(gama-theta2)-1)*(sin(theta2)*j_L_theta1+cos(theta2)+1))*(cos(theta2)-1))/(sin(theta2)*sin(gama-theta2)))
or
arctan((-2^(1/2)*(-(cos(gama-theta2)-1)*(cos(theta2)-1)*((M^2*(j_L_theta1^2-1)*cos(theta2)-2*M^2*sin(theta2)*j_L_theta1-1)*cos(gama-theta2)-M^2*(2*j_L_theta1*cos(theta2)+sin(theta2)*(j_L_theta1^2-1))*sin(gama-theta2)-1+(j_L_theta1^2+1)*M^2))^(1/2)+M*((j_L_theta1*cos(theta2)+j_L_theta1-sin(theta2))*sin(gama-theta2)+(cos(gama-theta2)-1)*(sin(theta2)*j_L_theta1+cos(theta2)+1)))/sin(gama-theta2), (-2^(1/2)*(cos(theta2)+1)*(-(cos(gama-theta2)-1)*(cos(theta2)-1)*((M^2*(j_L_theta1^2-1)*cos(theta2)-2*M^2*sin(theta2)*j_L_theta1-1)*cos(gama-theta2)-M^2*(2*j_L_theta1*cos(theta2)+sin(theta2)*(j_L_theta1^2-1))*sin(gama-theta2)-1+(j_L_theta1^2+1)*M^2))^(1/2)+M*((j_L_theta1*cos(theta2)+j_L_theta1-sin(theta2))*sin(gama-theta2)+(cos(gama-theta2)-1)*(sin(theta2)*j_L_theta1+cos(theta2)+1))*(cos(theta2)-1))/(sin(theta2)*sin(gama-theta2)))
safi58
safi58 on 10 Apr 2017
Edited: safi58 on 10 Apr 2017
how did you find it?
I am finding empty matrix.
Hi Walter Can you please comment on this?
I have been busy, and ill. I do not know yet how to transform the two solutions into each other, or whether they are equal at all, and I have not yet tried back-substitution.
Sorry to hear that. Get well soon. I will wait.
Can anyone help please?
When I test numerically, the value from the -log(etc) appears to come out the same as happens for the arctan(). This suggest that the two solutions might be equivalent.
Note: the two solutions are not just negatives of each other.
Testing in maple, I see that there is a conversion from an arctan solution to a ln based solution. I do not know as yet if there is a feasible conversion the other way.
In the below discussion, I = sqrt(-1)
Exploring, I see that
arctan(Y,X) = -I*ln((X+I*Y)/sqrt(X^2+Y^2))
Conversely, -I*ln(A+I*B) can be transformed into arctan(B,A) - I * ln(abs(A+I*B)^2) / 2 . In the case where abs(A+I*B) = 1, then the ln term disappears. This happens especially when A+I*B is more a ratio, as in -I * ln((X+I*Y)/sqrt(X^2+Y^2))
So with some effort it might be possible to translate the -ln term back into a pure arctan and sin and cos expression, getting the expressions I posted earlier.
I did not see any method to do that transformation mechanically using MATLAB's rewrite() .
Thanks Walter. I am working on it.
Hello umme mumtahina,
please send me an personal message. I am also interested in the solutions of your questions.
Sometimes you just write: "Got it!", but you don't give the final solution. Due to the fact, that this is a public community, you should provide the corresponding answers to your questions.
So please send me ASAP a personal message.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!