MathGroup Archive 2008

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

Search the Archive

Re: Solve inconsistant actions?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87251] Re: Solve inconsistant actions?
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sat, 5 Apr 2008 04:24:43 -0500 (EST)
  • Organization: University of Bergen
  • References: <001e01c895c3$23556720$6501a8c0@MLHC> <47F57015.8090002@gmail.com> <ft4n9s$42q$1@smc.vnet.net>

mhicks wrote:
> Can someone enlighten me as to what discriminators Solve uses in 
> providing some solutions while disdaining others in the attached simple 
> code?
>  
> Is it an operator or Mathematica bug? I am running 6.0.1 under win xp.
> 
> 
> newrent = Table[125000 \[ExponentialE]^(r 14), {r, .01, .04, .005}] // N
> 
> Table[Solve[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}]
> 
> Table[Solve[newrent[[i]]/rate == 1894000. , rate], {i, 1, 7}]
> 
> Table[Reduce[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}]
> 
> Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}]
> 

This happens because Solve was designed to work with exact values and 
you are using it with approximate (floating point) values.  When it 
verifies the solutions, it finds some of the solutions to be incorrect 
(because of precision issues).  With VerifySolutions -> False Solve will 
return all solutions:

Solve[#/rate == 1894000, rate, VerifySolutions -> False] & /@ newrent

However, it is generally a very bad idea to mix exact and approximate 
values in calculations (or to use approximate values in symbolic 
calculations).

Either use exact values in newrent:

Solve[#/rate == 1894000, rate] & /@ Rationalize[newrent, 0]

or use NSolve if you only need approximate solutions:

NSolve[#/rate == 1894000, rate] & /@ newrent

Szabolcs


  • Prev by Date: Re: How to put text on a curved surface?
  • Next by Date: What determines #1 and #2 values (with &) for ContourLabels?
  • Previous by thread: Re: Solve inconsistant actions?
  • Next by thread: Fitting a inverse function from complicated integral