I wrote a definition with only one argument. Linda
Get Outlook for Android<https://aka.ms/ghei36> ________________________________ From: Programming <[email protected]> on behalf of Raul Miller <[email protected]> Sent: Wednesday, June 13, 2018 4:36:31 PM To: Programming forum Subject: Re: [Jprogramming] Finding Irrational Numbers So, something like this? fe=:4 :0 p=. 9!:10'' vi=. _. ve=. y try. 9!:11 x ve=. ":&.>y 9!:11]15 vi=. ":&.>y catch. end. 9!:11 p ve=vi ) Thanks, -- Raul On Wed, Jun 13, 2018 at 4:22 PM Skip Cave <[email protected]> wrote: > > So I'm thinking something like this, to find exact numbers in a floating > point array: > > > pps 15 NB. Set the print precision. > > > Create a mixed floating point vector b: > > > ]b=:(,3? 10^1+i.4),%a=:1+i.20 > > 0 2 7 36 93 57 808 875 559 4674 8635 6196 1 0.5 0.333333333333333 0.25 0.2 > 0.166666666666667 0.142857142857143 0.125 0.111111111111111 0.1 > 0.0909090909090909 0.0833333333333333 0.0769230769230769 0.0714285714285714 > 0.0666666666666667 0.0625 0.0588235294117... > > > Create a "find exact" verb 'fe' where x=the number of digits max that can > be exact, and y is the vector to be tested (boolean result): > > > fe=. 4 : 'x> ># each ": each <"1,.y' > > > ]c=.9 fe b > > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 > > > Show exact: > > c#b > > 0 2 7 36 93 57 808 875 559 4674 8635 6196 1 0.5 0.25 0.2 0.125 0.1 0.0625 > 0.05 > > > Show inexact: > > (-.c)#b > > 0.333333333333333 0.166666666666667 0.142857142857143 0.111111111111111 > 0.0909090909090909 0.0833333333333333 0.0769230769230769 0.0714285714285714 > 0.0666666666666667 0.0588235294117647 0.0555555555555556 0.0526315789473684 > > #b > > 32 > > #c#b > > 20 > > > I'm sure this scheme has some holes, but it is a reasonable first cut. > > > Skip > ---------------------------------------------------------------------- > For information about J forums see > https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C41ac47c72e1441cc1f0b08d5d16d6b12%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636645190246397362&sdata=C%2B8YZ2EAW533k4brRJj7gZXQzxUXVbnCthCXYM1YZ1I%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C41ac47c72e1441cc1f0b08d5d16d6b12%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636645190246397362&sdata=C%2B8YZ2EAW533k4brRJj7gZXQzxUXVbnCthCXYM1YZ1I%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
