3
$\begingroup$

I have the following two equations: 'r1andr2. Here,n, x, y, mpandmm` are real constants. I tried the following solution, but it does not work.

Solve[{r1 (-n r2 + r1 x) - r2 (n r1 - r2 y) == 
   mp, -r2 (n r1 - r2 x) + r1 (-n r2 + r1 y) == 
   mm}, {r1, r2}]

Update:

r1 = Sin[a]; r2 = cos[a];

Number of equations now two.

$\endgroup$
2
  • $\begingroup$ What is the meaning of your Update? Is this expected answer from Solve[] ? What is "a" ? $\endgroup$
    – A. Kato
    Commented Jun 19 at 3:03
  • $\begingroup$ @A.Kato: r1 and r2 are related by 'a' $\endgroup$
    – SciJewel
    Commented Jun 19 at 13:57

2 Answers 2

3
$\begingroup$

You can use Reduce or the following:

Solve[{r1  (-n  r2 + r1  x) - r2  (n  r1 - r2  y) == 
   mp, -r2  (n  r1 - r2  x) + r1  (-n  r2 + r1  y) == 
   mm, -r2  (-n  r2 + r1  x) + r1  (n  r1 - r2  y) == 0}, {r1, r2}, 
 MaxExtraConditions -> All]
(*  < 26 conditional solutions and a warning about a degenerate case > *)
$\endgroup$
8
  • $\begingroup$ @Micheal E2: How to handle so many conditions!. I have only one condition that all constants are real. $\endgroup$
    – SciJewel
    Commented Jun 18 at 16:47
  • 1
    $\begingroup$ @SciJewel You have an overdetermined nonlinear system, so there are solutions only when the constants satisfy certain extra conditions. If you add that everything is real, that might generate more conditions and eliminate some. Solve[system, {r1, r2}, {mm}, Reals, MaxExtraConditions -> All] yields 38 solutions, some with simpler conditions. What sort of handling do you need to do? In a given specific situation, the conditions will evaluate on their own, and some solutions that are not valid under those conditions will evaluate to Undefined. Should we expect it to be less complicated? $\endgroup$
    – Michael E2
    Commented Jun 18 at 17:16
  • $\begingroup$ @Micheal E2: Please check the update. And n,x,y, mp, mm are all positive non-zero real numbers. $\endgroup$
    – SciJewel
    Commented Jun 18 at 17:19
  • $\begingroup$ @SciJewel That seems to make it worse, as far as conditions go. sol2 = Solve[{r1 (-n r2 + r1 x) - r2 (n r1 - r2 y) == mp, -r2 (n r1 - r2 x) + r1 (-n r2 + r1 y) == mm, -r2 (-n r2 + r1 x) + r1 (n r1 - r2 y) == 0, r1^2 + r2^2 == 1}, {r1, r2}, {mm}, Reals, MaxExtraConditions -> All] returns 44 solutions; some are quite complicated; but should be consistent with sine/cosine. Reduces the size by half: sol2b = ParallelMap[TimeConstrained[Simplify[# /. r_Root :> Simplify@ToRadicals@r, TimeConstraint -> 0.1], 30, #] &, sol2] /. r_Root :> Simplify@ToRadicals@r $\endgroup$
    – Michael E2
    Commented Jun 18 at 17:39
  • $\begingroup$ The system, with so many parameters, seems inherently complicated to me. But that doesn't mean all uses of the solution are forbidden. Depends on what you want to do. $\endgroup$
    – Michael E2
    Commented Jun 18 at 17:41
2
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

eqns = {r1  (-n  r2 + r1  x) - r2  (n  r1 - r2  y) == 
    mp, -r2  (n  r1 - r2  x) + r1  (-n  r2 + r1  y) == 
    mm, -r2  (-n  r2 + r1  x) + r1  (n  r1 - r2  y) == 0};

Alternatively, eliminate one of the constants.

Assuming that you want real solutions,

sol[const_Symbol] := Solve[eqns, {r1, r2}, {const}, Reals] // Simplify

(sol1 = sol[mm] // ToRadicals // Simplify)[[1]]

enter image description here

Length@sol1

(* 8 *)

EDIT: Either parameterize sol1 or use a replacement rule to assign values to the constants.

sol1ex = Select[
  sol1 /. {mm -> 1, mp -> 2, n -> 3, x -> 4, y -> 5} // Simplify, 
  FreeQ[#, Undefined] &]

(* {{r1 -> Sqrt[1/55 (25 - 9 Sqrt[5])], 
  r2 -> 1/110 Sqrt[275 - 99 Sqrt[5]] (5 + 3 Sqrt[5])}, {r1 -> -Sqrt[
    1/55 (25 - 9 Sqrt[5])], 
  r2 -> -(1/110) Sqrt[275 - 99 Sqrt[5]] (5 + 3 Sqrt[5])}, {r1 -> Sqrt[
   1/55 (25 + 9 Sqrt[5])], 
  r2 -> 1/10 (5 + 3 Sqrt[5]) Sqrt[1/11 (25 + 9 Sqrt[5])]}, {r1 -> -Sqrt[
    1/55 (25 + 9 Sqrt[5])], 
  r2 -> -(1/10) (5 + 3 Sqrt[5]) Sqrt[1/11 (25 + 9 Sqrt[5])]}} *)

sol1ex // N

(* {{r1 -> 0.29773, r2 -> 0.779468}, {r1 -> -0.29773, 
  r2 -> -0.779468}, {r1 -> 0.905786, r2 -> 2.37138}, {r1 -> -0.905786, 
  r2 -> -2.37138}} *)

EDIT 2: If r1 and r2 are related by r1 = Sin[a]; r2 = cos[a] then two constants must be eliminated. For example, given positive constants

eqns2 = {r1  (-n  r2 + r1  x) - r2  (n  r1 - r2  y) == mp,
    -r2  (n  r1 - r2  x) + r1  (-n  r2 + r1  y) == mm,
    -r2  (-n  r2 + r1  x) + r1  (n  r1 - r2  y) == 0,
    mp > 0, mm > 0, x > 0, y > 0, n > 0} /.
   {r1 -> Sin[a], r2 -> Cos[a]};

sol2 = Assuming[{mp > 0, mm > 0, x > 0, y > 0, n > 0},
  Solve[eqns2, a, {mp, mm}] // Simplify]

enter image description here

Assuming[{x > 0, y > 0, n > 0},
 {r1 -> Sin[a],  r2 -> Cos[a]} /. sol2 // FullSimplify]

enter image description here

$\endgroup$
3
  • $\begingroup$ Hanton: How to handle so many conditions here. $\endgroup$
    – SciJewel
    Commented Jun 18 at 16:48
  • $\begingroup$ Please check for another update. $\endgroup$
    – SciJewel
    Commented Jun 18 at 22:17
  • $\begingroup$ You have been shown how to approach this. What have you tried? What specific problem are you having now? $\endgroup$
    – Bob Hanlon
    Commented Jun 18 at 22:33

Your Answer

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

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