Re: [Jprogramming] p. bug

2016-08-30 Thread 'Mike Day' via Programming
Also fails in 804 (Windows 10, jqt) and 805 (Windows 10, jqt beta-11) OK for _46 and _47 but not for _49, other things equal. The real value is returned easily (for _48) with Newton-Raphson. Mike On 30/08/2016 14:21, Andrew Nikitin wrote: p. _48 1 0 0 0 1 crashes j. Tried with 803 and earl

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-02 Thread 'Mike Day' via Programming
I came up with this. f =: (;@:{~ (i. >./)@:(#&>))@:(<@~.@:(>./\)\.) NB. The main ingredient is ~.@:(>./\) ~.@:(>./\) l 7 8 13 15 19 ~.@:(>./\) }.l 4 5 7 8 13 15 19 f l 4 5 7 8 13 15 19 NB. If there are more than one different subseqs NB. of equal length, it returns the first. NB. It f

Re: [Jprogramming] Count and say

2016-09-02 Thread &#x27;Mike Day&#x27; via Programming
Checking my attempt with the function in the essay cited, I see that there's a misprint there. The value of i should be '1113213211', not '1113122113', assuming i is meant to be ,@((# , {.);.1~ (~: |.!.0))^:7 "."0 ,'1' NB. numeric result... 1 1 1 3 2 1 3 2 1 1 It's always good to l

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-02 Thread &#x27;Mike Day&#x27; via Programming
Same problem with my version, which was faster but equally wrong! Mike On 02/09/2016 14:57, Raul Miller wrote: Actually, if we try your approach on -8 2 4 3 1 6 we get _8 _2 _1 instead of _8 _4 _3 _1. Here's a brute force O(2^n) approach that I hacked up earlier - it obviously only works on

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-02 Thread &#x27;Mike Day&#x27; via Programming
Well, assuming for now that it does work, here's an attempt at a J version of the pseudo-code listed at https://en.wikipedia.org/wiki/Longest_increasing_subsequence#Efficient_algorithms lis =: 3 : 0 NB. longest increasing subsequence m =. 0#~>:n =. #x =. y L =. #p =. ''

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-03 Thread &#x27;Mike Day&#x27; via Programming
that I. works mx =. ({.x) 1 } (<:<./x), n#>:>./x for_i. i.n do. xi=. i{x lo=. mx I. xi p =. (m{~<:lo) i } p NB. better than appending to short p for larger x m =. i lo } m mx=. xi lo } mx end. |. x{~(p{~])^:(i.L) m{~ L =. <: m i. _1 ) Mik

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-05 Thread &#x27;Mike Day&#x27; via Programming
to avoid clashing. > > NB. dyads > exr=: (1 + {:@[ < ]) {. [ ; , > hxr=: [: ; exr&.> > > NB. monads > gxr=: (}.@] ;~ {.@] ; (hxr {.))&>/ > cxr=: ({::~ [: (i. >./) #@>)@>@{. > dxr=: (<_) ; ] > lisXR=: ([: cxr gxr^:(#@(>@{:)

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-07 Thread &#x27;Mike Day&#x27; via Programming
Sorry - I've only just seen this. As usual, I'd forgotten that particular idiom, namely u^:( I’m trying to rewrite lisM in a readable tacit form but hit something I didn’t understand. Supplying i.n to ^: works fine, but On Sep 5, 2016, at 3:17 AM, 'Mike Day' via Programm

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-08 Thread &#x27;Mike Day&#x27; via Programming
Thanks. No problems with line-wrapping in youe mail here! Naming your function lisEH, and mine lis, I find: l 7 4 4 5 2 7 1 8 13 2 10 4 9 1 4 5 5 4 3 10 3 4 5 8 15 7 11 19 ;lisEH l 1 2 4 4 4 4 5 7 11 19 lis l 1 2 3 4 5 7 11 19 So lisEH appears to miss the 3 Mike On 08/09/201

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-08 Thread &#x27;Mike Day&#x27; via Programming
test increasing subsequence". It is the "longest increasing subsquence" problem we are solving? /Erling On 2016-09-08 13:41, 'Mike Day' via Programming wrote: Thanks. No problems with line-wrapping in youe mail here! Naming your function lisEH, and mine lis, I find:

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-08 Thread &#x27;Mike Day&#x27; via Programming
> FirstGroupOfMaxLength 3 3 > > 2 LeftIsNotFirstInGroup (<1 2 3),<2 4 5 > > 2 LeftIsNotFirstInGroup (<1 2 3),<2 4 5 > > SelectFirstGroupOfMaxLength (<2),(<2 4 5),<2 6 7 > > LongestIncreasingSubsequence=: LongestIncreasingSubsequence f. > > LongestIncreasingSubse

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-09 Thread &#x27;Mike Day&#x27; via Programming
Thanks. I'm sure you know the following, but it might be worth pointing out: longascseq l 6 9 20 21 22 25 26 27 l{~longascseq l 1 2 3 4 5 7 11 19 lisM l 1 2 3 4 5 7 11 19 ie, longascseq returns the indices of the/a subsequence. Very limited testing suggests that it's a little bit sl

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-10 Thread &#x27;Mike Day&#x27; via Programming
s, so have avoided long names! Thanks, Mike On 10/09/2016 00:39, Henry Rich wrote: They're about the same speed on my machine. I don't think the if-then-else is material. They're essentially the same algorithm. (I'm testing on J8.05 beta, where the long names don'

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-13 Thread &#x27;Mike Day&#x27; via Programming
Thanks. It might help to point out that the main loop in Henry Rich's version, as shown in the wiki page, can be simplified slightly with negligible effect on run time, some savings in space, and doing without the "sorted value" array. I'm rather surprised - I'd introduced the array which I'd

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-13 Thread &#x27;Mike Day&#x27; via Programming
Actually, the hit on run time gets more significant as the length of the sequence and/or the optimal subsequence increase, so it's not negligible for, say, ?100#50, but fine for ?1#5000, and not too bad for ?10#5 Mike On 13/09/2016 19:22, 'Mike Day' via Pr

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-14 Thread &#x27;Mike Day&#x27; via Programming
longascseq2 { ]) 10?10' 0.468622 6.41946e6 ts'(longascseq1 { ]) ?10$10' 0.447244 3.28205e6 ts'(longascseq2 { ]) ?10$10' 0.458428 3.27373e6 ts'(longascseq1 { ]) 100?100' 4.55264 5.07078e7 ts'(longascseq2 { ]) 100?100&#x

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-14 Thread &#x27;Mike Day&#x27; via Programming
I suspect it's pretty near optimal. The wikipedia article points at Fredman's paper: http://www.sciencedirect.com/science/article/pii/0012365X7590103X analysing an algorithm of Knuth's. He shows that it performs better than n log2(n) - n log2 log2 (n) + O(n) rather than the O(n logn) cited

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-15 Thread &#x27;Mike Day&#x27; via Programming
/download/3btahsyzax4w7xp/Vol%2C3+SortingAndSearching-Donald+Knuth.pdf Youngs tableau is on page 47. /Erling On 2016-09-14 23:27, 'Mike Day' via Programming wrote: I suspect it's pretty near optimal. The wikipedia article points at Fredman's paper: http://www.scie

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-15 Thread &#x27;Mike Day&#x27; via Programming
09-15 11:52, Erling Hellenäs wrote: The Fredman paper is about calculation of the length L of the longest increasing subsequence, not the calculation of the longest increasing subsequence as such. The algorithm only computes "valueofminendvalue" I think. /Erling On 2016-09-14 23:2

Re: [Jprogramming] Greatest Increasing Subsequence

2016-09-15 Thread &#x27;Mike Day&#x27; via Programming
ending to an array requires a copy; so does tacit amending. Thus, any tacit version is going to have quadratic performance. But I am working on making (x , y) and (x m} y) operate in-place even in tacit forms. It will be a couple of months before that gets into a beta. Henry Rich

Re: [Jprogramming] Zig Zag problem

2016-09-27 Thread &#x27;Mike Day&#x27; via Programming
rmo's definition? Anyway, here's an approach which works on the indices. Please note that I haven't tested it thoroughly for boundary problems. I just consider the rising diagonals as extra columns. Top & bottom indices will be reduplicated, but can be removed with nub. eg for LHA = 5, we get

Re: [Jprogramming] Zig Zag problem

2016-09-27 Thread &#x27;Mike Day&#x27; via Programming
e colon on the first line of cv? Thanks, Jon ---- On Tue, 9/27/16, 'Mike Day' via Programming wrote: Subject: Re: [Jprogramming] Zig Zag problem To: programm...@jsoftware.com Date: Tuesday, September 27, 2016, 10:12 PM rmo's definiti

Re: [Jprogramming] Zig Zag problem

2016-09-27 Thread &#x27;Mike Day&#x27; via Programming
nd dyad sections I did not know that, thanks. Your solution is great. I'll have to spend a little time figuring out what's going on, but I can't find any flaws yet. And much more J-like than mine. Regards, Jon ---- On Tue, 9/27/16, 'M

Re: [Jprogramming] Zig Zag problem

2016-09-27 Thread &#x27;Mike Day&#x27; via Programming
You might enjoy this tacit version: start =: i.@(<. #) nstep =: (0 >. (-~ #)) >.@% <:@[ diffs =: (,:~ |.)@:+:@start tconvert =: (]{~(#@])([-.~~.@:<.) ,@|:@(+/\)@ (start, nstep $diffs)) M On 27/09/2016 15:27, 'Mike Day' via Programming wrote: Thanks. I

Re: [Jprogramming] Zig Zag problem

2016-09-28 Thread &#x27;Mike Day&#x27; via Programming
ls for the case of number of rows = 1: 1 tconvert 'SOMETEXT' ---------------- On Wed, 9/28/16, 'Mike Day' via Programming wrote: Subject: Re: [Jprogramming] Zig Zag problem To: programm...@jsoftware.com Date: Wednesday, September 28, 201

Re: [Jprogramming] Zig Zag problem

2016-09-28 Thread &#x27;Mike Day&#x27; via Programming
Whoosh! It even works ok with larg = 1! Good stuff, Mike On 28/09/2016 11:58, Erling Hellenäs wrote: ZigZagE=:([: /: ] (([: $ [) $ ]) [: (], [: |. [: }: }.) [: i. [) { ] -- For information about J forums see http://www.

Re: [Jprogramming] Zig Zag problem

2016-09-29 Thread &#x27;Mike Day&#x27; via Programming
It's easier to see if we stick to indices rather than an arbitrary string. Indices of elements in descending vertical columns in the zig-zag layout for m rows belong to (i.m) + 2 * (m-1) * i. n , where n is sufficient to exhaust the array, and indices of the RISING diagonals are, for m>1,

Re: [Jprogramming] Zig Zag problem

2016-09-30 Thread &#x27;Mike Day&#x27; via Programming
easy way to do this. You Mike solved it but the solution seemed a little complicated. /Erling On 2016-09-30 00:27, 'Mike Day' via Programming wrote: It's easier to see if we stick to indices rather than an arbitrary string. Indices of elements in descending vertical columns in t

Re: [Jprogramming] j805-beta-12 release candidates

2016-10-01 Thread &#x27;Mike Day&#x27; via Programming
What's the position with J for I-Pad? The literal "VERSION" has value "1.3 5" on mine. I don't use it very much as it's so tedious to transfer scripts to or from a conventional laptop or desktop, and writing scripts from scratch is difficult, but it's interesting from time to time to see how

Re: [Jprogramming] j805-beta-12 release candidates

2016-10-01 Thread &#x27;Mike Day&#x27; via Programming
Is it recommended to download the zip files and a) just pick out the new executables, j.dll and jconsole.exe (in windows at least) b) overwrite one's existing installation with all the zip contents or is it better to do a complete installation with the much larger j805_... executable? Tha

Re: [Jprogramming] j805-beta-12 release candidates

2016-10-01 Thread &#x27;Mike Day&#x27; via Programming
Sorry - should have made clear, the question applies when one already has a full J installation. Is it recommended to download the zip files and a) just pick out the new executables, j.dll and jconsole.exe (in windows at least) b) overwrite one's existing installation with all the zip conte

Re: [Jprogramming] Generating Lookup Tables (LUTs)

2016-10-13 Thread &#x27;Mike Day&#x27; via Programming
While I'm also not too clear what you're really trying to achieve, it might be worth offering this solution to your particular example knowing your required solution: x ((0~:(17 b.))&(#.@|:)) y 1 1 0 0 1 1 It uses the boolean and operation (17 b.) on bits at word level. 0~: could be 0< if yo

Re: [Jprogramming] Amending Sequential Rows

2016-11-07 Thread &#x27;Mike Day&#x27; via Programming
Well, this is pretty clunky, but it seems to work ok on your data. I noticed that p may be derived from an unboxed vector pp here, but that might not be relevant, and it's easier to process p than pp: pp =: 1 2 2 4 1 5 3 4 4 4 2 3 3 [p =: 2<\pp +---+---+---+---+---+---+---+---+---+---+--

Re: [Jprogramming] Amending Sequential Rows

2016-11-07 Thread &#x27;Mike Day&#x27; via Programming
4 4|4 4|4 2|2 3|6 | +---+---+---+---+---+---+---+---+---+---+---+---+ |1 2|2 2|2 4|4 1|1 5|5 3|3 4|4 4|4 4|4 2|2 3|3 3| +---+---+---+---+---+---+---+---+---+---+---+---+ I tried working on the predecessor to p, without much success. Mike On 07/11/2016 09:55, 'Mike Day' via Programming wr

Re: [Jprogramming] Amending Sequential Rows

2016-11-08 Thread &#x27;Mike Day&#x27; via Programming
Thanks - I'm not too surprised. v2 is still clunky. My earlier offering is even slower and consumes much more space! But, FWIW, Skip's original example result had 5 rows, the last being the unaltered input data, which is why I added it - that's the one you then remove with }:@:. I now

[Jprogramming] AoC 2016 day 9 - Was Re: [Jbeta] possible memory leak j805

2016-12-10 Thread &#x27;Mike Day&#x27; via Programming
Apologies for posting the previous message (below) earlier on Beta. Anyway, I have now seen that there's a part two to the problem, presumably hidden to me as I hadn't got part one correct, and discussion of it (in reddit.com/Advent...) suggests that recursion IS required, or, at least, rele

Re: [Jprogramming] AoC 2016 day 9 - Was Re: [Jbeta] possible memory leak j805

2016-12-10 Thread &#x27;Mike Day&#x27; via Programming
. (>:e) }. y end. o , ',' , ": # y ) R =: 2 : ' m * # n' RB =: 2 : ' m * (1 +/@:".@:}.@:p1 n)' echo +/ ". }. 0 p1 LF -.~ a NB. part1 echo +/ ". }. 1 p1 LF -.~ a NB. part2 - Original Message - From: 'Mike Day' via Progra

Re: [Jprogramming] AoC 2016 day 9 - Was Re: [Jbeta] possible memory leak j805

2016-12-10 Thread &#x27;Mike Day&#x27; via Programming
Dec 10, 2016 at 1:19 PM, 'Mike Day' via Programming < programm...@jsoftware.com> wrote: ​[snip]​ On 10/12/2016 16:47, 'Pascal Jasmin' via Programming wrote: posted a slightly different solution on wiki, but the original did get correct answer, even though it took

Re: [Jprogramming] AoC 2016 day 9 - Was Re: [Jbeta] possible memory leak j805

2016-12-11 Thread &#x27;Mike Day&#x27; via Programming
Trying the patience of the forum here, but may I ask: were both parts of the problem visible all the time? After getting part one correct I started looking for and found part two below part one's submission area - either it was already there, or else it was revealed by the correct entr

Re: [Jprogramming] AoC 2016 day 9 - Was Re: [Jbeta] possible memory leak j805

2016-12-11 Thread &#x27;Mike Day&#x27; via Programming
submitted a correct entry for Part 1. Upon successful submission, it gives you the option to “Return to Problem n”, and re-displays Part 1, along with your “correct” answer, then below that the Part 2 extension. Cheers Mike, Rob On 11 Dec. 2016, at 7:18 pm, 'Mike Day' via Programmi

Re: [Jprogramming] Hooked again

2017-02-12 Thread &#x27;Mike Day&#x27; via Programming
It looks to me as if the two left hooks form one big left hook, not that I'm into boxing: mn =: -"1 mean mp1=: mp~|: ((mp1 mn)%#)dataNB. big "hook" 504 360 180 360 360 0 180 0 720 ((mp1 @: mn)%#)data NB. mp1 after mn using @: 504 360 180 360 360 0 180 0 720 (([: mp

Re: [Jprogramming] Accumulator for generated results

2017-02-21 Thread &#x27;Mike Day&#x27; via Programming
FWIW, here are some results running one million tests of bestof3N compared with a very slightly more J way of doing it. (Your correspondence with Joe & Pascal while I was drafting this might render the following redundant.) Freq =: ~.,:#/.~ NB. 2-row frequency table

Re: [Jprogramming] Accumulator for generated results

2017-02-21 Thread &#x27;Mike Day&#x27; via Programming
297407 285714 240173 157035 71081 Mike On 21/02/2017 14:24, 'Mike Day' via Programming wrote: FWIW, here are some results running one million tests of bestof3N compared with a very slightly more J way of doing it. (Your correspondence with Joe & Pascal while I was dra

[Jprogramming] Plot package - new error?

2017-02-23 Thread &#x27;Mike Day&#x27; via Programming
New behavoiur this evening. Running jqt 64 vn 8.05 for windows ('type contour')plot(<"1]2#,:i:q),The plot demo does work partially. A plot is shown, but there's also a dialogue window with the same error message, preceded by "error in plotdemo_default" I ran package manager earlier

Re: [Jprogramming] Plot package - new error?

2017-02-24 Thread &#x27;Mike Day&#x27; via Programming
Thanks, Bill. It works now, after running BOTH updatejqt64 805 AND package manager to update ide/qt . But did I actually need to do both updates? (updatejqt64 is slow here) Thanks again, Mike On 24/02/2017 02:51, bill lam wrote: Now fixed. Thank you for the report. --- This email h

Re: [Jprogramming] Plot package - new error?

2017-02-24 Thread &#x27;Mike Day&#x27; via Programming
Sorry - I wasn't making myself clear. What I meant was, I ran both updates because I didn't know what does what. It's not obvious to someone who doesn't write J software where different bits reside. I didn't know whether your fixes were in addons or in qtlib. No harm done! Thanks for such

Re: [Jprogramming] A picture of two circles

2017-02-26 Thread &#x27;Mike Day&#x27; via Programming
What is z, please? M On 26/02/2017 08:57, Linda A Alvord wrote: Here's a little demo to show you that there are really two circles in the final plot. The second plot erases the previous plot, so look at the code line by line. load 'plot' do=: 13 :'({.y)+(i.{:>:y)*(--/}:y)%{:y' t

Re: [Jprogramming] Fast derivative of Softmax function

2017-02-27 Thread &#x27;Mike Day&#x27; via Programming
It's not clear what you had in mind for the dyadic function "softmax" . Anyway, is this what you require? I=: =/~@:i.@#NB. Identity matrix (Kronecker delta) pdsm =: (*"1 (-~I))@:sm NB. Partial derivative (matrix) of sm pdsm a 0.186192 _0.0676431 _0.0467234 _0.0718259 _0.06764

Re: [Jprogramming] Explicit fib

2017-02-28 Thread &#x27;Mike Day&#x27; via Programming
That's the exact approach, as you know. Meanwhile, I'd got the impression that Linda wished to present the quarter-circle approximations, as shown in, eg, https://en.wikipedia.org/wiki/Golden_spiral#/media/File:Fibonacci_spiral_34.svg So I've amused myself for a while developing the followin

Re: [Jprogramming] Explicit fib

2017-03-01 Thread &#x27;Mike Day&#x27; via Programming
t helix in some such fashion, than to develop the fractal squares or cubes that I'd started on. Mike On 01/03/2017 08:18, Linda A Alvord wrote: Mike, Here's an error that I am getting. Linda -Original Message- From: Programming [mailto:programming-boun...@forums.jsoftwa

Re: [Jprogramming] Explicit fib

2017-03-01 Thread &#x27;Mike Day&#x27; via Programming
ke, Here's an error that I am getting. Linda -Original Message- From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of 'Mike Day' via Programming Sent: Tuesday, February 28, 2017 11:03 AM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Exp

Re: [Jprogramming] JHS update

2017-03-10 Thread &#x27;Mike Day&#x27; via Programming
FWIW, Eric, I don't find the distinction between "file" and "files" obvious - they're evidently different but I don't easily remember which is recent files and which is a file browser. Why not rename "files" as "recent files" and have done? But I'm (still) not a frequent user of JHS, so shou

Re: [Jprogramming] first 806 beta vailable

2017-03-12 Thread &#x27;Mike Day&#x27; via Programming
I didn't know I had avx available on this machine, an AMD A10-7300, running Windows 10. Anyway, J806 JVERSION says I do! I'd have a go at running the benchmarks, but wonder if there's a script available to save doing them "by hand" JVERSION Engine: j806/j64avx/windows Beta-1: commerci

[Jprogramming] Moving median - any good methods?

2017-03-14 Thread &#x27;Mike Day&#x27; via Programming
This has arisen in solving Euler Project problem 593. https://projecteuler.net/problem=593 It is basically quite easy, especially for the examples with given answers, ie for F(100,10) and even for F(10, 1) but as usual with these problems, there's a sting in the tail, in the computing

Re: [Jprogramming] Moving median - any good methods?

2017-03-14 Thread &#x27;Mike Day&#x27; via Programming
ast. > But may be interesting as a reference. > > Jon > > ------------ > On Wed, 3/15/17, 'Mike Day' via Programming wrote: > > Subject: [Jprogramming] Moving median - any good methods? > To: programm...@jsoftware.com > Date: Wednesday, March 15, 2017,

Re: [Jprogramming] Project Euler

2017-03-15 Thread &#x27;Mike Day&#x27; via Programming
Only just up - having breakfast! I evidently solved it, as the project's discussion thread is open to me, but I don't have a record of my method. Early-ish PE problems were amenable to brute force, and I expect that's how I would have done it. AFAIrecall, later problems involving phi requ

Re: [Jprogramming] Project Euler

2017-03-15 Thread &#x27;Mike Day&#x27; via Programming
ly to mike_liz@tiscali.co.uk. Sent from my iPad > On 15 Mar 2017, at 07:48, 'Mike Day' via Programming > wrote: > > Only just up - having breakfast! I evidently solved it, as the project's > discussion thread > is open to me, but I don't ha

Re: [Jprogramming] Moving median - any good methods?

2017-03-15 Thread &#x27;Mike Day&#x27; via Programming
Thanks .to Jon Hough for the link to priority queues. I had a look. I doubt they're directly relevant as a moving median needs to be able to remove a particular element rather than that chosen by the remove method used there - if I understand it right. However, it does show how to set up a

Re: [Jprogramming] Moving median - any good methods?

2017-03-17 Thread &#x27;Mike Day&#x27; via Programming
Thanks to Jon Hough for the priority queue oo example. It works quite well as an example method, but I'm rather stumped as to how to remove an item other than the priority one. I.e. I need removenum rather than remove'' I have to go out now, so sorry for no more detail. Thanks, Mike Please r

[Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-08 Thread &#x27;Mike Day&#x27; via Programming
Using extended integers is the obvious answer to this, but I'd like to avoid the memory and performance hits. I'm using J806 (with avx if that's relevant) under Windows 10 on a 64-bit machine. I wish to multiply integers modulo 2^48 . We can assume that inputs are < 2^48. Set M =: 2 <.@^

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-08 Thread &#x27;Mike Day&#x27; via Programming
ay be useful is that when either x or y not prime, M&|@*/ ,&q:/ M | x , y equivalent to M&|@*/ x , y From: 'Mike Day' via Programming To: programm...@jsoftware.com Sent: Monday, May 8, 2017 4:44 AM Subject: [Jprogramming] Precision o

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-08 Thread &#x27;Mike Day&#x27; via Programming
Thanks, Raul Mike On 08/05/2017 14:19, Raul Miller wrote: On Mon, May 8, 2017 at 4:43 AM, 'Mike Day' via Programming wrote: Is there a better way to do modulus multiply with largish arguments? Hypothetically speaking, you might be able to do something based on http://code.jsoftware

Re: [Jprogramming] PE 159

2017-05-10 Thread &#x27;Mike Day&#x27; via Programming
I appear to have solved PE 159, & have even found the verb that seemed to do the work, but have forgotten how it works! Anyway, it might be worth considering a constructive approach, whereby you consider possible combinations of primes generating all numbers in the domain rather than anal

Re: [Jprogramming] PE 159

2017-05-11 Thread &#x27;Mike Day&#x27; via Programming
I've now got my p159 verb to work again. I'd written it back in J4 or J5 days, and some chars had got mashed! Anyway, although it doesn't break the sound barrier, it does limp home with the correct answer in under a minute for the given problem size, running in J806 under Windows 10. Mike

Re: [Jprogramming] PE 159

2017-05-11 Thread &#x27;Mike Day&#x27; via Programming
My verb is pedestrian, not J806 itself! M Please reply to mike_liz@tiscali.co.uk. Sent from my iPad > On 11 May 2017, at 17:36, Istvan Kadar wrote: > > I have Windows 7 and J602. It is not limp in PDF or DOC. Thanks! > > 2017-05-11 18:10 GMT+02:00 'Mike

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-16 Thread &#x27;Mike Day&#x27; via Programming
metic on the two operands only. I wouldn't need to use extended multiplication if multiply of <63-bit integers modulo M< ~ 2^63 was guaranteed correct! Too much to ask? Any better ways to achieve the result of cumoddprod? Thanks, Mike On 08/05/2017 15:08, 'Mike Day'

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-16 Thread &#x27;Mike Day&#x27; via Programming
Thanks again, Raul. Well - I'd actually meant ~2^24 odd numbers, 1... _1+2^25 - trust me to make a mistake in trying to simplify the presentation! Let's call it a typo. I don't think my post was a spoiler, as the problem needs quite a bit of insight elsewhere; this array helps in getting t

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-16 Thread &#x27;Mike Day&#x27; via Programming
It would be nice if it worked. Unfortunately (again!), for the actual size required, timer'_10{. |. 281474976710656&|@*/\.<.1+2*i.-2^24' +--+---+ |32.001|0 0 0 0 0 0 0 0 0 0| +--+---+ whereas the correct values are all > 0 This is why I needed specia

Re: [Jprogramming] Precision of modular multiplication of quite large numbers

2017-05-16 Thread &#x27;Mike Day&#x27; via Programming
Yep - a blocky approach addresses the virtues of a vector approach and minimises the hit with extended. Could fine tune it but why bother!? I quite often end up using blocks in this sort of fashion, though overlooked it here. Note to self, though - must look into why /\. with reverse is bet

Re: [Jprogramming] J for iPad

2017-05-26 Thread &#x27;Mike Day&#x27; via Programming
It still seems to run under 10.3.1, with a warning re future incompatibility. I expect new iOS vn's benefits outweigh cost of losing J. Any views? Thanks, Mike Please reply to mike_liz@tiscali.co.uk. Sent from my iPad > On 26 May 2017, at 10:43, Kip Murray wrote: > > My iPad Air

Re: [Jprogramming] J for iPad

2017-05-27 Thread &#x27;Mike Day&#x27; via Programming
Yes - it's a bit embarrassing, but my message didn't get sent until Eric's had arrived, 'cos iPad out of wifi range when I posted, I think. Thanks, Mike On 26/05/2017 19:09, Kip Murray wrote: See Eric's recent note "iOS/iPad/iPhone". --Kip On F

Re: [Jprogramming] find in files window inaccessible

2017-06-05 Thread &#x27;Mike Day&#x27; via Programming
This problem has just re-surfaced for me, J806 under Windows 10, details below. Today's inaccessible fif has Fif=-1383 154 2394 529 in the configqt file, winpos.dat Difficult to say what caused it, as I tend to keep J sessions going until they fail for some reason. I'll try to reset the va

Re: [Jprogramming] find in files window inaccessible

2017-06-05 Thread &#x27;Mike Day&#x27; via Programming
e x meant measured from a viewport on the right hand side. On 6 Jun, 2017 1:17 am, "'Mike Day' via Programming" < programm...@jsoftware.com> wrote: This problem has just re-surfaced for me, J806 under Windows 10, details below. Today's inaccessible fif has

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-06 Thread &#x27;Mike Day&#x27; via Programming
FWIW - not much, here, as it isn't relevant to factorial, and on investigation, not something used in Mr Rice's LISP example, but, as Raul's posted a verb for "union", I've sometimes wondered why J doesn't include primitives for union and intersection. As I sometimes need intersection, here'

Re: [Jprogramming] Factorial function, same style as this recursion example?

2017-06-06 Thread &#x27;Mike Day&#x27; via Programming
, Raul Miller wrote: On Tue, Jun 6, 2017 at 4:09 AM, 'Mike Day' via Programming wrote: if I were developing a solver for solitaire, I'd include a variable as a parameter for the size of problem, eg the number of rows, 1 2 3 etc, or the ravel-size, eg 1 3 6 etc. You had not spe

Re: [Jprogramming] J64 available at the Apple app store

2017-06-07 Thread &#x27;Mike Day&#x27; via Programming
Thanks, Eric. I've just bitten the bullet and upgraded my iPad Air to IOS 10.3.2(14F89) (I don't know if the bracketed details are significant) I then downloaded the J64 "app" - it started up ok, and the initial demos worked fine. What surprised me is that the old J32 app still appears to wor

Re: [Jprogramming] J64 available at the Apple app store

2017-06-08 Thread &#x27;Mike Day&#x27; via Programming
ok, thanks On 08/06/2017 04:37, Eric Iverson wrote: Mike, The old j32 will stop running on some future iOS release. Perhaps before October. On Wed, Jun 7, 2017 at 6:53 PM, 'Mike Day' via Programming < programm...@jsoftware.com> wrote: Thanks, Eric. I've just

Re: [Jprogramming] Empty lists?

2017-06-08 Thread &#x27;Mike Day&#x27; via Programming
Raul's listing at http://www.jsoftware.com/pipermail/programming/2017-June/047522.html works fine for me! Mike (Day, not Rice!) On 08/06/2017 15:07, Michael Rice wrote: move_table=: <:(,|."1)(#~0<*/"1)~.,/,/_3&{.\@/:~"1(,|:"2)>|:((;|.)@(1++)+/)\i.5 flip=: ~: (i.15)&e. legal_moves=

Re: [Jprogramming] largest rectangle problem

2017-06-20 Thread &#x27;Mike Day&#x27; via Programming
I've only just seen this. I expect it's obvious, but you ARE looking only for rectangles with "vertical" and "horizontal" sides, i.e. no rotations other than multiples of pi/2 involved? Thanks, Mike Please reply to mike_liz@tiscali.co.uk. Sent from my iPad > On 20 Jun 2017, at 16:29

Re: [Jprogramming] largest rectangle problem

2017-06-20 Thread &#x27;Mike Day&#x27; via Programming
sides, and slanted "rectangles" would thus include empty > space on the edges. > > Thanks, > > -- > Raul > > On Tue, Jun 20, 2017 at 4:49 PM, 'Mike Day' via Programming > wrote: >> I've only just seen this. >> I expect it'

Re: [Jprogramming] largest rectangle problem

2017-06-24 Thread &#x27;Mike Day&#x27; via Programming
Having at last had a go at solving this, post breakfast (if not Brexit). I don't think it's a new approach, but it's fairly nifty. It considers run lengths times heights. a =: >./^:2@:(>:@i.@# ([ * <./\) ]) qq=:1000?.100 a qq 7030779 ts'a qq' NB. time & space 0.0328879

Re: [Jprogramming] largest rectangle problem

2017-06-24 Thread &#x27;Mike Day&#x27; via Programming
q as previous post, below 0.0316207 2.24246e7 ts'c qq' 0.0149281 28544 Thanks, Mike On 24/06/2017 10:09, 'Mike Day' via Programming wrote: Having at last had a go at solving this, post breakfast (if not Brexit). I don't think it's a new approach, but it's

Re: [Jprogramming] largest rectangle problem

2017-06-24 Thread &#x27;Mike Day&#x27; via Programming
Oops - that diagnostic "q" was unnecessary: c =: 3 : 0 m =. >./y for_i. }.>:i.#y do. m =. m >. >./ i ([ * <./\) y end. ) ts'c qq' 0.0143082 21632 M On 24/06/2017 10:53, 'Mike Day' via Programming wrote: This explicit version is faster and

Re: [Jprogramming] largest rectangle problem

2017-06-24 Thread &#x27;Mike Day&#x27; via Programming
It's super fast, but doesn't seem to produce the correct result! Where's the typo? (C,c) qq 152 7030779 ts'c qq' 0.0159982 21632 ts'C qq' 0.0107839 289920 Sorry, Mike On 24/06/2017 14:04, Raul Miller wrote: Or, C=: <./@(>:@i.@# <./@([ * <./\)"0 1 ]) Thanks, --- T

Re: [Jprogramming] largest rectangle problem

2017-06-24 Thread &#x27;Mike Day&#x27; via Programming
Ah! I'd spotted the outer, left-most >. for <. , but had missed the inner, rightmost... The speed-up and space-saving (cf my verb "a", say) appears to come from using ranks "0 1 rather than the placement of the >./ fragments. My c verb remains slower (because it loops!?) but uses less spac

Re: [Jprogramming] largest rectangle problem

2017-06-25 Thread &#x27;Mike Day&#x27; via Programming
There must be something about breakfast. A loopy stopping condition has just presented itself. Others might see a tacitisation: cs =: 3 : 0 m =. >./y for_i. }.>:i.n =. #y do. m =. m >. q =. >./ i ([ * <./\) y if. (m * i) >: n * q do. break. end. end. m ) q holds the maximum area at "wi

Re: [Jprogramming] largest rectangle problem

2017-06-25 Thread &#x27;Mike Day&#x27; via Programming
j] ), min( V[i+1] … V[j+1] ) ). This version is based on that: ms=: #\ >./ . * [: >./@> # 2&(<./\&.>)&< ] 1e3 ts 'ms qq' 0.00491435 5.74234e6 Incorporating this in Mike's explicit version with an early stopping condition could lead to even faster

Re: [Jprogramming] largest rectangle problem

2017-06-25 Thread &#x27;Mike Day&#x27; via Programming
Thanks. I haven't heard of paste & match - I like to use Thunderbird to support the sharewarers, but fight against some of its features. With time & patience, I copy & paste into a notepad file, and then re-copy and paste into T/bird. I hadn't bothered in my recent posts. I do (and did in t

Re: [Jprogramming] cleanest diamond

2017-06-27 Thread &#x27;Mike Day&#x27; via Programming
Chat really... Breakfast-time again! Noticing my name (below) I assumed you meant my recent discussions with Raul et al on "the largest rectangle problem" were relevant! On checking, I see that I had contributed something years ago, on colouring contiguous areas in rectangles. So perhaps I'

Re: [Jprogramming] largest rectangle problem

2017-06-28 Thread &#x27;Mike Day&#x27; via Programming
Linda, bear in mind that Raul was (I think) deriving a tacit improvement of my explicit verb "c" which had incorporated an explicit loop. Here it is, again, possibly without gratuitous line-throws: c =: 3 : 0 m =. >./y for_i. }.>:i.#y do. m =. m >. >./ i ([ * <./\) y end. ) It happens to

Re: [Jprogramming] cleanest diamond

2017-06-29 Thread &#x27;Mike Day&#x27; via Programming
I believe this is the wrong thread, Linda. I commented yesterday on a similar message from you under the heading, "Largest Rectangles." Mike On 29/06/2017 02:07, Linda Alvord wrote: Here is how I wrote your verb. How would you write it as an explicit verb? f=: [:>./([:([:>:i.)#)([: >./[ * <

Re: [Jprogramming] cleanest diamond

2017-06-29 Thread &#x27;Mike Day&#x27; via Programming
Linda, yet again, I believe you're looking at treatments of Raul's largest rectangle problem, as discussed in the thread "Largest Rectangle" qq is a randomised example of a list of widths or heights, depending on your view, of what might be regarded as a histogram or bar-diagram. Raul soug

Re: [Jprogramming] largest rectangle problem

2017-07-03 Thread &#x27;Mike Day&#x27; via Programming
>>> m=. >./y >>> for_i. }.>:i.n=. #y do. >>>m=. m>.q=. i*>./y=. 2<./\y >>>if. (m*i)>:n*q do. break. end. >>> end. >>> m >>> ) >> >> >>> 1e3 ts'cs1 qq' >>> 0.00107603 29440

Re: [Jprogramming] largest rectangle problem

2017-07-04 Thread &#x27;Mike Day&#x27; via Programming
Interesting! I was puzzled as to why ldrs1/2 also each consumes less space than lrds or finalrev etc, but then realised that the source of the difference is probably the expression " i.n " in the do-loop version. ts'i.1000' NB. time & space for i.1000 1.24189e_5 8960 supports the suppo

Re: [Jprogramming] Request for comments: multiple assignment

2017-07-04 Thread &#x27;Mike Day&#x27; via Programming
Not multiple assignment, but copula-related. I've often wondered why J doesn't have the C family feature of assignments such as t =: 1 2 3 [t+=: 3 4 5 6 I don't know what it's called, and I realise it's only an arguably attractive feature, not an essential one, but would be useful, espe

Re: [Jprogramming] J iOS at Apple App Store

2017-07-04 Thread &#x27;Mike Day&#x27; via Programming
Early try-out on iPad, iOS 10.3.2 :- the "?" "Button" appears not to work, not with my finger-jabbing, at least... Thanks, Mike Please reply to mike_liz@tiscali.co.uk. Sent from my iPad > On 5 Jul 2017, at 01:42, Eric Iverson wrote: > > A significant new release of J iOS is avai

Re: [Jprogramming] J iOS at Apple App Store

2017-07-05 Thread &#x27;Mike Day&#x27; via Programming
pe work too? Thanks again, Mike Please reply to mike_liz@tiscali.co.uk. Sent from my iPad > On 5 Jul 2017, at 07:54, 'Mike Day' via Programming > wrote: > > Early try-out on iPad, iOS 10.3.2 :- > > the "?" "Button" appears not

Re: [Jprogramming] J iOS at Apple App Store

2017-07-05 Thread &#x27;Mike Day&#x27; via Programming
keyboard in landscape mode so that you would see the html view, but that can be a nuisance for general use. Please confirm that J works properly (as described here) on your device or if you still think there is a problem. (The problem is partly because the J kb is so big and it is big because my fi

Re: [Jprogramming] Editing in J701 on an iPad Air

2017-07-09 Thread &#x27;Mike Day&#x27; via Programming
[Jprogramming] might not be right - is there an iPad beta group? I've just discovered the "keyboard" includes _both_ a delete left arrow _and_ cursor movement left (and right) arrows. It seems to work in both terminal and edit sessions. That's a great improvement in itself, especially for fa

Re: [Jprogramming] J iOS at Apple App Store

2017-07-09 Thread &#x27;Mike Day&#x27; via Programming
While drafting this, I've just seen Joey Tuttle's post. But I'll persist!n (And now, Eric's!) There's the official method for the previous (32 bit) iOS versions, described under http://code.jsoftware.com/wiki/Guides/iOS/32bit#FileTransfers It involves emailing to yourself. Possibly simpler

  1   2   3   4   5   6   >