Nasser said:
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