0
$\begingroup$

I first tried this command:

NSolve[(2 Cos[x] Sin[x])/x^2 - (2 Sin[x]^2)/x^3 == 0, x, Reals]

which yields "This system cannot be solved with the methods available to NSolve.". But when I change it to

NSolve[{(2 Cos[x] Sin[x])/x^2 - (2 Sin[x]^2)/x^3 == 0, Element[x, Interval[{0.5, 10}]]}, x, Reals]

I get all solutions of the given interval as long as the interval does not touch zero.

Even more puzzling, when using Solve without interval I get no solutions which was to expect but when I do

Solve[{(2 Cos[x] Sin[x])/x^2 - (2 Sin[x]^2)/x^3 == 0, Element[x, Interval[{1/2, 10}]]}, x, Reals]

(the above with solve) I get

{{x -> {\[Pi]}}, {x -> {2 \[Pi]}}, {x -> {3 \[Pi]}}, {x -> \ {Root[{-Sin[#1] + Cos[#1] #1 &, 4.4934094579090641753}]}}, {x -> {Root[{-Sin[#1] + Cos[#1] #1 &, 7.7252518369377071642}]}}}

which are pseudo solutions which are however often easier to work with.

So why do Solve and NSolve struggle with this kind of equation and how can I work with that when not expecting it?

$\endgroup$
  • $\begingroup$ It has been asked many times, so you should take a closer look at the equation-solving and trigonometry tags. I guess this is almost a duplicate of Can Reduce really not solve for x here?. See also Solve symbolically a transcendental trigonometric equation and plot its solutions $\endgroup$ – Artes Jan 30 '18 at 18:43
  • 2
    $\begingroup$ "How can I work with that when not expecting it?" - this is in general some kind of art, you can master it with some practice and insight. $\endgroup$ – Artes Jan 30 '18 at 18:49
  • $\begingroup$ f[x_] = (2 Cos[x] Sin[x])/x^2 - (2 Sin[x]^2)/x^3; The problem with x = 0 is that f[0] is only defined in the limit: f[0] is Indeterminate but Limit[f[x], x -> 0] evaluates to 0 $\endgroup$ – Bob Hanlon Jan 30 '18 at 19:05
  • $\begingroup$ @artes thanks for links -- those helped me $\endgroup$ – chr Jan 30 '18 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.