Here's what I have so far, but I can't seem to make a nice looking table of
mixed numbers.

load 'viewmat'


GRB=:1 0 2{"1 (#:i.8){0 255


T=:(i.11)*/i.11
]TT=:(i.11) * table i.11 
D=:(i.101)%/>:i.9x  
]DD=:(i.101) % table >:i.9x
]W=:<.D
]R=:D-W
(1|D) -: R   NB. Thanks Roger

GRB viewmat T
GRB viewmat D
GRB viewmat W
GRB viewmat R
 
]CW=:<"1 ":"0 W
 
$CW

]CR=:<"1 ":"0 R

$CR

CW,"2 CR
$CW,."1 CR
CW,."1 CR

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Thursday, November 13, 2014 4:53 PM
To: Beta forum
Subject: Re: [Jbeta] Odd Pattern of Rationals

If you want arithmetic to work perfectly, stick with rational numbers and
extended precision integers.

The integer part of a ration number is <.x .  The fractional part is 1|x.
Thus:

   (<. , 1&|) 14r3
4 2r3




On Thu, Nov 13, 2014 at 1:47 PM, Linda Alvord <[email protected]>
wrote:

> In Grade 3 in USA students learn multiplication of numbers from 0 to 
> 100, (I'm not sure what happenes to division by zero).  However they 
> only deal with fractions of single digit denominators.  So having 
> experiented a little with rationals, see my question at the end.
>
>     N=:11 33333330575r99999991726
>    $N
> 2
>     6 2$N
> 11 33333330575r99999991726
> 11 33333330575r99999991726
> 11 33333330575r99999991726
> 11 33333330575r99999991726
> 11 33333330575r99999991726
> 11 33333330575r99999991726
>
>   +/  6 2$N
> 66 99999991725r49999995863
>
>   +/ +/  6 2$N
> 3399999718683r49999995863
>
>    3399999718683%49999995863
> 68
>
>   +/ 6#2r3
> 4
>    +/ 7#2r3
> 14r3
>
> In third grade the anser should be  4 2r3 or something like it.  How 
> are rational fractions generally handled?
>
> Linda
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Roger Hui
> Sent: Thursday, November 13, 2014 10:58 AM
> To: Beta forum
> Subject: Re: [Jbeta] Odd Pattern of Rationals
>
> And, most importantly,
>
>    x: 1%3
> 1r3
>
> x: is subject to tolerance.  The implementation can possibly be 
> improved by using the ideas in
>
> https://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approxi
> mation
> s
>
>
>
> On Thu, Nov 13, 2014 at 7:35 AM, Mike Day <[email protected]>
> wrote:
>
> > FYI
> > NB. enumerate x:0.333... for between 1 and 20 decimal places
> >     (>:i.20),.x:+/"1 (10^>:i.20)%~"1(3#~])"0>:i.q =. 20
> >
> > 1 3r10
> >
> > 2 33r100
> >
> > 3 333r1000
> >
> > 4 3333r10000
> >
> > 5 33333r100000
> >
> > 6 333333r1000000
> >
> > 7 3333333r10000000
> >
> > 8 1r3
> >
> > 9 166666671r500000014
> >
> > 10 3333333057r9999999173
> >
> > 11 33333330575r99999991726
> >
> > 12 1r3
> >
> > 13 1r3
> >
> > 14 1r3
> >
> > 15 1r3
> >
> > 16 1r3
> >
> > 17 1r3
> >
> > 18 1r3
> >
> > 19 1r3
> >
> > 20 1r3
> >
> >
> > in Windows 8 - same in J32 & J64
> >
> >
> > Mike
> >
> >
> > On 13/11/2014 14:56, Ben Gorte - CITG wrote:
> >
> >> I guess that's why Linda asked: Should 0.33333333 really be 1r3  ?
> >> Raul showed that it is.
> >>
> >> (I also don't get it)
> >> ________________________________________
> >> From: [email protected] [beta-bounces@forums.
> >> jsoftware.com] on behalf of Dan Bron [[email protected]]
> >> Sent: Thursday, November 13, 2014 15:39
> >> To: [email protected]
> >> Subject: Re: [Jbeta] Odd Pattern of Rationals
> >>
> >> Linda, exact numbers have to be exact from the get-go.  If a number 
> >> starts out inexact, it will stay inexact forever, even if you later
> apply
> x:
> >> (though then it will be quite exactly inexact :).
> >>
> >> Thus, to get 1r3 you must say 1r3.  If you say 0.333 you'll get 0.333 .
> >> That's not 1r3 and never will be.
> >>
> >> -Dan
> >>
> >> ----- Original Message ---------------
> >>
> >> Subject: [Jbeta] Odd Pattern of Rationals
> >>     From: "Linda Alvord" <[email protected]>
> >>     Date: Wed, 12 Nov 2014 23:10:14 -0500
> >>       To: <[email protected]>
> >>
> >> Should 0.33333333 really be 1r3  ?
> >>
> >>
> >>
> >> x: 0.333333
> >>
> >> 333333r1000000
> >>
> >> x: 0.3333333
> >>
> >> 3333333r10000000
> >>
> >> x: 0.33333333
> >>
> >> 1r3
> >>
> >> x: 0.333333333
> >>
> >> 166666671r500000014
> >>
> >> x: 0.3333333333
> >>
> >> 3333333057r9999999173
> >>
> >>
> >>
> >> Linda
> >>
> >>
> >
> > ---
> > This email is free from viruses and malware because avast! Antivirus 
> > protection is active.
> > http://www.avast.com
> >
> >
> >
> > -----
> > No virus found in this message.
> > Checked by AVG - www.avg.com
> > Version: 2014.0.4765 / Virus Database: 4189/8565 - Release Date:
> > 11/13/14
> >
> > --------------------------------------------------------------------
> > -- 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to