From ripley@stats.ox.ac.uk  Tue Jan  9 18:21:23 2001
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Tue, 9 Jan 2001 18:21:23 +0000 (GMT)
Subject: [Rd] Inconsistent behaviour in solve (PR#805)
In-Reply-To: <200101091725.SAA00060@pubhealth.ku.dk>
Message-ID: <Pine.GSO.4.31.0101091816140.10815-100000@auk.stats>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Inconsistent behaviour in solve (PR#805)
Prof Brian D Ripley