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


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

Re: Problem with Solve and NSolve

Started byDaniel Lichtblau <danl@wolfram.com>
First post2011-10-29 11:17 +0000
Last post2011-10-29 11:17 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#5993 — Re: Problem with Solve and NSolve

FromDaniel Lichtblau <danl@wolfram.com>
Date2011-10-29 11:17 +0000
SubjectRe: Problem with Solve and NSolve
Message-ID<j8gncb$5dk$1@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web