[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index multi-dimensioned
arrays. And that can be a convenient
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index multi-dimensioned
arrays. And that can be a convenient
ff 54
This stays in 2 dimensions.
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler
...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index multi-dimensioned
arrays. And that can be a convenient abstraction
Whoops!
Yes, I'd been using I. in a slightly different structure,
with a two-column table of lower and upper bounds on
n for every m, and had forgotten to change it to (i. ./)
for the vector form with all lower bounds followed by
all upper bounds; I'd found it slightly less messy,
and (i../)
: Re: [Jprogramming] Project Euler 85, Python and J
countRects=: */@(2 ! :) NB. How many pairs each of vertical
* horizontal lines
getSizes=: ,@(:/~) # [: ,/ ,0/~NB. All pairs of i. y
idxClosest=: 4 : '(i. ./)@(x |@:- ])y'(0 2) NB. Index of mat y to
value x
2014 19:35:26 -0400
From: devon...@gmail.com
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
countRects=: */@(2 ! :) NB. How many pairs each of
vertical
* horizontal lines
getSizes=: ,@(:/~) # [: ,/ ,0/~NB. All pairs of i
: Fri, 10 Oct 2014 19:35:26 -0400
From: devon...@gmail.com
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
countRects=: */@(2 ! :) NB. How many pairs each of
vertical
* horizontal lines
getSizes=: ,@(:/~) # [: ,/ ,0
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index multi-dimensioned
arrays. And that can be a convenient abstraction.
However, I have been dealing with very large
] On Behalf Of Raul Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index multi-dimensioned
arrays. And that can be a convenient abstraction.
However, I have been dealing
: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index
multi-dimensioned
arrays. And that can be a convenient abstraction.
However, I have been dealing with very large datasets recently, and
boxed
data on the critical path, at least for some
...@forums.jsoftware.com] on behalf of Jon Hough
[jgho...@outlook.com]
Sent: Saturday, October 11, 2014 07:43
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Also, regarding Ben Gorte's
Idot =: $ #: I.@:,
This is an equivalent of I. for higher dimensions.
I'm
...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
Sent: Tuesday, October 07, 2014 4:34 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
This fits in nicely somewhere in the elementary school years! I hope that
93 by 93 is rhe
of sides 31 x 63 is 36.
I think the verb all is under-counting, as 2 all 3 should be 18, not 16.
From: lindaalv...@verizon.net
To: programm...@jsoftware.com
Date: Sat, 11 Oct 2014 02:28:18 -0400
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I have not followed the Python
to work for matrices of any size or dimension.
Is this the standard way to index multidimensional arrays?
From: jgho...@outlook.com
To: programm...@jsoftware.com
Date: Sat, 11 Oct 2014 06:33:45 +0100
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Using (2 ! :) is clearly
...@jsoftware.com
Date: Sat, 11 Oct 2014 06:33:45 +0100
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Using (2 ! :) is clearly better than doing my double for-loop. I'm
embarrassed I missed that.
The real meat of my confusion with multidimensional arrays
.
Is this the standard way to index multidimensional arrays?
From: jgho...@outlook.com
To: programm...@jsoftware.com
Date: Sat, 11 Oct 2014 06:33:45 +0100
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Using (2 ! :) is clearly better than doing my double for-loop. I'm
From: programming-boun...@forums.jsoftware.com
[programming-boun...@forums.jsoftware.com] on behalf of Jon Hough
[jgho...@outlook.com]
Sent: Tuesday, October 07, 2014 06:37
To: programm...@jsoftware.com
Subject: [Jprogramming] Project Euler 85, Python and J
Project Euler 85
To: Programming JForum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Note that 200 x 200 is a bit of an overkill given 3x2 = 2x3
The following choses the lower triangular of a matrix of the different
sized rectangles to investigate.
getSizes=: ,@(:/~) # [: ,/ ,0/~
getSizes : i. 5
Given
AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Sorry, my line breaks got deleted in the email. Her is my Python code:
def pe85(larg, rarg): count = 0
llist = range(1, larg+1)
rlist = range(1, rarg+1)
for l in llist
] Project Euler 85, Python and J
Message-ID:dub126-w86e5bcc6a9b2e4bcd852c1ac...@phx.gbl
Content-Type: text/plain; charset=iso-8859-1
Project Euler 85:https://projecteuler.net/problem=85
This problem is not really conceptually hard, but I am struggling with a J
solution.I have solved it in Python
Nice solution.
The original post had a question which I interpret as How do I find the
index list of the largest number in a multidimensional array?
($ #: (i. ./)@:,) array
($ #: (i. ./)@:,) 3 1 4 1 5 9 6
5
($ #: (i. ./)@:,) 3 3 $ 0 0 0 9 0 0 0 0 0
1 0
Henry Rich
On 10/7/2014
To: programm...@jsoftware.com
Date: Tue, 7 Oct 2014 05:37:27 +0100
Subject: [Jprogramming] Project Euler 85, Python and J
Project Euler 85: https://projecteuler.net/problem=85
This problem is not really conceptually hard, but I am struggling with a J
solution.I have solved it in Python
Hi,
A dirty trick to get the job done would be to ravel the matrix ( , ), solve
the 1d version of the problem and then get the true indexes with
something like (.@%200 , 200|).
For example, if you needed to just find the max:
(.@%200 , 200|) (i. ./) , m
where m is your matrix.
I know this isn't a
Actuary the use of ravel and antibase is common practice to solve
certain problems in APL and isn't considered cheating. So I wouldn't
say it's not nice but I would definitely go for antibase instead of
a combination of floored-divide and modulus. As a bonus, a solution
based on antibase would
PM
To: Programming JForum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Here is another version of countRects
countRects=: */@(2 ! :)
On Wed, Oct 8, 2014 at 9:07 AM, Tikkanz tikk...@gmail.com wrote:
Sorry, yes that is a leap.
(x * (x + 1)) * 0.5 is the number of ways to choose two
: [Jprogramming] Project Euler 85, Python and J
Actuary the use of ravel and antibase is common practice to solve
certain problems in APL and isn't considered cheating. So I wouldn't
say it's not nice but I would definitely go for antibase instead of
a combination of floored-divide and modulus. As a bonus
?
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Stefano
Lanzavecchia
Sent: Friday, October 10, 2014 11:47 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python
).
In procedural python this could be quickly done with a double for-loop and a
prime test. In J this type of problem still escapes me.
Date: Fri, 10 Oct 2014 19:35:26 -0400
From: devon...@gmail.com
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Project Euler 85, Python and J
To: programm...@jsoftware.com
Date: Sat, 11 Oct 2014 06:33:45 +0100
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Using (2 ! :) is clearly better than doing my double for-loop. I'm
embarrassed I missed that.
The real meat of my confusion with multidimensional arrays is in not just
This (2!:) version seems more straightforward, especially if accompanied
by a comment pointing out that you're looking for the number of
combinations (*/) of all pairs of lines (2!) and the number of lines is one
more than each dimension (:) because they delineate the boundaries of the
cells. It
Note that 200 x 200 is a bit of an overkill given 3x2 = 2x3
The following choses the lower triangular of a matrix of the different
sized rectangles to investigate.
getSizes=: ,@(:/~) # [: ,/ ,0/~
getSizes : i. 5
Given the sides of a rectangle you can count the number of rectangles as
follows:
Hi -
countRects seems like a bit of a leap. I think I understand 4 %~
because you're overcounting by 4 rotations, but I don't comprehend the
magic behind */@(,:).
I see that (,:) concatenates the shape to its increment, e.g. 2 3 3 4
for the input 2 3, but what's the rationale behind this?
To answer Jon's last question, if nr is my matrix of results from
countRects, then this gives me the index of the lowest (closest to 2e6)
in the raveled matrix:
(3 : '(] i. ./) ,y') 2e6(-|)nr
499
If we think of the indexes of a table as being a base ($table) number, we
can decode the vector
filter for : i.2000
4 %~ */@(, :) 1 2000x
2001000
4 %~ */@(, :) 1 1999x
1999000
- Original Message -
From: Devon McCormick devon...@gmail.com
To: J-programming forum programm...@jsoftware.com
Cc:
Sent: Tuesday, October 7, 2014 11:30 AM
Subject: Re: [Jprogramming] Project Euler 85
%~ */@(, :) 1 1999x
1999000
- Original Message -
From: Devon McCormick devon...@gmail.com
To: J-programming forum programm...@jsoftware.com
Cc:
Sent: Tuesday, October 7, 2014 11:30 AM
Subject: Re: [Jprogramming] Project Euler 85, Python and J
Hi -
countRects seems like a bit
Sorry, yes that is a leap.
(x * (x + 1)) * 0.5 is the number of ways to choose two horizontal lines to
make 2 sides of the rectangle.
(y * (y + 1)) * 0.5 is the number of ways to choose two vertical lines to
make the other 2 sides of the rectangle
((x * (x + 1)) * 0.5) * ((y * (y + 1)) * 0.5) is
Here is another version of countRects
countRects=: */@(2 ! :)
On Wed, Oct 8, 2014 at 9:07 AM, Tikkanz tikk...@gmail.com wrote:
Sorry, yes that is a leap.
(x * (x + 1)) * 0.5 is the number of ways to choose two horizontal lines
to make 2 sides of the rectangle.
(y * (y + 1)) * 0.5 is the
Project Euler 85: https://projecteuler.net/problem=85
This problem is not really conceptually hard, but I am struggling with a J
solution.I have solved it in Python:
=
def pe85(larg, rarg): count = 0 llist = range(1, larg+1)rlist =
: [Jprogramming] Project Euler 85, Python and J
Project Euler 85: https://projecteuler.net/problem=85
This problem is not really conceptually hard, but I am struggling with a J
solution.I have solved it in Python:
=
def pe85(larg, rarg): count = 0 llist
40 matches
Mail list logo