Re: Wrong Answer
- To: mathgroup at smc.vnet.net
- Subject: [mg130667] Re: Wrong Answer
- From: Daniel <dosadchy at its.jnj.com>
- Date: Wed, 1 May 2013 03:36:54 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
> Hello,
>
> I've discovered that Solve[] gives me the wrong
> answer for some
> polynomial equations. For example, consider the
> following equation,
> which should have exactly one positive, real answer
> for t.
>
> p:=(px + t vx)^4 + (py + t vy)^4==1
> r:={px->0.5,py->0.5,vx->0.5,vy->0.5}
> NSolve[p/.r,t]
>
> NSolve gives the right answers if I substitute for
> px,py,vx and vy
> before solving. On the other hand, if I use Solve[]
> this way:
>
> Solve[p,t]/.r
>
> I get a different answer, and it's not correct.
> Does Solve[] just malfunction with quartic
> polynomials or is there
> something else happening?
>
> Chris
>
> mathematica 5.2
>
> Solve[p]
>
I use Mathematica 8 and Solve[p,t]/.r returns "Infinite expression 1/Sqrt[0.]..." so obviously there is a division by 0 problem, which could be solved with Limit[].
So "Solve[p, t] /. r" fails, as well as "Solve[p, t] /. Most[r] /. Last[r]"
but,
Limit[t /. Solve[p, t] /. Most[r], Last[r]]
gives the same answer as
p := (px + t vx)^4 + (py + t vy)^4 == 1
r := {px -> 0.5, py -> 0.5, vx -> 0.5, vy -> 0.5}
NSolve[p /. r, t]