-1
$\begingroup$

Here is my code:

Solve[{A*p+A_1*q*r+γ*y-β*z==0, B*q+A_2*r*p+z*α-x*γ==0, C*r+A_3*p*q+x*β-y*α==0, 2*α+β*r-γ*q==0, 2*β+γ*p-α*r==0, 2*γ+α*q-β*p==0}, {p,q,r,α,β,γ}]//Simplify

However, it keeps on running but it does not give me a result. Is it because such a system is too complicated for Mathematica to solve or is there an error in the code?

Thanks

$\endgroup$
5
  • 5
    $\begingroup$ Don't use "underscore" in variable names! $\endgroup$ Dec 20, 2021 at 11:23
  • 4
    $\begingroup$ Do not use capital C: it is reserved in Mathematica. $\endgroup$ Dec 20, 2021 at 12:14
  • $\begingroup$ However, even after the errors are corrected, the code runs a very long time. Mathematica often has trouble solving bilinear equations. $\endgroup$
    – bbgodfrey
    Dec 20, 2021 at 12:15
  • 1
    $\begingroup$ It is almost impossible to solve q,r when the equation contain q*r. for example Solve[q*r==1,{q,r}]. (Though we can use Reduce) $\endgroup$
    – cvgmt
    Dec 20, 2021 at 12:30
  • 1
    $\begingroup$ Also, please specify any constraints that may exist. For instance, must the solutions be real, or are the constants all non-zero. $\endgroup$
    – bbgodfrey
    Dec 20, 2021 at 13:17

1 Answer 1

8
$\begingroup$

Re-iterating: Don't start user-defined variables with upper-case letter and the underscore is reserved for pattern matching. Even if you change all the variables as I did below, without specifying values for the constants, I'm not optimistic Mathematica will come up with a solution. However, if you wish, you can study your system by supplying values for the constants. In the code below, solutions are in the form of "Root" objects which in this case are roots to a 12-degree polynomial:

theA = 1;
a1 = 2;
a2 = 2;
a3 = 2;
theY = 3;
theZ = -1;
theB = -2;
theC = 3;
theX = 2;
Solve[{theA*p + a1*q*r + \[Gamma]*theY - \[Beta]*theZ == 0,
  theB*q + a2*r*p + theZ*\[Alpha] - theX*\[Gamma] == 0,
  theC*r + a3*p*q + theX*\[Beta] - theY*\[Alpha] == 0,
  2*\[Alpha] + \[Beta]*r - \[Gamma]*q == 0,
  2*\[Beta] + \[Gamma]*p - \[Alpha]*r == 0,
  2*\[Gamma] + \[Alpha]*q - \[Beta]*p == 0},
 {p, q, r, \[Alpha], \[Beta], \[Gamma]}]

The solution took about a second to compute on my machine.

$\endgroup$

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