0
$\begingroup$

I am trying to solve a set of 9 equations. I keep getting an error letting me know that tag plus in a variable is protected. please help.

solve[
  {λ[1]*a* 2*x[1] - 2*λ[3]*x[1] + 2*λ[3]*x[2] == 0, 
   λ[1]*a*2* y[1] - 2*λ[3]*y[1] + 2*λ[3]*y[2] == 0, 
   -m*g - λ[1] - 2*λ[3]*z[1] + 2*λ[3]*z[2] == 0, 
   λ[2]*a*2*x[2] - 2*λ[3]*x[2] + 2*λ[3]*x[1] == 0, 
   λ[2]*a*y[2] - 2*λ[3]*y[2] + 2*λ[3]*y[1] == 0, 
   -m*g - λ[2] - 2*λ[3]*z[2] + 2*λ[3]*z[1] == 0, 
   a^2*x[1]^2 + a^2*y[1]^2 == z[2], a^2*x[2]^2 + a^2*y[2]^2 = z[2], 
   x[1]^2 - 2*x[1]*x[2] + x[2]^2 + y[1]^2 - 2*y[1]*y[2] + y[2]^2 + z[1]^2 - 
      2*z[1]*z[2] + z[2]^2 == L^2}, 
  {x[2], x[2], y[1], y[2], z[1], z[2], λ[1], λ[2], λ[3]}] 

Tried a bunch of changes and i am still getting the same error message. please advise

$\endgroup$
4

1 Answer 1

2
$\begingroup$

When I rewrite your code — correcting two syntax errors — as:

Solve[
  {λ[1]*a* 2*x[1] - 2*λ[3]*x[1] + 2*λ[3]*x[2] == 0, 
   λ[1]*a*2* y[1] - 2*λ[3]*y[1] + 2*λ[3]*y[2] == 0, 
   -m*g - λ[1] - 2*λ[3]*z[1] + 2*λ[3]*z[2] == 0, 
   λ[2]*a*2*x[2] - 2*λ[3]*x[2] + 2*λ[3]*x[1] == 0, 
   λ[2]*a*y[2] - 2*λ[3]*y[2] + 2*λ[3]*y[1] == 0, 
   -m*g - λ[2] - 2*λ[3]*z[2] + 2*λ[3]*z[1] == 0, 
   a^2*x[1]^2 + a^2*y[1]^2 == z[2], a^2*x[2]^2 + a^2*y[2]^2 == z[2], 
   x[1]^2 - 2*x[1]*x[2] + x[2]^2 + y[1]^2 - 2*y[1]*y[2] + y[2]^2 + z[1]^2 - 
      2*z[1]*z[2] + z[2]^2 == L^2}, 
  {x[2], x[2], y[1], y[2], z[1], z[2], λ[1], λ[2], λ[3]}] 

I get

{}

which is Mathematica's way of saying there is no solution.

Note

The two corrections I made are:

  1. Solve in place of solve
  2. a^2*x[1]^2 + a^2*y[1]^2 == z[2], a^2*x[2]^2 + a^2*y[2]^2 == z[2] in place of a^2*x[1]^2 + a^2*y[1]^2 == z[2], a^2*x[2]^2 + a^2*y[2]^2 = z[2]
$\endgroup$
1
  • $\begingroup$ Adding option MaxExtraConditions -> All to Solve gives another solutions ?. $\endgroup$ Sep 20, 2018 at 10:59

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