DIETER ENSSLEN wrote:
> I am sad to hear about the 'limited standard precision',
> no simple options of double etc precision
Under the covers, J supports three types of precision:
1. Machine integers, which go from -2^31 to
<:2^31 on 32-bit systems and -2^63
to <:2^63 on 64-bit systems.
2. IEEE 754 double precision floating
point numbers, which have 53 bits of
mantissa and can represent up to
~10^308 .
http://en.wikipedia.org/wiki/Double_precision_floating-point_format
There're a lot of subtleties which
you must learn and know about if you
want to use them for high-precision
applications. John Randall is our
resident expert on this topic, and
recommends reading Kahan:
http://www.cs.berkeley.edu/~wkahan/
His other posts on the topic are also
entertaining & educational; you can find
them at this link:
http://www.jsoftware.com/forumsearch
if you put "randall" in the "author" box
and "precision" or "IEEE" or "floating point"
etc in the "all the words" box, and hit
"search".
You might also find this Wiki Essay
illuminating:
http://www.jsoftware.com/jwiki/Essays/Extremal%20Arguments
3. Arbitrary precision integers. These
are stored as arrays of decimal digits.
That is, every J numeric type: boolean, integer, float, complex, extended
integer, rational, and the sparse versions of these, all represent their values
under the covers using one of these formats. For example, booleans are just
integers with the values 0 and 1, complex numbers are just pairs of doubles,
and rational numbers are just pairs of extended precisions ints.
One nice thing about J is you don't get integer overflow. J will automatically
promote integers to floats when required, as in 2^100 . But what it won't do
is automatically promote to arbitrary precision. It leaves that up to:
> my discretion and cost of computing time
And that's the point of arbitrary precision values. At your discretion,
knowing it comes at the cost of computing time and memory, if you add a
trailing x to an integer (as in 100x) or express a floating point number as a
rational fraction with the numerator and denominator separated by an r (as in
23r7), or apply the verb x: to integer or floating point values (as in x:100
or x:23%7), then J will use extended precision numbers under the covers, and
maintain that representation as long as it can.
Now, it's not always possible to maintain the representation, as in
2 ^. 23r7
1.18958
a=: 11^309x
a <....@^. _1+a^100 NB. Should be 99x
|nonce error
| a <....@^._1+a^100
But J does provide some utilities (such as <....@^ ) to help you in this
regard. You'll want to read:
http://www.jsoftware.com/help/dictionary/dictg.htm
You might also be interested in the LAPACK addon. In the IJX window, select
Run>Package Manager, say "Yes" to update your catalog, check the box next to
"math/lapack", click "Do install".
Then, in the IJX window, select Studio>Labs, select "Math" from the dropdown,
and select LAPACK. In fact, I think you'd find value in going through several
labs. I suggest Language/A J introduction and Language/A Taste of J (1) and (2).
See also:
http://www.jsoftware.com/jwiki/Studio/LAPACK
http://www.jsoftware.com/jwiki/Addons/math/lapack
which I found by typing "LAPACK" into the search box at the top-right of every
Wiki page and hitting "text" (not "title", which is too restrictive).
> I just have two trivial questions at the present:
> 1 what is the max n for pi: <[email protected]^n, and
> 2 is there a somewhat similar extended precision
> expression for e
For (1), you are limited by your hardware; if you want an exact number, I
recommend you do some experiments and find out. For (2), see
http://www.jsoftware.com/jwiki/Essays/Extended%20Precision%20Functions
Notice this is the second Wiki Essay I've cited, relevant to your interests. So
you might have a lot of fun exploring:
http://www.jsoftware.com/jwiki/Essays
> I am reminded how simple things were
> in the early 1980s
Of course, things are always better in the good old days. Just remember
they're all good old days.
> Which also reminded me that in 1969 'we' put two men on the moon
You give me a cold war, I'll give you a space program. If you think it's worth
the trade.
> looking for a number crunching program that would work nicely, easily,
> fast, and at increased precision, in particular for slowly converging
> math functions
You'll probably be happier in the end if you use your math skills to find
efficient reformulations of these series, where possible, e.g. as in the first
para of this recent message:
http://www.jsoftware.com/pipermail/programming/2010-February/018552.html
or in an old thread about "the limit of the sum of the digits":
http://www.jsoftware.com/pipermail/general/2004-December/019713.html
or several others. To find them, you can use the Forum-archive-searching tool
I pointed out above.
Having mathematically reformulated your slowly-converging series, you could use
J to explore it.
> I thought my questions to the chat community
> were simple and straightforward so far.
Now that you've got all the extraneous issues settled, I'm glad we won't have
to discuss any more topics "around" J, but not "on" J such as:
* Installation
* Handheld devices
* The J programming environment
* Other systems which bear some passing resemblance to J (calculators,
CASes, plotting packages)
* How you think J compares to these other systems (e.g. APL or Apple
or Wolfram Alpha)
> I am at an inner peace with J and it seems as if i
> might not have any questions for you guys now for
> years or forever.
> Or is that a standard right out of the book passing
> phase every J er goes through?
I would be very surprised if we did not hear from you again. And I look
forward to your questions about J proper; I expect your next few emails to even
include some J expressions to talk about!
-Dan
PS: Actually, on the topic of your next few emails, it would facilitate
communication if you adopted some
admittedly-arbitrary-but-nonetheless-standard email conventions. In
particular, I am thinking of:
1. The subject line and body of the email serve separate purposes, and
should be separated.
a. Keep the subject short and descriptive
b. Start the body of your email at the beginning, do not
treat it as an extension of the subject.
2. In responding to an email from someone else, context is
important.
a. If you're responding to a some specific text, quote
that text and attribute it to its author. Your email
client probably facilitates this convention by default;
don't just delete the text it presents you when you hit
reply; excerpt it. That's why it's there.
b. Try to respond with an appropriate amount of detail;
This is especially true if you're asking for help.
If someone requests more details, try your best
to provide them. Don't just fall back on generalities.
For the most part, if you follow the examples of other posters, you'll do fine.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm