Inconsistent behaviour in solve (PR#805)
On Tue, 9 Jan 2001 J.C.Rougier@durham.ac.uk wrote:
I find this a bit puzzling ...
solve(matrix(c(5, 2, 3, 1), 2, 2), c(Inf, 3))
[1] NaN Inf
solve(matrix(c(5, 2, 3, 1), 2, 2)) %*% c(Inf, 3)
[,1] [1,] -Inf [2,] Inf I would expect the answer to be c(-Inf, Inf), so why has the -Inf been replaced by NaN in solve?
Why would you expect it? Did you actually check it? You have 5x + 3y = Inf, 2x + y = 3 if y - Inf, x = -Inf and 5x + 3y = NaN, 2x + y = NaN. Once you have infinities, the standard laws of arithmetic break.
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._