-1
$\begingroup$

How can I get all the possible solutions using NSolve. The following equation has eight analytic solutions. These analytic solutions are obtain using "Solve" as shown below. Now, I would like to use "NSolve" to solve the same equation, say for one point ub = 0.25 and 'k=1', and compare the analytic with the numerical solution. However. "NSolve gives me only one or two real solutions?!

SubPlus[λ] = (-k^2 + Sqrt[ϵ^2 - ub^2])^(1/2); 
SubMinus[λ] = (-k^2 - Sqrt[ϵ^2 - ub^2])^(1/2); 
SubPlus[f] = (I SubPlus[λ] - k)^2/(ϵ - ub); 
SubMinus[f] = (I SubMinus[λ] - k)^2/(ϵ - ub); 
SubPlus[g] = (I SubPlus[λ] + k)^2/(ϵ + ub); 
SubMinus[g] = (I SubMinus[λ] + k)^2/(ϵ + ub);

FullSimplify[
  Solve[
    {Det[
       MatrixForm[
         {{1, 1, -1, -1}, 
          {SubPlus[f], SubMinus[f], -SubPlus[g], -SubMinus[g]}, 
          {SubPlus[λ], SubMinus[λ], SubPlus[λ], SubMinus[λ]}, 
          {SubPlus[λ]*SubPlus[f], SubMinus[λ]*SubMinus[f], 
           SubPlus[λ]*SubPlus[g], SubMinus[λ]*SubMinus[g]}}]]
       == 0}, 
     {ϵ}]]
$\endgroup$

closed as unclear what you're asking by march, RunnyKine, user9660, m_goldberg, MarcoB Mar 31 '16 at 6:01

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Please post properly formatted, copy-and-paste-able code rather than this mess (choose Copy as Plain Text). As it is, no one can read and understand what's going on here. $\endgroup$ – march Mar 31 '16 at 2:21
3
$\begingroup$

Your problem stems from wrapping the matrix given to Det with MatrixForm. Correcting that gives

SubPlus[λ] = (-k^2 + Sqrt[ϵ^2 - ub^2])^(1/2); 
SubMinus[λ] = (-k^2 - Sqrt[ϵ^2 - ub^2])^(1/2); 
SubPlus[f] = (I SubPlus[λ] - k)^2/(ϵ - ub); 
SubMinus[f] = (I SubMinus[λ] - k)^2/(ϵ - ub); 
SubPlus[g] = (I SubPlus[λ] + k)^2/(ϵ + ub); 
SubMinus[g] = (I SubMinus[λ] + k)^2/(ϵ + ub);

FullSimplify[
   Solve[
     Det[
       {{1, 1, -1, -1},
        {SubPlus[f], SubMinus[f], -SubPlus[g], -SubMinus[g]}, 
        {SubPlus[λ], SubMinus[λ], SubPlus[λ], SubMinus[λ]}, 
        {SubPlus[λ]*SubPlus[f], SubMinus[λ]*SubMinus[f], 
         SubPlus[λ]*SubPlus[g], SubMinus[λ]*SubMinus[g]}}] == 0,
     ϵ]]

result

$\endgroup$

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