1
$\begingroup$

I want to solve an equation. By Mathematica, it take a long time. What the problem? Can anybody help me?

The code is as follows:

b = FullSimplify[(4 g Sqrt[
 n (1 + n)] (-1 + 2 g Sqrt[\[Eta]]) Sqrt[\[Eta]] (1 + 
   g (1 + 2 Sqrt[n (1 + n)]) (-1 + g Sqrt[\[Eta]]) Sqrt[\[Eta]] + 
   2 n (1 - g Sqrt[\[Eta]] + g^2 \[Eta])) \[Kappa] (\[Kappa] - 
   2 g Sqrt[\[Eta]] \[Kappa]) - (1 - 
   2 g Sqrt[\[Eta]]) (2 Sqrt[n (1 + n)] + 
   g (1 + 2 n + 2 Sqrt[n (1 + n)]) (-1 + 
      g Sqrt[\[Eta]]) Sqrt[\[Eta]]) ((1 - 4 g Sqrt[\[Eta]] + 
      8 g^2 \[Eta]) \[Kappa]^2 + (\[CapitalDelta] + \[CapitalOmega])^2))]

Solve[b == 0, n]
$\endgroup$
2
  • 1
    $\begingroup$ You have six unconstrained variables. Start by adding any known constraints on the variables. Are any real, or positive, or bound? $\endgroup$
    – Bob Hanlon
    Commented Feb 21, 2021 at 13:55
  • $\begingroup$ These are real constant without any more constraints. $\endgroup$ Commented Feb 21, 2021 at 14:30

1 Answer 1

3
$\begingroup$

Here's my method using GroebenerBasis which transforms the original expression to an equivalent 4th degree polynomial. I then solve a simpler poly $a+bx+cx^2+dx^3+ex^4$ for the roots which Mathematica gives four solutions in terms of a,b,c,d. I next re-express the solutions of those in terms of the original constants. The final "theRoots" now express the solutions in terms of all the constants. To obtain numeric values, will need for each of these solutions, substitute numeric values for each of the constants.

However, there is an issue with how Mathematica interprets the square root as you can see when I then back-substitute the test cases below into the original equation (the outputs are not all zero).

Note however, when I replace the expression $\sqrt{n(n+1)}$ in the original expression with the second branch of the root function: $-\sqrt{n(n+1)}$, the two back-substituted roots which did not produce zero, now back-substitute to zero.

Will need to study this in more detail:

theFun = FullSimplify[(4 g Sqrt[
       n (1 + n)] (-1 + 2 g Sqrt[\[Eta]]) Sqrt[\[Eta]] (1 + 
        g (1 + 2 Sqrt[n (1 + n)]) (-1 + 
           g Sqrt[\[Eta]]) Sqrt[\[Eta]] + 
        2 n (1 - g Sqrt[\[Eta]] + g^2 \[Eta])) \[Kappa] (\[Kappa] - 
        2 g Sqrt[\[Eta]] \[Kappa]) - (1 - 
        2 g Sqrt[\[Eta]]) (2 Sqrt[n (1 + n)] + 
        g (1 + 2 n + 2 Sqrt[n (1 + n)]) (-1 + 
           g Sqrt[\[Eta]]) Sqrt[\[Eta]]) ((1 - 4 g Sqrt[\[Eta]] + 
           8 g^2 \[Eta]) \[Kappa]^2 + (\[CapitalDelta] + \
\[CapitalOmega])^2))];

(*
 get polynomial with same roots
*)
gb = First@GroebnerBasis[theFun, n];
(*
 get rules for the coefficients 
*)
coefRules = CoefficientRules[gb, n]
(*
 transform rules in terms of general constants a,b,c,d,e
*)
theRules = 
 coefRules /. {{0} -> a, {1} -> b, {2} -> c, {3} -> d, {4} -> e}
(*
 solve general 4'th degree poly
*)
theSol = Solve[a + b x + c x^2 + d x^3 + e x^4 == 0, x];
(*
 for each of the four solutions, express in original constants
*)
theRoots=theSol /. theRules

For example:

mySol = x /. 
   theRoots /. {g -> 1.5, \[Eta] -> 2/3, \[Kappa] -> 
    1/4, \[CapitalDelta] -> 3/5, \[CapitalOmega] -> 5/2}
theFun /. {g -> 1.5, \[Eta] -> 2/3, \[Kappa] -> 
     1/4, \[CapitalDelta] -> 3/5, \[CapitalOmega] -> 5/2, 
    n -> #} & /@ mySol

{-1.01155 - 1.51656*10^-19 I, 0.0126251 + 1.65926*10^-19 I, 
 22.291 - 3.27457*10^-17 I, 22.296 + 3.27315*10^-17 I}

Out[130]= {-1.30619*10^-12 + 2.61905*10^-17 I, 
 8.26718 + 2.87501*10^-17 I, 
 0.225828 + 1.48832*10^-15 I, -1.24146*10^-10 - 1.48832*10^-15 I}

Now replace $\sqrt{n(1+n)}$ with $-\sqrt{n(1+n)}$:

theFun2 = theFun /. Sqrt[n (1 + n)] -> -Sqrt[n (1 + n)];
theFun2 /. {g -> 1.5, \[Eta] -> 2/3, \[Kappa] -> 
     1/4, \[CapitalDelta] -> 3/5, \[CapitalOmega] -> 5/2, 
    n -> #} & /@ mySol

Out[146]= {-8.26719 - 2.87489*10^-17 I, 
 2.20765*10^-12 - 2.61918*10^-17 I, -8.07177*10^-11 - 
  9.59784*10^-16 I, 0.145631 + 9.59784*10^-16 I}
$\endgroup$
1
  • 1
    $\begingroup$ Once you have the Gröbner basis gb you can simply ask for the roots with Table[Root[Function[n, Evaluate@gb], i], {i, 4}]. $\endgroup$
    – Roman
    Commented Feb 21, 2021 at 16:39

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.