Re: [Jprogramming] polynomial division

2022-02-21 Thread Raul Miller
On Mon, Feb 21, 2022 at 2:23 PM R.E. Boss wrote: >round=: [ * [: <. 0.5 + %~ Looking closer at this, this was a bit different from my initial attempt. Also, a version which rounds to the nearest integer is good up through cyclotomic 70. 71 is a prime number, so we should expect (71#1) as th

Re: [Jprogramming] polynomial division

2022-02-21 Thread R.E. Boss
round=: [ * [: <. 0.5 + %~ R.E. Boss -Original Message- From: Programming On Behalf Of Raul Miller Sent: maandag 21 februari 2022 17:42 To: Programming forum Subject: Re: [Jprogramming] polynomial division Ok, ... I'm tempted to put that into the rosettacode entry. What definiti

Re: [Jprogramming] something strange...

2022-02-21 Thread Henry Rich
I should have added, the workaround is to use +/"]@:= Henry Rich On 2/21/2022 7:57 AM, Igor Zhuravlov wrote: (+/@:= S: 0 <"0@i.@#) '' ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 4 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 3 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; 1 1 1 (+/@:= S: 0 <"0@i.

Re: [Jprogramming] polynomial division

2022-02-21 Thread Raul Miller
Ok, ... I'm tempted to put that into the rosettacode entry. What definition are you using for 'round'? When I try round=: [: <. 0.5 + ] it works up through cyclotomicREB 69 but when I use round=: [ * [: <. 0.5 + %~ it only works up through cyclotomicREB 65. Thanks, -- Raul On Mon, Feb

Re: [Jprogramming] something strange...

2022-02-21 Thread Henry Rich
Fixed for next beta.  The comparison compounds +/@:comparison did not correctly detect an empty left argument. Henry Rich On 2/21/2022 7:57 AM, Igor Zhuravlov wrote: (+/@:= S: 0 <"0@i.@#) '' ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 4 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 3 1 (+/

Re: [Jprogramming] polynomial division

2022-02-21 Thread R.E. Boss
There was a mistake in taskfmt, but cyclotomic 6 was correct. cyclotomicREB=:{{{."1 [0.01 round +. p. 1;^j.+:pi* y%~ >:I.1=y +. >:i.y}} taskfmt=:{{rplc&'_-' rplc&('^1)';')';'x^0';'1') ' '-.~}:,|.')+',~"1'(',"1('1'-.~"1 ":,.0-.~y),"1 'x^',"1":,.I.|y}} (cyclotomic"0 -: cyclotomicREB"0) >:i.30 1

Re: [Jprogramming] polynomial division

2022-02-21 Thread Raul Miller
That was the first thing I tried. cyclotomic 6 should return 1 _1 1 Thanks, -- Raul On Mon, Feb 21, 2022 at 8:55 AM R.E. Boss wrote: > > From the hip. > > cyclotomic=:{{{."1 [0.01 round +. p. 1;^j.+:pi* y%~ >:I.1=y +. >:i.y}} > taskfmt=:{{rplc&'_-' rplc&('^1';'';'x^0';'1') ' > '-.~}:,|.')+',

Re: [Jprogramming] something strange...

2022-02-21 Thread Henry Rich
I can reproduce the problem on the last 4 lines.  The others seem OK.  I'll look into it. Henry Rich On 2/21/2022 7:57 AM, Igor Zhuravlov wrote: (+/@:= S: 0 <"0@i.@#) '' ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 4 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 3 1 (+/@:= S: 0 <"0@i.@#) (0

Re: [Jprogramming] polynomial division

2022-02-21 Thread R.E. Boss
From the hip. cyclotomic=:{{{."1 [0.01 round +. p. 1;^j.+:pi* y%~ >:I.1=y +. >:i.y}} taskfmt=:{{rplc&'_-' rplc&('^1';'';'x^0';'1') ' '-.~}:,|.')+',~"1'(',"1('1'-.~"1 ":,.0-.~y),"1 'x^',"1":,.I.|y}} ([: taskfmt cyclotomic)"0 >:i.30 (x)+(-1)

Re: [Jprogramming] something strange...

2022-02-21 Thread 'Jon Hough' via Programming
I am on an older version (+/@:= S: 0 <"0@i.@#) '' ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; , 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; 01 0 1 (+/@:= S: 0 <"0@i.@#) (0

[Jprogramming] something strange...

2022-02-21 Thread Igor Zhuravlov
(+/@:= S: 0 <"0@i.@#) '' ; 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 4 1 (+/@:= S: 0 <"0@i.@#) (0 $ 0) ; 1 3 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; 1 1 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; , 1 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; 01 0 1 (+/@:= S: 0 <"0@i.@#) (0 $ 00) ; , 01 1 1

Re: [Jprogramming] polynomial division

2022-02-21 Thread 'Michael Day' via Programming
Apologies for a mistake in my previous post, below. This was where I said "This trick for my [function] div is analogous to allowing for leading decimal zeros in 1234 % 0.0001 in "ordinary" long division." I'd forgotten that J's representation of polynomials is not the same as its repr