Message Boards Message Boards

Plot multiple functions?

GROUPS:

hi , when i tried to solve these eqns to give me function of anther variable ....it gives me so many eqns and i cant know which the right ones so i couldnt plot them i want to plot w3 , w4 with respect to varible theta2 (i want all varibles in output to be with respect to theta2} i will attach the code programming

r1 = 600;
r2 = 200;
r3 = 700;
r4 = 900;
(* \[Theta]2 is NOT constant !..*)
\[Alpha]2 = 0;
\[Omega]2 = 12.568;

eq1 = -r1  + r2 Cos[\[Theta]2 ] + r3 Cos[\[Theta]3 ] + 
   r4 Cos[\[Theta]4 ] ;
eq2 = r2 Sin[\[Theta]2 ] + r3 Sin[\[Theta]3  ] + r4 Sin[\[Theta]4 ] ;
m = Map[{\[Theta]3 , \[Theta]4} /. # &, {ToRules[
      N[Reduce[{eq1 == 0 && eq2 == 0} , {\[Theta]3, \[Theta]4}] /. {C[
           1] -> 0 , C[2] -> 0}]]}]/Degree;
Plot[m, {\[Theta]2, 0, 2 Pi}]
eq3 = -r2 \[Omega]2 *Sin[\[Theta]2 Degree] - 
   r3 \[Omega]3 Sin[\[Theta]3 Degree] - 
   r4 \[Omega]4 Sin[\[Theta]4 Degree];
eq4 = r2 \[Omega]2 Cos[\[Theta]2 Degree] + 
   r3 \[Omega]3 Cos[\[Theta]3 Degree] + 
   r4 \[Omega]4 Cos[\[Theta]4 Degree];

q = Map[{\[Omega]3 , \[Omega]4} /. # &, {ToRules[
     N[Reduce[{eq3 == 0 && eq4 == 0} , {\[Omega]3 , \[Omega]4}]]]}];
Plot[q, {\[Theta]2, 0, 2 Pi}]
Attachments:
POSTED BY: Ahmed Khodari
Answer
3 months ago

You seem to intend that $q$ depends on $\theta2$ only. That is not the case

In[74]:= Variables[q]
Out[74]= {\[Omega]3, \[Omega]4, Cos[0.0174533 \[Theta]2], 
 Cos[0.0174533 \[Theta]3], Cos[0.0174533 \[Theta]4], 
 Csc[0.0174533 \[Theta]3], Csc[0.0174533 \[Theta]4], 
 Sec[0.0174533 \[Theta]3], Sec[0.0174533 \[Theta]4], 
 Sin[0.0174533 \[Theta]2], Sin[0.0174533 \[Theta]3], 
 Sin[0.0174533 \[Theta]4]}

and therefore the

Plot[q, {\[Theta]2, 0, 2 Pi}]

remains empty. You need to replace $\theta3$ and $\theta4$ by the results of the previous substitution.

What is the purpose of this calculation? To eliminate $\theta3, \theta4, \omega3, \omega4, \alpha3, \alpha4$ from the equations in order to get one expression in $\theta2$?

POSTED BY: Udo Krause
Answer
2 months ago

Why do only eq3 and eq4 have a Degree after the $\theta2, \theta3, \theta4$?

eq5 seems to have an error, it has three $\theta3$ and one $\theta4$ instead of two $\theta3$ and two $\theta4$ as eq6 has.

POSTED BY: Udo Krause
Answer
2 months ago

Does it mean something to you to look at it that way?

In[15]:= Clear[eq1, eq2, eq3, eq4, eq5, eq6]
eq1 = -r1 + r2 C2 + r3 C3 + r4 C4;
eq2 = r2 S2 + r3 S3 + r4 S4;
eq3 = -r2 \[Omega]2 S2 - r3 \[Omega]3 S3 - r4 \[Omega]4 S4;
eq4 = r2 \[Omega]2 C2 + r3 \[Omega]3 C3 + r4 \[Omega]4 C4;
eq5 = -r2 \[Alpha]2 S2 - r2 \[Omega]2^2 C2 - r3 \[Alpha]3 S3 - 
   r3 \[Omega]3^2 C3 - r4 \[Alpha]4 S4 - r4 \[Omega]4^2 C4;
eq6 = r2 \[Alpha]2 C2 - r2 \[Omega]2^2 S2 + r3 \[Alpha]3 C3 - 
   r3 \[Omega]3^2 S3 + r4 \[Alpha]4 C4 - r4 \[Omega]4^2 S4;

In[22]:= Reduce[{eq1 == 0, eq2 == 0, eq3 == 0, eq4 == 0, eq5 == 0, 
  eq6 == 0,
  S2^2 + C2^2 == 1, S3^2 + C3^2 == 1, S4^2 + C4^2 == 1}, {S3, C3, S4, 
  C4, \[Alpha]3, \[Alpha]4, \[Omega]3, \[Omega]4}]

During evaluation of In[22]:= Reduce::ratnz: Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. >>

Out[22]= ((S2 == 0. - 1.33333 I || S2 == 0. + 1.33333 I) && 
   C2 == 1.66667 && S3 == 0.116071 S2 && C3 == -1.0119 && 
   S4 == -0.3125 S2 && 
   C4 == 1.08333 && \[Alpha]3 == 1285.89 S2 && \[Alpha]4 == 
    952.702 S2 && \[Omega]3 == 30.2418 && \[Omega]4 == 
    17.6738) || ((S2 == 0. - 2.82843 I || S2 == 0. + 2.82843 I) && 
   C2 == 3. && 
   S3 == -0.285714 S2 && (C3 == -1.28571 || C3 == 1.28571) && 
   S4 == 0 && 
   C4 == -0.777778 C3 && \[Alpha]3 == 
    2.19381 (27. S2 + 14. C3 S2) && \[Alpha]4 == 
    2.19381 (27. S2 + 14. C3 S2) && \[Omega]3 == 
    12.568 && \[Omega]4 == 
    0.465481 (27. + 14. C3)) || ((S2 == 0. - 3.69276 I || 
     S2 == 0. + 3.69276 I || S2 == 0. - 11.1294 I || 
     S2 == 0. + 11.1294 I) && 
   C2 == 0.0166667 (175. - 4. S2^2) && (S3 == 
      9.66557*10^-6 (-24780. S2 - 64. S2^3 - 
         1.41421 Sqrt[
          3.61694*10^9 + 3.21435*10^8 S2^2 + 1.58592*10^6 S2^4 + 
           2048. S2^6]) || 
     S3 == 9.66557*10^-6 (-24780. S2 - 64. S2^3 + 
         1.41421 Sqrt[
          3.61694*10^9 + 3.21435*10^8 S2^2 + 1.58592*10^6 S2^4 + 
           2048. S2^6])) && 
   C3 == 0.000352734 (11150. + 64. S2^2 - 3815. S2 S3 - 28. S2^3 S3) &&
    S4 == 0.111111 (-2. S2 - 7. S3) && 
   C4 == 0.000137174 (-22165. - 20. S2^2 + 7630. S2 S3 + 
       56. S2^3 S3) && \[Alpha]3 == 
    5.54249*10^-9 (1.36838*10^10 S2 + 1.06205*10^8 S2^3 + 
       3.94392*10^10 S3 + 3.02615*10^8 S2^2 S3) && \[Alpha]4 == 
    5.54249*10^-9 (1.20784*10^10 S2 + 9.59067*10^7 S2^3 + 
       3.25658*10^10 S3 + 2.63466*10^8 S2^2 S3) && \[Omega]3 == 
    0.000101192 (58075. + 260. S2^2 + 16100. S2 S3 + 
       112. S2^3 S3) && \[Omega]4 == -6.2464*10^-6 (-5.10267*10^6 - 
       24140. S2^2 + 1.11605*10^6 S2 S3 + 
       8624. S2^3 S3)) || ((C2 == -1. Sqrt[1. - 1. S2^2] || 
     C2 == Sqrt[1. - 1. S2^2]) && -5. + 3. C2 != 
    0 && (S3 == (
      0.0714286 (2. S2 - 6. C2 S2 - 
         4.24264 Sqrt[
          250. - 300. C2 + 90. C2^2 - 7. S2^2 + 3. C2 S2^2 + 
           2. C2^2 S2^2]))/(-5. + 3. C2) || 
     S3 == (0.0714286 (2. S2 - 6. C2 S2 + 
         4.24264 Sqrt[
          250. - 300. C2 + 90. C2^2 - 7. S2^2 + 3. C2 S2^2 + 
           2. C2^2 S2^2]))/(-5. + 3. C2)) && -3. + C2 != 0 && 
   C3 == (0.142857 (-2. + 6. C2 - 7. S2 S3))/(-3. + C2) && 
   S4 == 0.111111 (-2. S2 - 7. S3) && 
   C4 == 0.111111 (6. - 2. C2 - 7. C3) && -193750. + 182250. C2 + 
     66675. S2^2 + 2400. S2^4 + 16. S2^6 != 
    0 && \[Alpha]3 == -((2.92509 (1.84149*10^6 S2 - 476874. C2 S2 + 
           367416. C3 S2 + 21829. S2^3 + 26484. C2 S2^3 + 
           2772. S2^5 + 1.55925*10^6 S3 - 1.99395*10^6 C2 S3 - 
           763469. S2^2 S3 + 219324. C2 S2^2 S3 + 15372. S2^4 S3 - 
           289688. S2 S3^2))/(-193750. + 182250. C2 + 66675. S2^2 + 
         2400. S2^4 + 16. S2^6)) && \[Alpha]4 == 
    1.22885*10^-15 (2.24458*10^17 S2 - 1.29493*10^16 C2 S2 + 
       6.20893*10^16 C3 S2 + 5.59707*10^14 S2^3 + 
       2.25243*10^14 C2 S2^3 + 2.35755*10^13 S2^5 + 
       2.46529*10^16 S3 + 6.1083*10^16 C2 S3 - 
       8.49765*10^16 S2^2 S3 + 1.86532*10^15 C2 S2^2 S3 + 
       1.30737*10^14 S2^4 S3 - 2.84416*10^17 S2 S3^2 + 
       1.04667*10^15 \[Alpha]3 + 3.40562*10^14 S2^2 \[Alpha]3 + 
       7.71626*10^12 S2^4 \[Alpha]3 + 
       4.6521*10^10 S2^6 \[Alpha]3) && \[Omega]3 == 
    1.46664*10^-16 (-2.11516*10^17 - 1.46774*10^17 C2 - 
       4.01236*10^17 C3 + 3.56339*10^16 S2^2 - 
       1.36691*10^15 C2 S2^2 + 4.55857*10^14 S2^4 + 
       2.25308*10^14 C2 S2^4 + 2.35823*10^13 S2^6 + 
       1.1283*10^17 S2 S3 + 6.59829*10^15 C2 S2 S3 - 
       4.29285*10^15 S2^3 S3 + 1.86586*10^15 C2 S2^3 S3 + 
       1.30775*10^14 S2^5 S3 + 2.18653*10^17 S3^2 + 
       3.73233*10^14 S2 \[Alpha]3 + 3.07905*10^14 S2^3 \[Alpha]3 + 
       7.51326*10^12 S2^5 \[Alpha]3 + 
       4.65345*10^10 S2^7 \[Alpha]3) && \[Omega]4 == 
    3.99252*10^-15 (-6.13054*10^15 - 3.9879*10^15 C2 - 
       9.82606*10^15 C3 + 1.04034*10^15 S2^2 - 
       4.19126*10^13 C2 S2^2 + 1.28147*10^13 S2^4 + 
       6.471*10^12 C2 S2^4 + 6.773*10^11 S2^6 + 3.40531*10^15 S2 S3 + 
       1.67527*10^14 C2 S2 S3 - 1.24834*10^14 S2^3 S3 + 
       5.35888*10^13 C2 S2^3 S3 + 3.75593*10^12 S2^5 S3 + 
       6.24702*10^15 S3^2 + 1.06647*10^13 S2 \[Alpha]3 + 
       8.79869*10^12 S2^3 \[Alpha]3 + 2.15237*10^11 S2^5 \[Alpha]3 + 
       1.3365*10^9 S2^7 \[Alpha]3))
Attachments:
POSTED BY: Udo Krause
Answer
2 months ago

With $\omega2=\frac{1571}{125}$ the Reduce[] runs without warnings, giving at least a starting point for further work.

POSTED BY: Udo Krause
Answer
2 months ago

Group Abstract Group Abstract