Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

BigDecimal and trigonometrics

Thread view: 
javerberg@yahoo.com - 14 Nov 2005 18:37 GMT
Does anyone know an easy way, or know of freely any available code /
packages, to use sine and cosine on BigDecimal with full precision?

/Magnus
Oliver Wong - 14 Nov 2005 19:47 GMT
> Does anyone know an easy way, or know of freely any available code /
> packages, to use sine and cosine on BigDecimal with full precision?

   AFAIK, the sine of a value may be an irrational number, which means it
may take an infinite number of digits to represent. Therefore, what you are
asking for is impossible on a computer with finite memory, nevermind whether
it's running Java or not.

   - Oliver
Jeffrey Schwab - 14 Nov 2005 21:09 GMT
>>Does anyone know an easy way, or know of freely any available code /
>>packages, to use sine and cosine on BigDecimal with full precision?
[quoted text clipped - 3 lines]
> asking for is impossible on a computer with finite memory, nevermind whether
> it's running Java or not.

That's only true if one assumes a traditional floating-point
representation.  There are plenty of techniques (continued fractions,
symbolic algebra, etc.) for representing irrational numbers with
infinite precision in finite memory.
Oliver Wong - 14 Nov 2005 22:47 GMT
>>>Does anyone know an easy way, or know of freely any available code /
>>>packages, to use sine and cosine on BigDecimal with full precision?
[quoted text clipped - 8 lines]
> symbolic algebra, etc.) for representing irrational numbers with infinite
> precision in finite memory.

   You are, of course, correct. My bad.

   That being said, if the OP wishes to use BigDecimal, I think we can
safely assume (s)he wants traditional floating-point representation.

   - Oliver
Roedy Green - 15 Nov 2005 06:50 GMT
On Mon, 14 Nov 2005 21:10:08 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>That's only true if one assumes a traditional floating-point
>representation.  There are plenty of techniques (continued fractions,
>symbolic algebra, etc.) for representing irrational numbers with
>infinite precision in finite memory.

I think you are confusing rational repeaters (which can be accurately
represented by a rational fraction) with irrationals that at best
could be described as a limit of a series, e.g. pi, e.  

Remember the proof that there are non-rational numbers, discovered,
IIRC by the ancient Greeks.  There is no way you can map all
rationals, much less all irrationals with perfect accuracy into a
finite address space. There an infinite but countably many rationals
and uncountably many irrationals.  (One of my pet peeves is
newscasters who use the term "uncountable" to mean "a large number" or
"more than I can count on my fingers".)

"Countable" to mathematicians means there exists a 1-1 mapping between
the set and the set of integers.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

javerberg@yahoo.com - 15 Nov 2005 08:42 GMT
Thank you for all replies. Unfortunatelly I expressed my self badly.
What I meant was "arbitary precision". I would for example like to be
able to calculate sin(0.2 and cosin(0.2) with 30 decimals. It's
possible to do with Taylor expansion, but I hoped there would be some
ready package avaible. Sorry for my bad English.
/Magnus
Chris Uppal - 15 Nov 2005 10:52 GMT
> Thank you for all replies. Unfortunatelly I expressed my self badly.
> What I meant was "arbitary precision". I would for example like to be
> able to calculate sin(0.2 and cosin(0.2) with 30 decimals.

Are you forced to use the BigDecimal class ?  If not then there are other
arbitrary precision packages around which might do what you want.  One example
(which I have never used so I cannot speak for its quality or appropriateness):

   http://www.apfloat.org/apfloat_java/

   -- chris
Oliver Wong - 15 Nov 2005 15:33 GMT
> On Mon, 14 Nov 2005 21:10:08 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 19 lines]
> "Countable" to mathematicians means there exists a 1-1 mapping between
> the set and the set of integers.

   You are, of course, also correct. But in the specific case of the OP's
problem, assuming (s)he wants the sine (or cosine) of a rational number,
this can always be expressed in finite memory as the string "SIN(x)" where x
is the rational number represented in some finite form (e.g. a finite
decimal expansion, which is sometimes possible, or a fraction of two finite
whole numbers, which is always possible).

   - Oliver
Roedy Green - 15 Nov 2005 18:00 GMT
>But in the specific case of the OP's
>problem, assuming (s)he wants the sine (or cosine) of a rational number,
>this can always be expressed in finite memory as the string "SIN(x)" where x
>is the rational number represented in some finite form (e.g. a finite
>decimal expansion, which is sometimes possible, or a fraction of two finite
>whole numbers, which is always possible).

There are an infinite number of rational numbers. Therefore you cannot
represent them with a finite string much less all possible
transcendental functions of them.

If you limit yourself to all rational numbers expressible as the
division of two 1,000,000-bit integers then the "rationals" can be
represented by finite strings, but that is just the merest wisp of the
total number of rationals.

The problem here is we are wearing two hats -- mathematician and
computer programmer.  Computer programmers are always talking about
finite subset approximations of the numbers that mathematicians think
about. Computer programmers sometimes forget that, and that the
mathematical rules don't perfectly apply on that limited set.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 15 Nov 2005 20:46 GMT
>>But in the specific case of the OP's
>>problem, assuming (s)he wants the sine (or cosine) of a rational number,
[quoted text clipped - 8 lines]
> represent them with a finite string much less all possible
> transcendental functions of them.

   Yes, there are an infinite number of rational numbers, but every one of
them can be represented with finitely many ASCII characters. And you only
need a finite amount of ASCII characters to represent "SIN(" and ")". That
is why you only need finite memory to represent the sine (or cosine) of any
particular rational number.

   And if the OP wants to represent the sine (or cosine) or 10 rational
numbers, this will also require "merely" finite memory. Same with a billion.
In fact, as long as the OP wishes to represent the sine (or cosine) of a
finite number of rational numbers, (s)he will only need finite memory.

   If (s)he wants an infinite number of rational numbers, that's a
different story, with its own problems (where would these infinite number of
rational numbers come from? user input? some sort of iterator?)

   - Oliver
Roedy Green - 16 Nov 2005 10:03 GMT
>    If (s)he wants an infinite number of rational numbers, that's a
>different story, with its own problems (where would these infinite number of
>rational numbers come from? user input? some sort of iterator?)

There is no upper bound on the RAM needed to represent a single
rational as a string.

There is also the practical manner of the size of the address space
and the limit bigDecimal or bigInteger imposes on the length.

You can only deal with a very small subset of the rationals in Java.

One place you run into these super large numbers is in calculating
combinatorics.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 16 Nov 2005 05:00 GMT
> On Mon, 14 Nov 2005 21:10:08 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 19 lines]
> "Countable" to mathematicians means there exists a 1-1 mapping between
> the set and the set of integers.

Can we assume that each rational number we need to represent must have
be arrived at by some sequence of mathematical operations?  If so, each
such number can be represented by the sequence of operations that
invokes it.
Oliver Wong - 16 Nov 2005 16:05 GMT
> Can we assume that each rational number we need to represent must have be
> arrived at by some sequence of mathematical operations?  If so, each such
> number can be represented by the sequence of operations that invokes it.

   For any number X (rational or otherwise), we can arrive at it by
starting with X and doing zero operations on it. This doesn't nescessarily
prove that X can be represented with finite memory though.

   If X is rational, then we sort of apriori have to assume that the step
of "start with X" requires finite memory, to which we perform 0 operations
(thus adding a overhead of 0 memory) and end up with finite memory
requirements again.

   - Oliver
Jeffrey Schwab - 16 Nov 2005 16:56 GMT
>>Can we assume that each rational number we need to represent must have be
>>arrived at by some sequence of mathematical operations?  If so, each such
[quoted text clipped - 3 lines]
> starting with X and doing zero operations on it. This doesn't nescessarily
> prove that X can be represented with finite memory though.

Of course not.  That would be cheating.

>     If X is rational, then we sort of apriori have to assume that the step
> of "start with X" requires finite memory, to which we perform 0 operations
> (thus adding a overhead of 0 memory) and end up with finite memory
> requirements again.

Yes, that's true.  But can you please point me to an irrational number
that cannot be derived by a sequence of mathematical operations on
rational numbers?
Oliver Wong - 16 Nov 2005 17:06 GMT
> Yes, that's true.  But can you please point me to an irrational number
> that cannot be derived by a sequence of mathematical operations on
> rational numbers?

No, but I think I can prove their existence if I can prove that all
sequences of mathematical operations on rational numbers is countable (since
the there are uncountably many irrational numbers).

Every sequence of mathematical operations on rational numbers can be
represented by some ASCII string (e.g. "1+1")

You can order them by using Java's standard string sorting algorithm.
Associate the first such legal string with the integer 1.
Associate the second such legal string with the integer 2.
And so on.

   You now have a 1 to 1 mapping between sequences of mathematical
operations on rational numbers and the set of natural numbers, thus showing
that there are only countably many sequences of mathematical operations on
rational numbers.

   Note that I'm assuming the ASCII representation is finite, which I think
is true as long as the number of operators and the number of arguments to
each operator is finite in the sequence (and as long as each operator and
each term can be represented by a finite number of characters, which is true
for rational numbers).

   - Oliver
Jeffrey Schwab - 16 Nov 2005 22:48 GMT
>>Yes, that's true.  But can you please point me to an irrational number
>>that cannot be derived by a sequence of mathematical operations on
>>rational numbers?
>
> No, but I think I can prove their existence

Yes, of course they exist.  Name one.

> if I can prove that all
> sequences of mathematical operations on rational numbers is countable (since
[quoted text clipped - 18 lines]
> each term can be represented by a finite number of characters, which is true
> for rational numbers).

Nicely done!!!  So there certainly are unrepresentable irrational
numbers.  Let me "clarify" my position:  Any irrational number that can
be clearly represented in a traditional mathematical formula or proof,
can also be represented in a computer program.
Roedy Green - 17 Nov 2005 00:56 GMT
On Wed, 16 Nov 2005 22:48:52 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>Any irrational number that can
>be clearly represented in a traditional mathematical formula or proof,
>can also be represented in a computer program.

That is like saying that every describable mathematical problem has a
solution that can be represented in Java, clear grandiosity.  And
clearly false -- look at the halting problems.

You may be attempting to say something much weaker -- that anything
that can be expressed in mathematical notation could be formulated in
a Java String, e.g. as a TeX or PostScript program to typeset it.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 17 Nov 2005 16:22 GMT
> On Wed, 16 Nov 2005 22:48:52 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 3 lines]
>>be clearly represented in a traditional mathematical formula or proof,
>>can also be represented in a computer program.

[snip]

> You may be attempting to say something much weaker -- that anything
> that can be expressed in mathematical notation could be formulated in
> a Java String, e.g. as a TeX or PostScript program to typeset it.

   I think the two are equivalent. Jeffrey is merely saying that you can
represent the number in a computer program (e.g. as a String), not
nescessarily that you could compute it's value. For example, you can
represent Chaitin's constant as the string "Chaitain's constant" (or by its
one character symbol if you have unicode support) on a computer with finite
memory, even though actually computing the value of Chaitin's constant would
be equivalent to solving the halting problem.

http://en.wikipedia.org/wiki/Chaitin%27s_constant

   - Oliver
Jeffrey Schwab - 17 Nov 2005 16:59 GMT
>>On Wed, 16 Nov 2005 22:48:52 GMT, Jeffrey Schwab
>><jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 19 lines]
>
> http://en.wikipedia.org/wiki/Chaitin%27s_constant

Thanks, that's what I was trying to say.
Roedy Green - 16 Nov 2005 20:26 GMT
On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

> But can you please point me to an irrational number
>that cannot be derived by a sequence of mathematical operations on
>rational numbers?

The time until George Bush's death in microseconds from noon UTC
today.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Googmeister - 16 Nov 2005 22:34 GMT
> On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 6 lines]
> The time until George Bush's death in microseconds from noon UTC
> today.

Nice one. :)

Choose a random number uniformly between 0.0 and 1.0.
It will almost surely be uncomputable.
Jeffrey Schwab - 16 Nov 2005 23:00 GMT
>>On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
>><jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 11 lines]
> Choose a random number uniformly between 0.0 and 1.0.
> It will almost surely be uncomputable.

Nice job. I think you've actually got me there. :)  We could certainly
use symbols to stand for these numbers, but I don't think the symbols
could really be said to "represent" the irrationals; for example, I
don't think symbolic representations could be used to order such random
numbers.  Just for giggles, here's a way to assign symbols to truly
random numbers:

In order to be observed, such numbers must be generated by some process,
at some finite rate.  (It is understood that other irrational numbers
exist, but it should also be understood that only finite number may ever
be observed by people or computers, since there is a finite number of
people and computers, each having finite faculties of observation.)  We
can then refer to the first number generated by the process as R1, the
second as R2, etc.  Randoms generated at the same instant may be refered
to as RnA, RnB, etc., where n is an ordinal integer.
Roedy Green - 16 Nov 2005 20:29 GMT
On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>Yes, that's true.  But can you please point me to an irrational number
>that cannot be derived by a sequence of mathematical operations on
>rational numbers?

It has already been proved there are more irrational numbers that can
be put into 1-1 corresponding with integers, hence Strings. "Most" (in
the Lebesgue sense) irrationals cannot be described by a String. You
are dabbling in measure theory, which is pretty far removed from
computer science which is the study of finite numbers.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 16 Nov 2005 22:44 GMT
> On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 6 lines]
> It has already been proved there are more irrational numbers that can
> be put into 1-1 corresponding with integers, hence Strings.

Right, we agree on that.  I'm just saying that a program needing to
represent irrational numbers with "infinite" precision can do so by
representing them in an abstract, symbolic way.

> "Most" (in
> the Lebesgue sense) irrationals cannot be described by a String. You
> are dabbling in measure theory, which is pretty far removed from
> computer science which is the study of finite numbers.

I'm not familiar with Lebesgue, or "measure theory."  If you have any
good links on them, I'd be interested in learning.

Computer science is NOT strictly the study of finite numbers.  That's
like saying Astronomy is the study of telescopes.  Finite numbers are
just some of the fundamental tools of computer science.
Roedy Green - 17 Nov 2005 01:13 GMT
On Wed, 16 Nov 2005 22:44:27 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>I'm not familiar with Lebesgue, or "measure theory."  If you have any
>good links on them, I'd be interested in learning.

You are dancing around an area of advanced mathematics that you might
find fascinating.  

Things you might google for are Aleph, countable, uncountable, 1-1
mapping, advanced probability theory, Lebesgue measure theory, the
different kinds of infinity, Georg Kantor, transfinite numbers.

rationals are like thin strips of celery fibre in a thick soup of
irrationals. Even though you can always find an irrational between two
rationals and a rational between two irrationals, in a very strong
sense, irrationals are vastly more numerous, and most definitely can't
be enumerated by a set of strings.

How do you quantify that? You do it by integrating over all the
rationals or over all the irrationals.  The set of rationals is called
a set of measure 0, because when you do that, their contribution comes
out 0.  Just how you do those integrals is called Lebesgue measure
theory.

The way you usually tackle the domain of knowledge is with first
calculation of finite probablities and combinatorics, then
probability, then the various types of infinity, then probability
theory over these various infinite sets.

You then wander around in Markovian processes (the things that turned
me on most since they are so much like finite state automata.) and the
astounding 0-1 law.

This is stuff I did not learn until after I had my BSc back when I was
studying it, so the books you may find won't necessarily be that
accessible. Mathematicians tend to go for brevity, and elegance, as if
they were constructing puzzles.  They are not big on handing you any
sort of intuitive understanding.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 17 Nov 2005 16:26 GMT
> This is stuff I did not learn until after I had my BSc back when I was
> studying it, so the books you may find won't necessarily be that
> accessible. Mathematicians tend to go for brevity, and elegance, as if
> they were constructing puzzles.  They are not big on handing you any
> sort of intuitive understanding.

   I learned this stuff by reading Roger Penrose's "The Emperor's New
Mind". It's a long, thick book, but all the math stuff lies in the first
1/3rd of it. The rest of the book is equally fascinating as well, of course.

http://www.amazon.com/gp/product/0140145346/103-2566881-0495862?v=glance&n=28315
5&v=glance


   - Oliver
Jeffrey Schwab - 17 Nov 2005 17:16 GMT
> On Wed, 16 Nov 2005 22:44:27 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 9 lines]
> mapping, advanced probability theory, Lebesgue measure theory, the
> different kinds of infinity, Georg Kantor,

ITYM Cantor.

>  transfinite numbers.

I'm familiar with all of those things except Lebesgue and "measure theory."

> rationals are like thin strips of celery fibre in a thick soup of
> irrationals. Even though you can always find an irrational between two
> rationals and a rational between two irrationals, in a very strong
> sense, irrationals are vastly more numerous, and most definitely can't
> be enumerated by a set of strings.

Right on.  "Celery fibre" is an interesting analogy. :)

> How do you quantify that? You do it by integrating over all the
> rationals or over all the irrationals.  The set of rationals is called
> a set of measure 0, because when you do that, their contribution comes
> out 0.  Just how you do those integrals is called Lebesgue measure
> theory.

Not sure I follow, but I'll investigate.  The proof I've seen before is
this one:

http://en.wikipedia.org/wiki/Cantor's_diagonal_argument

> The way you usually tackle the domain of knowledge is with first
> calculation of finite probablities and combinatorics, then
> probability, then the various types of infinity, then probability
> theory over these various infinite sets.

Probability theory as I studied it in school was approached a very
different way.  We never saw irrational outcomes.  It seems strange now,
but this never struck me as odd.  Anyway, probability is usually based
on the randomness of some physical process, which means some random
point is being chosen from a continuum of space or time; but whether the
infinity of the continuum is the same as the infinity of irrationals is
provably unprovable.  Btw, have you read this?

http://www.amazon.com/gp/product/019514743X/104-2580866-1835953?v=glance&n=28315
5&v=glance


It's very good.

> You then wander around in Markovian processes (the things that turned
> me on most since they are so much like finite state automata.) and the
> astounding 0-1 law.

I don't know about that either, although I gather this is the same
Markov of "Markov chain" fame.  Looks like I've got some reading to do!

> This is stuff I did not learn until after I had my BSc back when I was
> studying it, so the books you may find won't necessarily be that
> accessible. Mathematicians tend to go for brevity, and elegance, as if
> they were constructing puzzles.  They are not big on handing you any
> sort of intuitive understanding.

Some great books about Mathematics were not written by mathematicians.
My personal favorite was written by a dentist:

http://www.wwnorton.com/catalog/fall96/math.htm

I've had it for three or four years now, and I'm still not half-way
through it.
Roedy Green - 17 Nov 2005 22:02 GMT
On Thu, 17 Nov 2005 17:16:57 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>Georg Kantor,
>
>ITYM Cantor.

I think he spelled it Kantor, but it is often transliterated into
Cantor, singer in a synagogue, in English.

Sort of like how Joe Green wrote Italian operas.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 17 Nov 2005 22:05 GMT
On Thu, 17 Nov 2005 17:16:57 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>Probability theory as I studied it in school was approached a very
>different way.  

Advanced probability theory you would hardly recognise as related to
the probability of card games. It is all about integrating infinities.
I have no idea what practical use it might ever have.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 17 Nov 2005 22:11 GMT
On Thu, 17 Nov 2005 17:16:57 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>I don't know about that either, although I gather this is the same
>Markov of "Markov chain" fame.  Looks like I've got some reading to do!

Markov processes are ones that have  state but no memory of history.
The are like generalisations of finite state automata.  There is a
probability function that maps the previous state onto the  next.

One of the strange results is that under some not that stringent
conditions, if the probability of a state occurring is non-zero, no
matter how vanishingly small that probability, if you wait long enough
it will happen infinitely often.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

IchBin - 17 Nov 2005 02:15 GMT
>> On Wed, 16 Nov 2005 16:56:02 GMT, Jeffrey Schwab
>> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
>> said :

 [snip]

> I'm not familiar with Lebesgue, or "measure theory."  If you have any
> good links on them, I'd be interested in learning.

http://en.wikipedia.org/wiki/Measure_theory

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Jeffrey Schwab - 16 Nov 2005 07:20 GMT
> On Mon, 14 Nov 2005 21:10:08 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 7 lines]
> I think you are confusing rational repeaters (which can be accurately
> represented by a rational fraction) with irrationals

I think I am not.

> that at best
> could be described as a limit of a series, e.g. pi, e.  
>
> Remember the proof that there are non-rational numbers, discovered,
> IIRC by the ancient Greeks.

Proven geometrically, in fact, by trying to determine the length of the
hypoteneuse of a right triangle.  This sort of irrational number can be
represented in finite space by a continued fraction.

    http://www.reference.com/browse/wiki/Continued_fraction

>  There is no way you can map all
> rationals, much less all irrationals with perfect accuracy into a
> finite address space. There an infinite but countably many rationals
> and uncountably many irrationals.

As proven by Georg Cantor, by a method I still find mind-blowingly
simple and graceful.

> (One of my pet peeves is
> newscasters who use the term "uncountable" to mean "a large number" or
> "more than I can count on my fingers".)

I hear ya. :)  It may be of comfort to know that "uncountable" has a
non-mathematical meaning in the English language:

    http://dictionary.reference.com/search?q=uncountable

> "Countable" to mathematicians means there exists a 1-1 mapping between
> the set and the set of integers.

You have a deep understanding!  However, you don't need to instantiate
all possible instances of a class in order to represent a subset of
those instances, and similarly, you don't need to represent all
irrational numbers in order to represent a (finite) subset of interest,
as the OP requested.
Roedy Green - 16 Nov 2005 10:11 GMT
On Wed, 16 Nov 2005 07:20:48 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :

>You have a deep understanding!  However, you don't need to instantiate
>all possible instances of a class in order to represent a subset of
>those instances, and similarly, you don't need to represent all
>irrational numbers in order to represent a (finite) subset of interest,
>as the OP requested.

Your orgininal claim was much more extravagant:

>That's only true if one assumes a traditional floating-point
>representation.  There are plenty of techniques (continued fractions,
>symbolic algebra, etc.) for representing irrational numbers with
>infinite precision in finite memory.

Perhaps the problem is I interpreted your statement to mean
"representing all irrational numbers with infinite precision in finite
memory" where you meant "a few irrational numbers such as e, pi, pi,
sin(a/b), sqrt(2) that commonly occur in calculus"
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 16 Nov 2005 10:29 GMT
> On Wed, 16 Nov 2005 07:20:48 GMT, Jeffrey Schwab
> <jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 17 lines]
> memory" where you meant "a few irrational numbers such as e, pi, pi,
> sin(a/b), sqrt(2) that commonly occur in calculus"

Yes, by "irrational numbers," I meant "those irrational numbers you
derive."  I did not mean that a computer program could enumerate all
real numbers.  Sorry for being unclear!
charles_n_may@yahoo.com - 14 Nov 2005 20:12 GMT
You need a MacLaurin series expansion (from calculus) around a known
reference point; then you can get arbitrary precision. I have a hard
time imagining any practical application that would need more than the
precision allowed by a double, though. I've mainly found BigDecimals
valuable in currency calculations.

Try this reference:
http://www.tc.umn.edu/~ringx004/sidebar.html

> Does anyone know an easy way, or know of freely any available code /
> packages, to use sine and cosine on BigDecimal with full precision?
>
> /Magnus


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.