# Re: [Jprogramming] Finding Irrational Numbers

```Roger,
You're right. The array i generated was all rational numbers. I'll try
again:```
```
]a=.(20?20){(100*%1+i.10),(10?20)*o.1

6.28319 10 11.1111 16.6667 25.1327 100 0 21.9911 33.3333 56.5487 12.5
31.4159 53.4071 14.2857 25 43.9823 50 12.5664 59.6903 20

Is that a better combination of rational and irrational numbers?

I think I was originally thinking that floating-point numbers that have
infinitely repeating patterns after the decimal are irrational. but that is
not the correct definition of irrational. However, a verb that could find
those kinds of numbers (infinitely repeating pattern) in a vector of
floating point numbers could be useful.

Skip

On Wed, Jun 13, 2018 at 12:44 PM Roger Hui <rogerhui.can...@gmail.com>
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 <s...@caveconsulting.com>
> 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```