Skip said: Given the vector a: ]a =. % 1+i.20
1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 0.1 0.0909091 0.0833333 0.0769231 0.0714286 0.0666667 0.0625 0.0588235 0.0555556 0.0526316 0.05 Roger said: Your list a are reciprocals of integers and so are all rational. Roger also said: All rational fractions result in infinitely repeating floating point numbers. They are the same sets. Skip says: So all the numbers in a are rational, and infinitely repeating? Like 0.5, 0.25. 0.2, 0.1? I'm confused. These examples don't seem to have infinitely repeating decimals. ​Skip On Wed, Jun 13, 2018 at 12:44 PM Roger Hui <[email protected]> wrote: > What's an irrational number in this context? Your list a are reciprocals > of integers and so are all rational. On the other hand, going just by the > display, 0.5 is a rational number (1%2), but since the display is to 6 > significant digits, for all you know 0.5 could be > 0.500000314159265358979... (0.5+ pi*1e_7) and irrational. > > > On Wed, Jun 13, 2018 at 10:29 AM, Skip Cave <[email protected]> > wrote: > > > Here's another problem similar to my previous one about finding integers > in > > a floating point array: > > > > Find the irrational numbers in a floating-point array: > > > > Given the vector a: > > > > ]a =. % 1+i.20 > > > > 1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 0.1 0.0909091 > > 0.0833333 0.0769231 0.0714286 0.0666667 0.0625 0.0588235 0.0555556 > > 0.0526316 0.05 > > > > > > Create a function that will generate a boolean array indicating the > > locations of the irrational numbers in a. > > > > > > Skip > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
