From: Bill Rowe on
On 12/16/09 at 6:19 AM, lokieffect(a)gmail.com (negatron) wrote:

>NSolve[x^2 + 1 == 2^x]

<error msg snipped>

>Am I forgetting something trivial here?

There are two issues with what you have done. First, you did not
tell NSolve x is the variable to solve for. That is, the proper
syntax for NSolve would be

NSolve[x^2 + 1 == 2^x, x]

The second issue is NSolve is designed mainly to solve
polynomial equations and your equation is not a polynomial
equation. NSolve will solve *some* non-polynomial equations when
the inverse function is known. For example,

In[3]:= NSolve[Log[x] == 2, x]

Out[3]= {{x->7.38906}}

But in your case, NSolve cannot find a solution. So, a better
choice would be to use FindRoot, i.e.,

In[4]:= FindRoot[x^2 + 1 - 2^x, {x, .5}]

Out[4]= {x->1.}

And by inspection it is clear there are two solutions (0,1) to
your equation.


From: Emu on
On Dec 16, 10:35 pm, Alois Steindl <Alois.Stei...(a)tuwien.ac.at> wrote:
> negatron <lokieff...(a)gmail.com> writes:
> > NSolve[x^2 + 1 == 2^x]
>
> > "Solve::tdep: "\!\(\*
> > StyleBox[\"\\\"The equations appear to involve the variables to be
> > solved for in an essentially non-algebraic way.\\\"\", \"MT\"]\) ""
>
> > Am I forgetting something trivial here?
>
> Hello,
> from the Help page:
> NSolve[lhs==rhs,var]
> gives a list of numerical approximations to the roots of a polynomial equ=
ation.
>
> Although your equation looks quite simple, it isn't polynomial.
>
> Alois
>
> --
> Alois Steindl, Tel.: =
+43 (1) 58801 / 32558
> Inst. for Mechanics and Mechatronics Fax.: +43 (1) 58801 / 32598
> Vienna University of Technology, A-1040 Wiedner Hauptstr.=
8-10


As Alois notes, NSolve works on polynomial equations. You can solve
this equation over the reals using Reduce:

In[115]:= Reduce[x^2+1==2^x,x,Reals]
Out[115]= x==0||x==1||x==Root[{-1+2^#1-#1^2&,4.25746191444793=
21019}]

or FindInstance will find some complex solutions:

In[117]:= FindInstance[x^2+1==2^x,x,5]
Out[117]= {{x->0},{x->Root[{1-2^#1+#1^2&,
14.2777096537821822260910752503384388888515806289608547066648+140.210337930=
3247067404490506737243454752078618741370359129614
I}]},{x->Root[{1-2^#1+#1^2&,
11.315217373315832169126504509878764105736595813512044591783-49.20350726676=
6328451490043230114735898358622736089923747162
I}]},{x->1},{x->Root[{1-2^#1+#1^2&,
11.7904521020421982997626068354451199960161510551391549188711-58.3451893667=
587123424910631309295682423760297305737701633908
I}]}}

Sam

From: Lawrence Walker on
On Dec 16, 6:22 am, negatron <lokieff...(a)gmail.com> wrote:
> NSolve[x^2 + 1 == 2^x]
>
> "Solve::tdep: "\!\(\*
> StyleBox[\"\\\"The equations appear to involve the variables to be
> solved for in an essentially non-algebraic way.\\\"\", \"MT\"]\) ""
>
> Am I forgetting something trivial here?

Try

FindRoot[x^2 + 1 == 2^x, {x, .1}]

From: Daniel Lichtblau on
negatron wrote:
> NSolve[x^2 + 1 == 2^x]
>
> "Solve::tdep: "\!\(\*
> StyleBox[\"\\\"The equations appear to involve the variables to be
> solved for in an essentially non-algebraic way.\\\"\", \"MT\"]\) ""
>
> Am I forgetting something trivial here?

Yes. That NSolve likes polynomial equations. This will be extended in a
future release, so you'll be able to do things like what I show below.

In[7]:= NSolve[x^2 + 1 == 2^x && x>=0, x]
Out[7]= {{x -> 0}, {x -> 1.}, {x -> 4.25746}}

Daniel Lichtblau
Wolfram Research

From: dh on


Hi,

well, why do you think this is simple?

Reduce can do this, but you have to tell it that you want a real solution:



Reduce[x^2 + 1 == 2^x, x, Reals]



Daniel



negatron wrote:

> NSolve[x^2 + 1 == 2^x]

>

> "Solve::tdep: "\!\(\*

> StyleBox[\"\\\"The equations appear to involve the variables to be

> solved for in an essentially non-algebraic way.\\\"\", \"MT\"]\) ""

>

> Am I forgetting something trivial here?

>