2
$\begingroup$

How to calculate $x,y,k$ in terms of constants $a$ and $b$ in the following equations in Mathematica:

4*y-k*2*x/a^2=0,
4*x-k*2*y/b^2=0,
x^2/a^2+y^2/b^2-1=0

Why doesn't the following command work? (I am new)

Solve[4*y-k*2*x/a^2=0&&4*x-k*2*y/b^2=0&&x^2/a^2+y^2/b^2-1=0,{x,y,k},reals]
$\endgroup$

closed as off-topic by Daniel Lichtblau, MarcoB, happy fish, march, Bob Hanlon Mar 22 '17 at 16:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, MarcoB, happy fish, march, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Just put the double equal and write capital letters for reals, everything else is optional. $\endgroup$ – TeM Mar 22 '17 at 12:14
6
$\begingroup$

There are many errors in your code:

  1. it is Reals not reals
  2. you have to write == instead of = (read here for example)
  3. you need curl brackets (as Bob Hanlon points out, there is no need of brackets if && is used).

The correct code is:

Solve[{4*y - k*2*x/a^2 == 0 && 4*x - k*2*y/b^2 == 0 && 
   x^2/a^2 + y^2/b^2 - 1 == 0}, {x, y, k}, Reals]

EDIT If you have to consider some assumptions, use the following code:

Assuming[{your assumptions},Simplify[Solve[{4*y - k*2*x/a^2 == 0 && 4*x - k*2*y/b^2 == 0 && 
   x^2/a^2 + y^2/b^2 - 1 == 0}, {x, y, k}, Reals]]]
$\endgroup$
  • $\begingroup$ Thank you very much. How can we add to more conditions which are $x>0$ and $x>0$? $\endgroup$ – captain23 Mar 22 '17 at 12:19
  • 2
    $\begingroup$ @mattiav27, you'd actually want to put Simplify[] within Assuming[] so that any assumptions set get accounted for in simplification. $\endgroup$ – J. M. will be back soon Mar 22 '17 at 12:32
  • 2
    $\begingroup$ Since && is used, equations do not have to be inside brackets, Brackets are needed if the equations are separated by commas. First argument to Solve can include inequalities, e.g., Solve[4*y - k*2*x/a^2 == 0 && 4*x - k*2*y/b^2 == 0 && x^2/a^2 + y^2/b^2 - 1 == 0 && x > 0 && y > 0, {x, y, k}, Reals]; however, Assuming is better since as @J.M.points out they are passed to Simplify. $\endgroup$ – Bob Hanlon Mar 22 '17 at 16:54

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