Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7786

Re: higher precision doubles

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: higher precision doubles
Date 2011-09-11 10:59 +0200
Organization albasani.net
Message-ID <j4ht9u$hk3$1@news.albasani.net> (permalink)
References <j1hqc1$1ch$1@news.albasani.net> <strictfp-20110806003831@ram.dialup.fu-berlin.de> <j1k4db$1n2$1@news.albasani.net> <j4hev1$lho$1@speranza.aioe.org>

Show all headers | View raw


Nasser M. Abbasi schrieb:

> Mathematica:
>
> x = Sin[2 Pi]
> 0
>
> An exact zero. As was created by God. Not a floating point zero.
>
> --Nasser

Well from my original post you should see that I am
interested in IEEE as a correctness measure and
not a symbolic computation solution.

Actually Mathematica, judging from playing with
Wolfram Alpha, is pretty good in solving symbolic
equations with sin and cos. Just try the following:

     sin(x)=cos(x)

And it will give you:

     x = 2*(pi * n - tan-1(1 +/- sqrt(2))

But since Galois we know that closed form solutions
can be limited. So when you try the following

     sin(x)+x=cos(x)

You will get:

     x ~ 0.456625

And then you can press the more digits button:

     x ~ 0.45662470456763082444

And press the more digits button again:

     x ~ 0.4566247045676308244376974571284573758982

And again:

    x ~ 0.4566247045676308244376974571284573758982
          3161389225632524227823077345386290064230

Etc.. This is already bettern than picking a IEEE
format, since we can gradually increase the precision.
Any pointers to Java libraries that can do that would be
highly appreciated.

I guess we could start with BigDecimal and some Newton
algorithms. But subproblem here is applying Newton to
-cos(x)+sin(x)+x would also demand to have a cos/sin on
BigDecimal. And I did not yet see a reference to a library
that could do that on BigDecimal.

A library should be possible when Mathematica can
do it. But maybe Taylor is not the prefered method here,
because of slow convergence. Maybe better some Chebychev
Polynom expansion.

But there is no Heaven here on Earth. All we can do
in the present case, we can gradually approximate the
real number but not jump on it.

Bye

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: higher precision doubles "Nasser M. Abbasi" <nma@12000.org> - 2011-09-10 21:53 -0700
  Re: higher precision doubles Lew <lewbloch@gmail.com> - 2011-09-10 22:22 -0700
    Re: higher precision doubles "John B. Matthews" <nospam@nospam.invalid> - 2011-09-11 05:36 -0400
    Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 13:29 +0200
      Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 13:50 +0200
        Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 14:09 +0200
  Re: higher precision doubles Jan Burse <janburse@fastmail.fm> - 2011-09-11 10:59 +0200

csiph-web