MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with Solve and NSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122460] Re: Problem with Solve and NSolve
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 29 Oct 2011 07:10:40 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110280935.FAA20759@smc.vnet.net>

On 10/28/2011 04:35 AM, V. Williams wrote:
> I've recently tried Mathematica 8.0.1, and I've found that it's unable to compute Solve[x^3*Sin[x]==1,x] (and the same with NSolve), which gives an error:
> Solve::nsmet: This system cannot be solved with the methods available to Solve
>
> WolframAlpha solves it without problems, so what's wrong with Mathematica?

Solve and NSolve work with global methods to find all solutions. None 
apply in the case where there are no restrictions on ranges.

W|A is (probably) using FindRoot in clever ways. You can get solutions 
in a similar manner.

In[2]:= Union[
  x /. Table[FindRoot[x^3*Sin[x] == 1, {x, n}], {n, -20, 20}],
  SameTest -> (Abs[#1 - #2]/(Abs[#1] + Abs[#2]) < .01 &)]

During evaluation of In[2]:= FindRoot::jsing: Encountered a singular 
Jacobian at the point {x} = {0.}. Try perturbing the initial point(s). >>

Out[2]= {-18.8497, -15.7077, -12.5669, -9.42358, -6.28721, -3.10829, \
-1.04879, 0., 1.04879, 3.10829, 6.28721, 9.42358, 12.5669, 15.7077, \
18.8497}

Alternatively, tell N/Solve there is a range restriction.

In[3]:= Solve[x^3*Sin[x] == 1 && -20 <= x <= 20, x]

Out[3]= {{x ->
    Root[{-1 + Sin[#1] #1^3 &, -18.8497052306506243533}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -15.7077052429555957752}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -12.5668744839930992344}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -9.4235830047464065106}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -6.2872090246108708029}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -3.1082870794604030006}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, -1.04879348372390196188}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 1.04879348372390196188}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 3.1082870794604030006}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 6.2872090246108708029}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 9.4235830047464065106}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 12.5668744839930992344}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 15.7077052429555957752}]}, {x ->
    Root[{-1 + Sin[#1] #1^3 &, 18.8497052306506243533}]}}

In[4]:= NSolve[x^3*Sin[x] == 1 && -20 <= x <= 20, x]

Out[4]= {{x -> -18.8497}, {x -> -15.7077}, {x -> -12.5669}, {x -> \
-9.42358}, {x -> -6.28721}, {x -> -3.10829}, {x -> -1.04879}, {x ->
    1.04879}, {x -> 3.10829}, {x -> 6.28721}, {x -> 9.42358}, {x ->
    12.5669}, {x -> 15.7077}, {x -> 18.8497}}

Daniel Lichtblau
Wolfram Research



  • Prev by Date: PopupMenu Problems
  • Next by Date: Re: Matematica Beginner/Student and Mysql
  • Previous by thread: Re: Problem with Solve and NSolve
  • Next by thread: Re: Problem with Solve and NSolve