1
$\begingroup$

I want to get a solution of a equation using NSolve.

$BesselI[1,x]/(x*BesselI[0,x])=0.2$

So I plugged this equation to NSolve:

NSolve[BesselI[1,x]/(x*BesselI[0,x])==0.2, x]

But when I use this, the Mathematica gives the same expression. I know that this equation has such a solution from plot:

enter image description here

Could you let me know how to solve this problem?

Any helps will be appreciated. Thank you!

$\endgroup$

2 Answers 2

2
$\begingroup$

Bound the value for x

Solve[{BesselI[1, x]/(x*BesselI[0, x]) == 1/5, -5 < x < 5}, x]

(* {{x -> Root[{(-5) BesselI[1, #] + 
     BesselI[
       0, #] #& , -4.38411711031472304526702680222165674734`18.}]}, {x -> 
   Root[{(-5) BesselI[1, #] + BesselI[0, #] #& , 
     4.38411711031472304526702680222165674734`18.}]}} *)

NSolve[{BesselI[1, x]/(x*BesselI[0, x]) == 1/5, -5 < x < 5}, x]

(* {{x -> -4.38412}, {x -> 4.38412}} *)
$\endgroup$
2
  • $\begingroup$ Thank you! Is there any reason that the code doesn't work when I don't bound the value of x? $\endgroup$
    – Pearl
    Commented Sep 14, 2021 at 15:50
  • 1
    $\begingroup$ By default Mathematica assumes that all variables are complex. It doesn't know how to solve the equation in the complex plane. Even if you specify that x is real, it still doesn't know how to solve the equation. Restricting the range makes the problem simpler and enables Mathematica to find the roots. $\endgroup$
    – Bob Hanlon
    Commented Sep 14, 2021 at 15:54
0
$\begingroup$

Often the solver of NMinimizeis more robust and calculates one solution

NMinimize[{1, BesselI[1, x]/(x*BesselI[0, x]) == 0.2}, x]
(*{1., {x -> -4.38412}}*)

without restriction.

Second solution follows to

NMinimize[{1, BesselI[1, x]/(x*BesselI[0, x]) == 0.2,x>0}, x]
(*{1., {x -> 4.38412}}*)
$\endgroup$
1
  • $\begingroup$ Or NArgMin[{(BesselI[1, x]/(x*BesselI[0, x]) - 1/5)^2, #}, x] & /@ {x < 0, x > 0} $\endgroup$
    – Bob Hanlon
    Commented Sep 14, 2021 at 20:16

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.