0
$\begingroup$

Context: I am trying to solve a set of equations generated by hand from a complicated, but not particularly strange system via Newton's Second and Third Laws, and a few constraints. All the resulting equations are linear, and several are trivial, but essential. I am trying to do this with the Solve[] function in Mathematica.

If you want the systems, this diagram shows everything. It's probably indecipherable, but it's what I've got.

enter image description here

The real guts of my issue:

My code is as follows:

Clear["Global`*"];
Solve[
 {
  (*N2L*)
  (*Central Stick*)
  (*x*)Facx + Fbcx + Fhcx == mc acx,
  (*y*)Facy + Fbcy + Wec + Fhcy == mc acy,
  (*θ*)yha Facx + yhb Fbcx == Ic αc,
  (*Stick A*)
  (*x*)Flax + Fcax + Frax == ma aax,
  (*y*)Flay + Fcay + Fray + Wea == ma aay,
  (*θ*)(rcp Cos[θ] Flay + rcp Sin[θ] Flax) - (rcp Cos[θ] Fray + rcp Sin[θ] Frax) == Ia αa,
  (*Stick B*)
  (*x*)Flbx + Fcbx + Frbx == mb abx,
  (*y*)Flby + Fcby + Frby + Web == mb aby,
  (*θ*)(rcp Cos[θ] Flby + rcp Sin[θ] Flbx) - (rcp Cos[θ] Frby + rcp Sin[θ] Frbx) == Ib αb,
  (*Left Pan*)
  (*x*)Falx + Fblx + fs1l == ml alx,
  (*y*)Faly + Fbly + N1l + Wel == ml aly,
  (*θ*)-xa1 N1l - xap Wel - yab Fblx == Ip αl,
  (*Right Pan*)
  (*x*)Farx + Fbrx + fs2r == mr arx,
  (*y*)Fary + Fbry + N2r + Wer == mr ary,
  (*θ*)xa2 N2r + xap Wer + yab Fbrx == Ip αr,
  (*Mass 1*)
  (*x*)fsl1 == m1 a1x,
  (*y*)Nl1 + We1 == m1 a1y,
  (*Mass 2*)
  (*x*)fsr2 == m2 a2x,
  (*y*)Nr2 + We2 == m2 a2y,

  (*N3L*)
  Facx == -Fcax,
  Facy == -Fcay,
  Fbcx == -Fcbx,
  Fbcy == -Fcby,

  Falx == -Flax,
  Faly == -Flay,
  Fblx == -Flbx,
  Fbly == -Flby,

  Farx == -Frax,
  Fary == -Fray,
  Fbrx == -Frbx,
  Fbry == -Frby,

  N1l == -Nl1,
  N2r == -Nr2,
  fs1l == -fsl1,
  fs2r == -fsr2,

  (*Force Definitions*)
  We1 == -m1 g,
  We2 == -m2 g,
  Wel == -mp g,
  Wer == -mp g,
  Wea == -ma g,
  Web == -mb g,
  Wec == -mc g,

  (*Accelerations*)
  acx == 0,
  acy == 0,
  αc == 0,

  aax == acx,
  aay == acy,
  abx == acx,
  aby == acy,

  αa == αb,

  aly == αa (rcp Cos[θ] + xap),
  alx == αa (rcp Sin[θ] + yap),
  αl == 0,

  ary == -αa (rcp Cos[θ] + xap),
  arx == -αa (rcp Sin[θ] + yap),
  αr == 0,

  a1x == alx,
  a1y == aly,
  α1 == αl,
  a2x == arx,
  a2y == ary,
  α2 == αr
 },
 {
  Fhcx, Fhcy,
  Facx, Fcax, Facy, Fcay, Fbcx, Fcbx, Fbcy, Fcby,
  Falx, Flax, Faly, Flay, Fblx, Flbx, Fbly, Flby,
  Farx, Frax, Fary, Fray, Fbrx, Frbx, Fbry, Frby,
  N1l, Nl1, N2r, Nr2, fs1l, fsl1, fs2r, fsr2,
  We1, We2, Wel, Wer, Wea, Web, Wec,
  acx, acy, αc,
  aax, aay, abx, aby,
  αa, αb,
  alx, aly, αl,
  arx, ary, αr,
  a1x, a1y, α1,
  a2x, a2y, α2
 }
]

Or at least that's how it looks when I copy paste it here. I'm now realizing that becomes illegible because of formatting discrepancies, so here's some screenshots:

enter image description here


Mathematica returns an empty list when this is evaluated. My understanding is that this is supposed to mean that the system has either 0 or infinitely many solutions, but neither seem likely. It is a system of 62 equations with 62 unknown variables, and thus should (to my knowledge) have one unique solution. I have tried adding assumptions (limit to reals, and add assumptions that all known variables are positive numbers), but this leads to the the command never finishing (or at least not in the amount of time I've waited).

Attempts to simplify the system, or follow other solutions found in various other questions have all resulted in another instance of errors mentioned above, or a number of other errors.

So basically I'm stuck. Any suggestions?

$\endgroup$
2
  • $\begingroup$ 1) Try giving reasonable values to the parameters involved and solving the system numerically with FindRoot, to check that your formulation is correct and it returns "reasonable" answers. 2) If the equations are correct, perhaps try Reduce instead of Solve. $\endgroup$
    – MarcoB
    Apr 24, 2016 at 22:47
  • $\begingroup$ mass and g seem to be undefined. Did you try solving a smaller system first? say 3 equations only? $\endgroup$ Apr 25, 2016 at 0:10

1 Answer 1

4
$\begingroup$

If I carefully avoid any use of division to rearrange a few of your simpler equations and use the results for substitutions thus:

sys = {yha Facx + yhb Fbcx == Ic αc,
 (rcp Cos[θ] Flay+rcp Sin[θ] Flax)-(rcp Cos[θ] Fray+rcp Sin[θ] Frax)==Ia αa,
 (rcp Cos[θ] Flby+rcp Sin[θ] Flbx)-(rcp Cos[θ] Frby+rcp Sin[θ] Frbx)==Ib αb, 
 Falx + Fblx + fs1l == ml alx, Faly + Fbly + N1l + Wel == ml aly,
 -xa1 N1l-xap Wel-yab Fblx==Ip αl, xa2 N2r+xap Wer+yab Fbrx==Ip αr} //. {
 Fbrx -> mr arx - (Farx + fs2r), Nl1 -> m1 a1y - We1,
 Nr2 -> m2 a2y - We2, Fbry -> mr ary - (Fary + N2r + Wer), 
 Fcax -> ma aax - (Flax + Frax), Fcbx -> mb abx - (Flbx + Frbx), 
 Fcay -> ma aay - (Flay + Fray + Wea), Fcby -> mb aby - (Flby + Frby + Web), 
 Fhcx -> mc acx - (Facx + Fbcx), Fhcy -> mc acy - (Facy + Fbcy + Wec),
 fsr2 -> m2 a2x, fsl1 -> m1 a1x, Facx -> -Fcax, Facy -> -Fcay,
 Fbcx -> -Fcbx, Fbcy -> -Fcby, Falx -> -Flax, Faly -> -Flay, Fblx -> -Flbx, 
 Fbly -> -Flby, Farx -> -Frax, Fary -> -Fray, Fbrx -> -Frbx, 
 Fbry -> -Frby, N1l -> -Nl1, N2r -> -Nr2, fs1l -> -fsl1, 
 fs2r -> -fsr2, We1 -> -m1 g, We2 -> -m2 g, Wel -> -mp g, 
 Wer -> -mp g, Wea -> -ma g, Web -> -mb g, Wec -> -mc g, acx -> 0, 
 acy -> 0, αc -> 0, aax -> acx, aay -> acy, abx -> acx, 
 aby -> acy, αa -> αb, aly -> αa (rcp Cos[θ] + xap), 
 alx -> αa (rcp Sin[θ] + yap), αl -> 0, ary -> -αa (rcp Cos[θ] + xap), 
 arx -> -αa (rcp Sin[θ] + yap), αr -> 0, a1x -> alx, a1y -> aly,
 α1 -> αl, a2x -> arx, a2y -> ary, α2 -> αr}

then I get the much simpler system

{-(-Flax - Frax) yha - (-Flbx - Frbx) yhb == 0, 
 Flay rcp Cos[θ] - Fray rcp Cos[θ] + Flax rcp Sin[θ] - Frax rcp Sin[θ] == Ia αb, 
 Flby rcp Cos[θ] - Frby rcp Cos[θ] + Flbx rcp Sin[θ] - Frbx rcp Sin[θ] == Ib αb,
 -Flax - Flbx - m1 αb (yap + rcp Sin[θ]) == ml αb (yap + rcp Sin[θ]),
 -Flay - Flby - g m1 - g mp -m1 αb (xap + rcp Cos[θ]) == ml αb (xap + rcp Cos[θ]), 
 g mp xap + Flbx yab + xa1 (g m1 + m1 αb (xap + rcp Cos[θ])) == 0,
 -g mp xap-xa2 (g m2-m2 αb (xap+rcp Cos[θ]))+yab (Frax-m2 αb
   (yap+rcp Sin[θ])-mr αb (yap+rcp Sin[θ])) == 0}

Solve then almost instantly provides a solution for the remaining variables

Solve[sys, {Flax, Flbx, Flby, Frax, Fray, Frbx, Frby}]

And the values of all the other variables can be obtained by reversing the substitutions above.

I realize some want a magic system that automatically gives them the answer without any need to put a problem into a form that the system can quickly and correctly solve. Sometimes getting an answer is preferable to not.

Check this very carefully several times to ensure I have made no mistakes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.