From: negatron on
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?

From: Alois Steindl on
negatron <lokieffect(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 equation.

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

From: Bob Hanlon on

NSolve is intended primarily for polynomial equations (although you also left out the variable).

Use FindRoot

eqn = x^2 + 1 == 2^x;

Plot[eqn, {x, -1, 5}]

soln = Union[FindRoot[eqn, {x, #}] & /@
Range[-1, 5] // Chop,
SameTest -> (Abs[(x /. #1) - (x /. #2)] < 10^-12 &)]

{{x->0},{x->1.},{x->4.25746}}


Bob Hanlon

---- negatron <lokieffect(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?



From: DrMajorBob on
Plot[fns = {x^2 + 1, 2^x}, {x, -2, 2}]

From that, I get starting points for FindRoot.

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

{x -> -1.66744*10^-16}

FindRoot[x^2 + 1 - 2^x, {x, 1.01}]

{x -> 1.}

The first root is exactly 0, and the second is exactly 1, which you can
easily verify by looking at the problem.

Bobby

On Wed, 16 Dec 2009 05:19:55 -0600, negatron <lokieffect(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?
>


--
DrMajorBob(a)yahoo.com

From: negatron on
On Dec 16, 6:35 am, Alois Steindl <Alois.Stei...(a)tuwien.ac.at> wrote:

> Although your equation looks quite simple, it isn't polynomial.

Hi, it's not indeed, however my presumption was that Mathematica
should converge on a solution using non-algebraic means. Monte Carlo
algorithms for example should achieve a solution rather instantly and
they're quite trivial to implement.

Wolfram Alpha for example gives the solution to this and any such
equation without the slightest fuss about the nature of the
expression, so I assumed I was making a trivial error.

I've been informed using FindRoot is necessary. I was hoping NSolve
would directly provide the numerical solution, but such is life :)

Thanks.