Richard Donovan asked:
> Is it possible to construct a J verb to test a number to be 
> irrational?

Not numerically.  All values representable in a computer are rational, even 
those values which are the computer's closest
(rational) approximations to irrational numbers.  

Put another way, if you had a magical verb  irrat  and you fed it the value  
1p1     , how would it know you wanted the result  1
or  0  ?  Both answers are reasonable.  

One is reasonable because pi is irrational, and 1p1 is the closest 
approximation to pi you could provide.  Zero is reasonable
because 1p1 is actually stored as  3.14159265358979323846  , which is clearly a 
rational number.  How would  irrat  know your
intention?    (Did you want to know whether "3.14159265358979323846" is 
irrational, or whether "pi" is irrational, given that the
two values are indistinguishable in double-precision floating point 
representation?)

Now, a symbolic test is a different story.  The symbol "pi" or a formula like   
4*-/%1+2*i._  are distinguishable from values like
1p1.  The question of whether it is possible to determine if a formula results 
in irrational number, I'll leave to the
mathematicians.  John Randall might know.

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to