MathGroup Archive 2008

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

Search the Archive

Solve vs. NSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92796] Solve vs. NSolve
  • From: SigmundV <sigmundv at gmail.com>
  • Date: Mon, 13 Oct 2008 06:21:07 -0400 (EDT)

Dear group members,

Consider

f[a_, b_, c_, k_, t_] :=
  With[{\[Alpha] = a k, \[Beta] = b k}, (x - \[Alpha] Cos[t])^2/a^2 +
(y - (\[Beta] Sin[t] + c) - c)^2/b^2 - 1 == 0];
df[a_, b_, c_, k_, t_] := D[f[a, b, c, k, t], t];

and execute

{x, y} /. Simplify@PowerExpand@Simplify@Solve[{f[1, 2, 1/2, 4/5, t],
df[1, 2, 1/2, 4/5, t]}, {x, y}] // Chop // N

and

{x, y} /. Simplify@PowerExpand@Simplify@NSolve[{f[1, 2, 1/2, 4/5, t],
df[1, 2, 1/2, 4/5, t]}, {x, y}] // Chop
Simplify@PowerExpand@Chop@Simplify[% /. Cos[2 t] -> (1 - 2 Sin[t]^2)]

respectively.

As you see, Solve and NSolve yield two different solutions, with the
solution from Solve being the correct one, as can be verified by
plugging in to the equations -- the solution from NSolve does not
satisfy the second equation, but only the first. Can anyone explain
this behaviour to me?

Best wishes,
Sigmund Vestergaard


  • Prev by Date: Re: Resize dynamic graphics - How?
  • Next by Date: Nested If
  • Previous by thread: Re: Resize dynamic graphics - How?
  • Next by thread: Re: Solve vs. NSolve