[R] Determinant
William Dunlap
wdunlap at tibco.com
Fri May 15 00:12:41 CEST 2015
Note that when using double precision arithmetic you cannot tell
if that number is different from other numbers within 10 billion of
it -- they all have the same representation.
> 1.6777215999999849e+29 == 1.6777215999999849e+29 + 1e10
[1] TRUE
You need to use other, time consuming, methods (e.g., arbitrary
precision arithmetic such as in the Rmpfr package, or some
analysis)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, May 14, 2015 at 12:17 PM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:
> Of course the number _is_ an integer. It seems you are asking whether that
> integer can be exactly _represented_ on a computer? That depends on your
> processor (eg. 32/64 bit) and the size of the number; alternatively you
> could calculate with arbitrary precision with the Rmpfr package.
>
> For more insights, have a look at Pat Burs' summary of number
> representation in R (
> http://www.burns-stat.com/documents/tutorials/impatient-r/more-r-key-objects/more-r-numbers/)
> and/or read chapter one of his R inferno.
>
> Or, maybe you can state more clearly what you are trying to achieve in the
> end, there might be other options.
>
> Cheers,
> B.
>
>
>
> On May 14, 2015, at 4:44 AM, chasiotisv at math.auth.gr wrote:
>
> > Hello,
> >
> > I am Vasilis Chasiotis and I am a candidate Ph.D. student in Aristotle
> University of Thessaloniki in Greece.
> >
> > I have the following problem.
> >
> > I want to check if the square of a number ( for example the square of
> 1.677722e+29 ) is an integer.
> >
> > The problem is that this number is the calculation of the determinant
> (so the number should be an integer) of a matrix 22x22, which means it has
> an approximation ( the "real" number is 1.6777216e+29 but R gives to me
> 1.6777215999999849e+29 ), because R use LU-decomposition to calculate the
> determinant.
> >
> > That means that the radical of the number 1.6777215999999849e+29 is not
> an integer, but it should be.
> >
> > How can we overcome this problem?
> >
> > Thank you in advance.
> >
> > I look forward to hearing from you soon.
> >
> >
> > Vasilis Chasiotis
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list