On 10/22/06, Mike Day <[EMAIL PROTECTED]> wrote:

Getting OT...

Mea culpa (bis)!

NB.
   datatype 1r2
rational


Certes.

int op int == rat for lower(op)==(max,min,plus,minus,mult,div);
could be for upper(op)==(exp,log,etc.)

   by carrying the op the same way rat does for mult/div ...
   you would need a more complex polyad structure than just (a/b):

    ((a/b)^(c/d)) == (a,b,c,d) ... or ((a,b), (c,d))


rat op rat == rat for all op in that case.

(Sounds like a Congressional disgustion on Paging...)

Mike

Roy A. Crabtree wrote:
> On 10/22/06, Mike Day <[EMAIL PROTECTED]> wrote:
>>
>> (T)ouch(e) !
>>
>> Me culpa. I hadn't realised - or checked - that
>
>
> "Mea" (tua) culpa.  Certes?
>
>   integer quotient % integer divisor
>> is always floating.
>
>
> Sounds like an Enron argument.  Two rationals make a float.
>
> But why?
>
>
> Qua non?
>
> For example, Dyalog APL retains an integer type for
>> similar arguments:
>>       #DR 17    @ short integer
>> 83
>>       #DR 548590 556138 1375147 @ long int
>> 323
>>       #DR 548590 556138 1375147 % 17
>> 323
>>
>> mike
>>
>> Oleg Kobchenko wrote:
>> > Well, that's not exactly an improvement
>> >
>> >    ts'x <[EMAIL PROTECTED] 17'
>> > 0.19952 2.09723e7
>> >    ts'x (([ - |~) % ]) 17'
>> > 0.0545567 1.25841e7
>> >
>> >    ts'x % 17'
>> > 0.0182892 8.38925e6
>> >    ts'_4 (33 b.) x'
>> > 0.00982667 4.1952e6
>> >
>> >    datatype x (([ - |~) % ]) 17
>> > floating
>> >
>> > Maybe a method that represents interger
>> > division in terms of binary shifts.
>
>
> If J does not do it, you can; but would it be more efficient?
>
> Similar optimizations are inherently possible for direct rational
> arithmetic,
> and I suspect that if J does not use them, then usually to nearly always
> it will be much less efficient to attempt to use them;
>
> these folks tend to hit it on the nose ...:
>
>    (ArB) op (CrD) == (op / reorder( A,B,C,D))
>
> (postpone  the operations and utilize binary equality testing or
> factoring
> to unify
> and reduce later operations).
>
> Which blows up in time and space really fast.
>
>>
>> >
>> > Mike Day mike_liz.day at tiscali.co.uk wrote Sat Oct 21 16:18:53 HKT
>> 2006
>> >
>> > FWIW, pending J6.02, this offers some improvement in
>> > time and space:
>> >    NB. in J 6.0.1
>> >    NB. reduce x to an integer multiple of y before divide
>> >    NB. does it work for -ve & +ve x
>> >    (x-300000) (<[EMAIL PROTECTED] -: ([ - |~) % ]) 17
>> > 1
>> >    ts'x  <[EMAIL PROTECTED] 17'
>> > 0.210536 2.09723e7
>> >    ts'x (([ - |~) % ]) 17'
>> > 0.0587469 1.25841e7
>> >
>> > I expect there's a better way still, and still in 6.01 !
>
>
> Restate the  operations as tuple form to keep the arithmetic rational
> at all
> times;
> this avoids division internally entirely, until/unless you ant to float:
>
>      ((a idiv b) idiv (c idiv d)) == (a imult d) idiv (b imult c)
>
> representable as:
>
>     ((a,b) / (c,d)) == ((a*d),(b*c))
>
> which is what I thought rational arithmetic was all about anyway;
>
>      so I am confused.
>
> SImilarly for all  other functors that have similar identities.
>
>>
>> > Mike
>> >
>> > Roger Hui wrote:
>> >
>> >> Preliminary benchmarks:
>> >>
>> >> ts=: 6!:2 , 7!:[EMAIL PROTECTED]
>> >> x=: 1e6 [EMAIL PROTECTED] 2e6
>> >> ts 'Expression'
>> >>
>> >> Expression          J6.02x              J6.01            Factor
>> >> x <[EMAIL PROTECTED] 512   0.0054822 4.19507e6  0.136416 2.09723e7   
23.80 5.00
>> >> x <[EMAIL PROTECTED] 17    0.0213073 4.19507e6  0.154837 2.09723e7    
7.27 5.00
>> >>
>> >
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Tired of spam?  Yahoo! Mail has the best spam protection around
>> > http://mail.yahoo.com
>> >
----------------------------------------------------------------------
>> > 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




--
--
Roy A. Crabtree
UNC '76 gaa.lifer#11086

Room 209/207 Studio Plus
123 East McCullough Drive
Charlotte,7/209NC 28262-3306
336-340-1304 (office/home/cell/vmail)
704-510-0108x7489/7404 (voicemail residence)
[When you hear/read/see/feel what a yehudi plays/writes/sculpts/holds]
[(n)either violinist {Menuhin} (n)or writer {"The Yehudi Principle"} (n)or
molder (n)or older]
[you must strive/think/look/sense all of it, or you will miss the meanings
of it all]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.authorsden.com/royacrabtree
http://skyscraper.fortunecity.com/activex/720/resume/full.doc
--
(c) RAC/IP, ARE,PRO,PAST
(Copyright) Roy Andrew Crabtree/In Perpetuity
   All Rights/Reserved Explicitly
   Public Reuse Only
   Profits Always Safe Traded
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to