Re: [Jprogramming] Recursive verbs

2018-11-27 Thread Cliff Reiter
I like that solution. Here is another approach    4 p.~(2&^@>: ,.~ _1r3 * 2&^@>: + _1&^)i. 10 7 15 29 59 117 235 469 939 1877 3755 I found this by composing the linear poly's and noting the constant terms satisfy a two step recursion with eigenvalues 2 and _1.    lc=.({.@[+{:@[*{.@]),*&{:   

[Jprogramming] Journal of J

2018-10-04 Thread Cliff Reiter
Hi, The Journal of J (http://www.journalofj.com/) published an issue in June of this year. I indulged the fact that it is an electronic journal to write an article with 108 figures (47 pages). It was on finding cellular automata that exhibit complex behavior using some statistics. The most

Re: [Jprogramming] Using rank to avoid looping - reference?

2018-09-05 Thread Cliff Reiter
From Mathematica help: Map (Built-in Symbol) Map[f, expr] or f /@ expr applies f to each element on the first level in expr. Map[f, expr, levelspec] applies f to parts of expr specified by levelspec. Map[f] represents\[Ellipsis] On 9/5/2018 10:58 AM, devonmcc wrote: I am trying to bring

Re: [Jprogramming] Tacit form: How to handle intermediate result..?

2018-09-04 Thread Cliff Reiter
Your 13 created a tacit verb    taher=: 13 : '%: s2 * */ s2-y [ s2=. -: +/ y'    taher [: %: ([: -: +/) * [: */ ([: -: +/) - ] On 9/4/2018 7:50 AM, Martin Kreuzer wrote: Hi all - To calculate the area of a flat triangle, using Heron's formula, A(a,b,c)= sqrt( s2*(s2-a)*(s2-b)*(s2-c) ) I

Re: [Jprogramming] Finding Irrational Numbers

2018-06-15 Thread Cliff Reiter
My first reaction to Bo's remarks (far below) was "well said and very sensible" although my instinct was to use 1e8 near half the precision of floats. I started playing with tacit versions and got to observe what I thought was a surprising number of false positives. First some tacit fun:   

Re: [Jprogramming] Remembering the window position across sessions

2018-05-12 Thread Cliff Reiter
That sounds like a good, useful plan. On 5/12/2018 8:55 AM, chris burke wrote: ~config/winpos.dat is used by Jqt to remember the positions of some windows. It could be used for wd forms as well. We need to agree on how it should work. Right now we have wd 'pmove x y w h' to set the position.

Re: [Jprogramming] Large 64 bit integers

2018-04-25 Thread Cliff Reiter
I am guessing there is a bug in b formatting. Note, even base 10:    10b123456789010234567 123456789010234560    10b123456789010234562 123456789010234560 Almost seems like it went "float" internally or some such. On 4/25/2018 11:12 AM, Thomas Hickey wrote: Maybe a better question is why are

Re: [Jprogramming] Large 64 bit integers

2018-04-25 Thread Cliff Reiter
Not sure this helps:    ]n=:(8#256) #: 81985529216486896x 1 35 69 103 137 171 205 240 Note the 240 in n    _3 ic |.n{a. 81985529216486896 On 4/25/2018 10:29 AM, Thomas Hickey wrote: I have a 64 bit number: 16b123456789abcdef = 81985529216486896 encoded in 8 bytes in a file: 239 205 171 137

Re: [Jprogramming] Journal Of J - CALL OF PAPERS

2018-04-24 Thread Cliff Reiter
Hi, Just a remark that I finally submitted the paper I had in mind to the Journal of J. It might be a good time to let the editor know if you have plans to submit a paper reasonably soon. Happy J'ing Best, Cliff On 4/19/2017 1:06 AM, mikel paternain wrote: Send papers to

Re: [Jprogramming] Indvidual unboxing

2018-04-10 Thread Cliff Reiter
   ]a=:10 6 8 <@?@$"0] 2 +-+-+-+-+-+-+-+-+-+-+ |1|1|1|1|0|0|0|1|0|1| +-+-+-+-+-+-+-+-+-+-+ |0|1|1|1|0|1| | | | | +-+-+-+-+-+-+-+-+-+-+ |0|1|0|1|1|0|0|1| | | +-+-+-+-+-+-+-+-+-+-+    <@;"1 a +---+---+---+ |1 1 1 1 0 0 0 1 0 1|0 1 1 1 0 1|0 1 0 1 1 0 0 1|

[Jprogramming] feedback

2018-03-06 Thread Cliff Reiter
Pascal, I assume you meant that you got no feedback from the editor? Pity if so. Have you thought about asking the forum for feedback? That would probably have a good overlap in readership. Best, Cliff -- For information

Re: [Jprogramming] RV: JoJ 2018

2018-03-05 Thread Cliff Reiter
Dear J forum, Writing for the Journal of J or Vector is different from writing for the Jforums or Wiki. All those venues are a valuable resource for us who work with J. I encourage us to supply all those forums with material. I submitted a paper to Vector a few months ago:

Re: [Jprogramming] sequential machine

2018-02-18 Thread Cliff Reiter
A cut variant of "words"    (<;.1~1,2 ~:/\ ])I +-++---+---+-++ |a||aaa|ccc|a|| +-++---+---+-++ On 2/18/2018 1:22 PM, David Lambert wrote: While not answering your question, the verbs f f g and h solve the problem.  The first f uses complex copy to

Re: [Jprogramming] viewmat image dimensions

2017-12-31 Thread Cliff Reiter
Poking around coclass 'jviewmat' names'' Maybe changing DEFWH would be more appropriate. (untested) On 12/31/2017 1:32 PM, Cliff Reiter wrote: This may not be a good choice as I don't understand all the consequences and hesitate to change values in addons authored by others, but you might

Re: [Jprogramming] viewmat image dimensions

2017-12-31 Thread Cliff Reiter
This may not be a good choice as I don't understand all the consequences and hesitate to change values in addons authored by others, but you might try: MINWH_jviewmat_=:1000 1000 or a variant suited to your device and data. On 12/31/2017 12:17 PM, Dabrowski, Andrew John wrote: I'm looking

Re: [Jprogramming] and, or evaluation order

2017-11-07 Thread Cliff Reiter
From https://en.wikipedia.org/wiki/Short-circuit_evaluation is the following paragraph [some special symbols don't jive with a remark, but the other remarks are the point I want to highlight]: The use of short-circuit operators has been criticized as problematic:     The conditional

Re: [Jprogramming] 2D & 3D Point Plots

2017-10-29 Thread Cliff Reiter
Two possible leads (without chasing the old threads): (1) fvj4/dwin.ijs or chapter 10 in FVJ4 load '~addons/graphics/fvj4/dwin.ijs' There is a FVJ4 dwin lab and some examples in remarks at the end of the script. Not 3D point sets, but they might be added small polygons used instead. Some simple

Re: [Jprogramming] reminded of an old puzzle

2017-10-16 Thread Cliff Reiter
Does the following help parse the rank applications a ;"0 1"1"1 2 b +-+-+ |2|1 1 1| +-+-+ |3|1 1 1| +-+-+ +-+-+ |2|1 2 1| +-+-+ |3|1 2 1| +-+-+ +-+-+ |2|1 1 1| +-+-+ |3|1 1 1| +-+-+ +-+-+ |5|1 1 1| +-+-+ |7|1 1 1| +-+-+ +-+-+ |5|1 2 1|

Re: [Jprogramming] reminded of an old puzzle

2017-10-15 Thread Cliff Reiter
I think kr=: [: ,./^:2 */ is what (or close to it) we came up with then. My retest 18 years later wasn't so good :). kr=:[:,./ [: ,/"_1 */ I like the expressiveness of Roger's *"0 2 Thanks for the interesting ideas and solutions. Cheers, Cliff On 10/14/2017 12:36 PM, Roger Hui wrote:

[Jprogramming] reminded of an old puzzle

2017-10-14 Thread Cliff Reiter
The idea is to write a verb which gives the Kronecker product. https://en.wikipedia.org/wiki/Kronecker_product For example: ]a=:2 2$2 3 5 7 2 3 5 7 ]b=:1+4=i.3 3 1 1 1 1 2 1 1 1 1 a kr b 2 2 2 3 3 3 2 4 2 3 6 3 2 2 2 3 3 3 5 5 5 7 7 7 5 10 5 7 14 7 5 5 5 7 7 7 Note each entry

Re: [Jprogramming] Quora Digits Problem

2017-10-04 Thread Cliff Reiter
2 { 1 2 3 3 This was a revelation: {2#<'123' ┌──┬──┬──┐ │11│12│13│ ├──┼──┼──┤ │21│22│23│ ├──┼──┼──┤ │31│32│33│ └──┴──┴──┘ ​Skip​ Skip Cave Cave Consulting LLC On Tue, Oct 3, 2017 at 10:21 PM, Cliff Reiter <reit...@lafayette.edu> wrote: A cheat (?) that builds instea

Re: [Jprogramming] Quora Digits Problem

2017-10-03 Thread Cliff Reiter
A cheat (?) that builds instead of "removing" z=.,".>{4#<'123456' $z 1296 10{.z 1112 1113 1114 1115 1116 1121 1122 1123 1124 On 10/3/2017 4:16 PM, Skip Cave wrote: Another interesting Quora problem: Given the integers from 1000 to , remove all integers that contain a 7, 8,

Re: [Jprogramming] JHS update

2017-03-13 Thread Cliff Reiter
j64-8.05 If you have downloaded all the addons, try: load '~addons/debug/dissect/dissect.ijs' On 3/12/2017 1:27 PM, Linda A Alvord wrote: Bill, I have avoided trying the beta until I know what I can and cannot do in 805 and j64-805 Load 'dissect' is still not ok in 805 Linda

Re: [Jprogramming] Explicit fib

2017-02-28 Thread Cliff Reiter
Linda, I think something you wrote or sent me a couple years ago inspired me to write a Vector note on Fibonacci spirals: http://archive.vector.org.uk/art10501110 A bit involved for grade 4 or 5 though. Best, Cliff On 2/28/2017 10:01 AM, Linda A Alvord wrote: Cliff, I'm never quite sure where

Re: [Jprogramming] Explicit fib

2017-02-27 Thread Cliff Reiter
' ',"1 ":,.>:i.y),"1 '),'' |domain error: fib2 | {.W^:y 0 1 It doesn't like the fact that that the fib2 should still be just letters. It was fun anyway. Linda -Original Message- From: Programming [mailto:programming-boun...@forums.jsoftware.com]

Re: [Jprogramming] Explicit fib

2017-02-26 Thread Cliff Reiter
Here are a couple approaches: First, make a list, then take the last thing in it. fib_list=:3 : 0 z=.0 1 for. i.y-1 do. z=.z,+/_2{. z end. if. y>0 do. z else. 0 end. NB. this only used to make fib_list 0 correct ) fib_list 10 0 1 1 2 3 5 8 13 21 34 55 fib=:{:@fib_list fib 10 55

[Jprogramming] FVJ4 Part 2

2017-02-07 Thread Cliff Reiter
Hi, The second part of my text, Fractals, Visualization and J, 4^th edition, Part 2, is now available from lulu.com. It was tested under JQT 8.04 and/or 8.05. It is available both in print and as a PDF. Note: updates to ~addons/graphics/fvj4 and ~addons/media/imagekit used by this book were

Re: [Jprogramming] u} vs m}

2016-12-28 Thread Cliff Reiter
A long, long, time ago in a J far away, indexing was done in i. order. So indices to a 3 by 2 array would be given by i.3 2 0 1 2 3 4 5 Is it possible that x u}y is an artifact from that era? On 12/27/2016 3:06 PM, Don Guinn wrote: Just played with the original expression a little

Re: [Jprogramming] Fractals, Visualization and J, Fourth edition, Part 1

2016-03-02 Thread Cliff Reiter
Feel free. My attention is on Part 2. On 3/1/2016 1:22 PM, Raul Miller wrote: Someone created a couple rosettacode pages: http://rosettacode.org/wiki/Barnsley_fern and https://en.wikipedia.org/wiki/Chaos_game which correspond roughly to sections 4.4 and 4.5 of your book. Do you feel like

Re: [Jprogramming] Fractals, Visualization and J, Fourth edition, Part 1

2016-02-29 Thread Cliff Reiter
regularly does 25%-off offers, which covers the shipping). [Disclaimer: reviewer has bought his own copy.] On Fri, Feb 26, 2016 at 12:07 PM, Cliff Reiter <reit...@lafayette.edu> wrote: I posted this in Jchat, but was encouraged to also post here. Apologies for the overlap. Hello fell

[Jprogramming] Fractals, Visualization and J, Fourth edition, Part 1

2016-02-26 Thread Cliff Reiter
I posted this in Jchat, but was encouraged to also post here. Apologies for the overlap. Hello fellow Jer's, I have released print and PDF versions of Fractals, Visualization and J, Fourth edition, Part 1 at lulu.com. Compared to the 3rd edition, there are several new sections, fairly

Re: [Jprogramming] Am I understanding m/y ? Expected and not

2016-02-23 Thread Cliff Reiter
, Cliff Reiter <reit...@lafayette.edu> wrote: I think the first time I saw gerund insert, Ken Iverson showed off +`%/10# 1x 13r8 getting Fibonacci approximations to the Golden ratio, so I always expected it to be "from the front". Seeing this thread, I decided to exper

Re: [Jprogramming] Am I understanding m/y ? Expected and not

2016-02-23 Thread Cliff Reiter
I think the first time I saw gerund insert, Ken Iverson showed off +`%/10# 1x 13r8 getting Fibonacci approximations to the Golden ratio, so I always expected it to be "from the front". Seeing this thread, I decided to experiment but forgot to "insert" and got something unexpected:

Re: [Jprogramming] Adding to J distribution - addons code additions and changes

2016-01-19 Thread Cliff Reiter
Devon, I have done much the same thing in preparation for Fractals, Visualization and J, 4th ed., Part 1, which I hope is soon. My addons media/image_kit and graphics/fvj4 really could also be posted. I control the default jpeg quality with a global (now 90) as in the old image3. Advice on

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Cliff Reiter
Nice work. I believe the smoothing that you see is due to the max bound on the number of iterations (24). But as you raise that, things slow down. On 1/2/2016 9:11 PM, Michal Wallace wrote: Hey all. Happy new year! I made a small GUI app for a tutorial video I'm planning:

[Jprogramming] ? jbrowser

2015-08-08 Thread Cliff Reiter
In J6.02 there was a script '~system/extras/util/browser.ijs' that defined launch_jbrowser_ Is there anything analogous in J8.03 (or 8.04) -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] isidraw and glpixels

2015-04-26 Thread Cliff Reiter
. ) nx_WIN=:3 : 0 try. WIN_num=: WIN_num + 1 catch. WIN_num=: 0 end. WIN_nam=:'p',: WIN_num ) delay=:6!:3 WIN_WH=:500 500 sq=:#: 0 1 3 2 _2 _2 2 2 0.1 dawin 'rot' rot=:(cos,sin),:-@sin,cos R=:(rot 1r40p1)(+/ . *)1 $pl=:R^:(i.120) sq 0 255 0 dapoly pl On 4/26/2015 6:47 PM, Cliff Reiter

Re: [Jprogramming] isidraw and glpixels

2015-04-26 Thread Cliff Reiter
The wd 'msgs' solved both problems in both contexts. Thanks, Cliff On 4/26/2015 7:03 PM, bill lam wrote: you are running a tight loop. add wd'msgs' before the line delay DELAY On Apr 27, 2015 6:52 AM, Cliff Reiter reit...@lafayette.edu wrote: You need some access to gl2.ijs too

Re: [Jprogramming] isidraw and glpixels

2015-04-26 Thread Cliff Reiter
nx_WIN=:3 : 0 try. WIN_num=: WIN_num + 1 catch. WIN_num=: 0 end. WIN_nam=:'p',: WIN_num ) On 4/26/2015 5:54 PM, Raul Miller wrote: I get a value error on nx_WIN Thanks, -- For information about J forums see

Re: [Jprogramming] isidraw and glpixels

2015-04-26 Thread Cliff Reiter
An object animation example follows some remarks. I may have found the answer to my question. That short script has the correct behavior so long as the last line is run in the script and not loaded. If loaded, the same problem occurs. In the rast case I am trying to open and update the window

Re: [Jprogramming] Fwd: Hello all!

2015-02-17 Thread Cliff Reiter
Infinity is a float. 3!:0]_ 8 Extended precision arithmetic does not promote to float, so rather than reaching infinity, it reaches a limit error. At least that is how think about it. Best, Cliff On 2/17/2015 2:23 PM, Fausto Saporito wrote: Hello, yes the number is very big, but why

Re: [Jprogramming] gl2 and graphics

2015-02-09 Thread Cliff Reiter
Yes, thank you. On 2/8/2015 4:11 PM, Henry Rich wrote: Maybe you want an isidraw control rather than an isigraph. Henry Rich On 2/8/2015 3:59 PM, Cliff Reiter wrote: I have working with gl2 and the graphics package to try to understand how to update a isigraph window in J8.03 (windows

[Jprogramming] gl2 and graphics

2015-02-08 Thread Cliff Reiter
I have working with gl2 and the graphics package to try to understand how to update a isigraph window in J8.03 (windows). The gl2 demos seems to put all the data in the paint event and it would be nice if the data could be created after the window. In the graph package lab, examples where this

Re: [Jprogramming] A parsing challenge

2015-01-26 Thread Cliff Reiter
Lovely. Tiny remark: -.@+. could be replaced by +: On 1/26/2015 1:00 AM, Raul Miller wrote: A note of explanation... (I have been noticing that far too much software is poorly documented. And while I cannot do an adequate job of documenting other people's software, I can document software I

Re: [Jprogramming] count of consecutive 1s

2014-10-23 Thread Cliff Reiter
Lovely On 10/22/2014 10:44 PM, Marshall Lochbaum wrote: Everything is reduce! ([*+)/\..|. 1 0 1 1 1 1 0 1 1 0 1 2 3 4 0 1 Marshall On Wed, Oct 22, 2014 at 01:10:34PM -0400, Joe Bogner wrote: This is probably easy but I can't figure it out. How can I count the number of consecutive 1s?

Re: [Jprogramming] Splitting vector

2014-10-09 Thread Cliff Reiter
And there is key (]/.~2|i.@#)i.8 0 2 4 6 1 3 5 7 which handles the odd case with an easy variant (/.~2|i.@#)i.9 ┌─┬───┐ │0 2 4 6 8│1 3 5 7│ └─┴───┘ On 10/9/2014 7:20 PM, Raul Miller wrote: I'd probably go with i. 8 0 1 2 3 4 5 6 7 |:_2]\ i.8 0 2 4 6 1 3 5 7 But

Re: [Jprogramming] a zoom function (doubling points accross rows and columns)

2014-07-17 Thread Cliff Reiter
Nice. In FVJ3 I use spix=:[ # #_1 NB. super pixel The _1 means this also works for h by w by 3 arrays of RGB triples in addition to matrices. Best, Cliff On 7/16/2014 6:32 PM, 'Pascal Jasmin' via Programming wrote: spoiling quiz with answer already, neat short fork. zoom =: [ # #1 for

Re: [Jprogramming] Float to integer testing and conversion

2014-06-09 Thread Cliff Reiter
I wrote a note Prime Factorization in the Gaussian Integers, /Journal of J/, 2 1 (2013) 4- that might be of interest. The scripts from that note are https://webbox.lafayette.edu/~reiterc/j/JoJ/gi_factor_notes.html https://webbox.lafayette.edu/~reiterc/j/JoJ/gi_factor.html Best, Cliff On

Re: [Jprogramming] Identifying roots of unity

2014-06-02 Thread Cliff Reiter
In light of the link provided by R.E.Boss and x: on complex numbers x: 1j1 |domain error | x:1j1 |[-0] We might define rational query as occurring when the denominator of the rationalization is small and not an error ratq=:(1e8{:@:(2x:)) :: 0:0 ratq ?10$0 0 0 0 0 0 0 0 0 0 0

Re: [Jprogramming] Identifying roots of unity

2014-06-02 Thread Cliff Reiter
? y=:13 ((ruq i:y)-:((1=i:y)+.(_1=i:y))) 1 y=:14 ((ruq i:y)-:((1=i:y)+.(_1=i:y))) 1 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Cliff Reiter Sent: Monday, June 02, 2014 9:17 PM

Re: [Jprogramming] math requests

2014-01-31 Thread Cliff Reiter
Pascal, For my implementation, look at p129 in the first link for conversion from (x,y) to (x,y,z). Note, the (corrected) script from my notes are available http://webbox.lafayette.edu/~reiterc/j/vector/factor_ecj.html but using x. y. era notation and lots of x y local variable so updating to

Re: [Jprogramming] math requests

2014-01-29 Thread Cliff Reiter
Some elliptic curve stuff; I think there is a +1 error that Roger Hui noticed in the factorization method. http://archive.vector.org.uk/art10007270 http://archive.vector.org.uk/art10007280 Best, Cliff On 1/29/2014 11:35 AM, Pascal Jasmin wrote: With all of the mathematicians on this list,

Re: [Jprogramming] math requests

2014-01-29 Thread Cliff Reiter
For modular inverses in teaching I use gcd2x=: 3 : 0 'r0 r1'=.y 's0 s1'=.1 0 't0 t1'=.0 1 while. r1 ~: 0 do. q=. . r0 % r1 'r0 r1'=. r1,r0-q*r1 's0 s1'=. s1,s0-q*s1 't0 t1'=. t1,t0-q*t1 end. r0,s0,t0 ) invmod=: 4 : 'y| {: gcd2x y,x' 5 invmod 21 17 21|5*17 1 Best, Cliff On

Re: [Jprogramming] splitting 24 bit bmp data

2013-09-05 Thread Cliff Reiter
David, You probably want 256 256 256 256#: and then to figure out which of the 4 coordinates you want. Are you using windows? I have a image io script that does basic read_image and write_image analogous to image3 for 64bit windows. Not as complete as image3 and I view some things as

Re: [Jprogramming] Clean

2013-05-27 Thread Cliff Reiter
Is there a reason to prefer (*|@*) over (**|)? ts=:6!:2 , 7!:2@] 1000 ts'(* |@*).+. ^ 0j1 * 1r2p1 * i. 500' 0.00106239 43200 1000 ts'(**|).+. ^ 0j1 * 1r2p1 * i. 500' 0.000791911 43072 Best, Cliff On 5/27/2013 1:34 AM, km wrote: I didn't think of Signum! Thanks, Roger. Sent from my