Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5993

Re: Problem with Solve and NSolve

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Daniel Lichtblau <danl@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Problem with Solve and NSolve
Date Sat, 29 Oct 2011 11:17:31 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <j8gncb$5dk$1@smc.vnet.net> (permalink)
References <201110280935.FAA20759@smc.vnet.net>
Lines 53
NNTP-Posting-Date 29 Oct 2011 10:21:21 GMT
NNTP-Posting-Host 254dabe2.news.twtelecom.net
X-Trace DXC=ZW442:gX:iKEFLBoYkbQfNC_A=>8kQj6M=_1NR_H?JPMFWL[9bk^=0NEFiONJ7[GoF:6RKR@jgj]C
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:5993

Show key headers only | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with Solve and NSolve Daniel Lichtblau <danl@wolfram.com> - 2011-10-29 11:17 +0000

csiph-web