Hrm. I don't understand. It should definitely be (| j. 1:), not (] j. 1:). The idea is that you're taking a line with length (%: n) and using it to construct a line with length (%: n+1).
So for example, the distance (|) from 0j0 to 1j1 is (%: 2). Now you want to make a right triangle whose sides are 1 and (%:2), so that the hypotenuse is (%: 3). If you used ] instead of | on 1j1, you'd wind up at 1j.2, instead of 1.41421j1, and that doesn't work: *:| ( | 1j1) j. 1 NB. what i want 3 *:| ( ] 1j1) j. 1 NB. not what i want. :) 5 Like I said, I probably just didn't explain it very well. :) On Sun, Feb 28, 2016 at 1:50 AM, Linda A Alvord <[email protected]> wrote: > Michal, Your original post had | which you meant as ] > > Here is how I got to Kip's final result. He mentioned you needed to add 1 > > > > f=: 13 :' 1 + *:@|A=: (]j.1:)^:(<y) 0j1' > > f 10 > > 2 5 10 17 26 37 50 65 82 101 > > A > > 0j1 0j2 0j3 0j4 0j5 0j6 0j7 0j8 0j9 0j10 > > |A > > 1 2 3 4 5 6 7 8 9 10 > > *:|A > > 1 4 9 16 25 36 49 64 81 100 > > g=: 13 :' 1 + *:|0 j.1 + i.y' > > (f 10)-:g 10 > > 1 > > 5!:4 <'f' > > ┌─ 3 > ── : ─┴─ ,:' 1 + *:@|A=: (]j.1:)^:(<y) 0j1' > > 5!:4 <'g' > > ┌─ 1 > ├─ + > ──┤ ┌─ [: > │ ├─ *: > └───┤ ┌─ [: > │ ├─ | > └────┤ ┌─ 0 > │ ├─ j. > └────┤ ┌─ 1 > └────┼─ + > └─ i. > > f > > 3 : ' 1 + *:@|A=: (]j.1:)^:(<y) 0j1' > > g > > 1 + [: *: [: | 0 j. 1 + i > > > > > > I tend to write most code in an explicit fashion and then see the J > translation. > > > > Linda > > > > -----Original Message----- > From: Programming [mailto:[email protected]] On > Behalf Of Michal Wallace > Sent: Friday, February 26, 2016 3:17 PM > To: [email protected] > Subject: Re: [Jprogramming] Imaginary Squares > > > > Er... I guess I didn't explain that as clearly as I thought. > > > > The first diagonal (| 1j1) has length (%:2). > > > > The idea was to rotate this segment down to the real line and then make > another right triangle by drawing the line up to ((%:2) j. 1). > > Pythagoras tells us the hypotenuse of this triangle is (%: +/ *: (%2), 1) > which is (%: +/ 2 1) or (%: 3). > > > > So basically it's just generating the square roots of each natural number > in turn, and then you just square those to get the area. > > > > The line at the end was actually the answer: > > > > *:@| (|j.1:)^:(<n) 0j1 [ n=. 10 > > 1 2 3 4 5 6 7 8 9 10 > > > > Not really a puzzle. I just thought it was cool. :) > > > > > > > > On Fri, Feb 26, 2016 at 1:51 PM, Kip Murray < <mailto: > [email protected]> [email protected]> wrote: > > > > > areas =: 1 + [: *: 1 + i. > > > areas 10 > > > 2 5 10 17 26 37 50 65 82 101 > > > > > > --Kip Murray > > > > > > On Friday, February 26, 2016, Michal Wallace > > > < <mailto:[email protected]> [email protected]> > > > wrote: > > > > > > > Imagine a compass rooted at the origin of the complex plane. > > > > > > > > Starting at the point 0j1, draw the arc down to the real line, and > > > > then from this point, draw vertical line segment extending upwards 1 > > > > unit, to arrive at the point 1j1. > > > > > > > > Repeat this process of drawing the arc down to the real line and > > > > moving > > > up > > > > 1 unit N times, creating a series of points along the horizontal > > > > line (] j. 1:). > > > > > > > > For each point, draw a line segment from the origin to the point, > > > > and > > > then > > > > draw a square (*:) whose sides are the length (|) of this segment. > > > > > > > > What is the area of each square? > > > > > > > > *:@| (|j.1:)^:(<n) 0j1 [ n=. 10 > > > > -------------------------------------------------------------------- > > > > -- For information about J forums see > > > > <http://www.jsoftware.com/forums.htm> > http://www.jsoftware.com/forums.htm > > > > > > > > > > > > -- > > > Sent from Gmail Mobile > > > ---------------------------------------------------------------------- > > > For information about J forums see <http://www.jsoftware.com/forums.htm> > http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see <http://www.jsoftware.com/forums.htm> > 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
