Re: [Jprogramming] lex / dev question

2022-04-21 Thread Elijah Stone
On Thu, 21 Apr 2022, Michal Wallace wrote: I then thought that replacing u => [. and v => ]. would let me remove the double curlies, but clearly this is the wrong idea: AA =: ([. @: ].) ]. ] _: AA (3 AT) ;/i.10 +-+-+-+-+-+-+-+-+-+-+ |0|1|2|3|4|5|6|7|8|9| +-+-+-+-+-+-+-+-+-+-+ I don't real

Re: [Jprogramming] lex / dev question

2022-04-21 Thread Michal Wallace
Thanks, Elijah! This was very helpful. I think I was sort of hallucinating that the mere presence of [. and ]. would change the meaning of the entire train, the way the mere presence of u and v changes the meaning of a direct definition, but of course that's not the case. I am going to have to m

Re: [Jprogramming] lex / dev question

2022-04-21 Thread 'Pascal Jasmin' via Programming
> (].~)@: It is the CC train.  The @: will bind to u@:v (].~) is CA  (so still part of overall CC train (CA)C is CC) ]. ignores u, and so (].~) is v~ On Thursday, April 21, 2022, 10:35:41 a.m. EDT, Michal Wallace wrote: Thanks, Elijah! This was very helpful. I think I was sort of

[Jprogramming] Extended precision question

2022-04-21 Thread Ed Gottsman
Hello. I’m working on the Project Euler “Diophantine equation” problem (#66) and using J’s extended precision facilities. I’ve run into behavior that confuses me. Boiled down (and overusing x: just to be sure): x: %: x: 1 + x: *: x: 9 9 That is (if my syntax is right),

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Henry Rich
   3!:0 %: x: 1 + x: *: x: 9 8 The square root cannot be represented exactly. Henry Rich On 4/21/2022 12:43 PM, Ed Gottsman wrote: Hello. I’m working on the Project Euler “Diophantine equation” problem (#66) and using J’s extended precision facilities. I’ve run into behavior that c

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Raul Miller
Square root does not produce an extended precision result. <.@%: does produce an extended precision result, but that would not resolve your problem here. FYI, -- Raul On Thu, Apr 21, 2022 at 12:43 PM Ed Gottsman wrote: > > Hello. > > I’m working on the Project Euler “Diophantine equation” pro

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Gilles Kirouac
Ed You seem unaware of the extended precision constant notation: "digits with a trailing x denote an extended precision integer" https://www.jsoftware.com/help/dictionary/dcons.htm [Where is the equivalent in NuVoc?] I would rather write 1x + *: 9x 82 ~ Gilles Le

Re: [Jprogramming] Extended precision question

2022-04-21 Thread 'robert therriault' via Programming
Gilles, In Nuvoc the extended constant notation can be found here https://code.jsoftware.com/wiki/Vocabulary/Constants#Extended_Integers Having said that, it is hidden pretty well and most of its references are previous documentation on the jsoftware site. There is certainly work to be done on

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Gilles Kirouac
Ed If you expand the Extended Integers section (below by bob), you will see a link to an essay by Roger on 'Extended Precision Functions'. There is a Square Root verb. NB. long rational result may exceed line length sqrt 1x + *: 9x 1249987500062500625004687515

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Devon McCormick
Showing the result in decimal: 23j13": sqrt 1x + *: 9x 9.05000 On Thu, Apr 21, 2022 at 3:18 PM Gilles Kirouac wrote: > Ed If you expand the Extended Integers section (below by bob), you will > see a link to an essay by Roger on 'Extended Precision Functions'. There >

Re: [Jprogramming] Extended precision question

2022-04-21 Thread 'Mike Day' via Programming
One way to obtain high precision roots is to use, say, Newton’s solution to y = x^2 - a : Given an estimate x(n-1), the next estimate is xn = x(n-1) - y/(dy/dx), in Maths notation. In J, (J701 on this iPad), rt =: -:@] + (% +:) NB. x is number whose root is required, y an initial guess

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Ed Gottsman
Thanks to everyone who responded and in particular for the link to Roger Hui’s essay. The wiki discussion was also very good. (In an earlier life I disparaged “cargo cult” programming, in which you take a few lines of source you don’t understand and integrate them into your program. [That you

Re: [Jprogramming] Extended precision question

2022-04-21 Thread Devon McCormick
Hi Ed, I was thinking of explaining Roger's sqrt code as part of next month's NYCJUG. You should take a look: https://www.meetup.com/J-Dynamic-Functional-Programming/ . Cheers, Devon On Fri, Apr 22, 2022 at 12:49 AM Ed Gottsman wrote: > Thanks to everyone who responded and in particular for the