I tried changing the penstyle to see if Plot would give me a dotted line. 'penstyle 0;pensize 5' plot 1 o. 8%~i:49
gives a continuouse line and I was hoping that penstyle 2 would give me a dotted line. I reran the above line with penstyle 2 and J crashed. I'm still trying to figure out why. In the Plot demos there are dotted lines. Graham > Date: Thu, 27 Dec 2007 11:05:51 -0500 > From: "Devon McCormick" <[EMAIL PROTECTED]> > Subject: [Jprogramming] Evening output > To: "J-programming forum" <[email protected]> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=UTF-8 > > Members of the Forum: > > If I plot the points of a sine curve thusly > > 'type point;pensize 5' plot 1 o. 8%~i:49 > > I get a nice graph but, due the nature of the sine function, > points near the inflection points are more closely spaced > than those further away. How can I adjust my input points to > get more evenly-spaced (for simplicity, on the > X-axis) outputs? I'd like a method I could use for any > arbitrary function. > > Here's a simple attempt wherein I try to remove the point > closest to the one before it and insert a point midway > between the two most widely separated > points: > > NB.* evenOut: adjust inputs to fnc so outputs more evenly spaced. > evenOut=: 1 : 0 > diffs=. |2-~/\u y > 'whi wlo'=. diffs i. (>./,<./)diffs > wlo=. wlo-wlo=<:#y NB. Don't remove endpoint > y=. (0 (>:whi)}1$~>:#y)#^:_1 y > y=. (u -:+/y{~whi+0 2) (>:whi)}y > y=. (<<<>:wlo){y > ) > > evenOut_test_=: 3 : 0 > tsts=. 0 1 10,0 10 11,:0 5 10 > assert. (] evenOut"1 tsts)-:(5.5 5 5) 1}&.|:tsts > ) > > If I could get a satisfactory version of this two-point > substituter, it might work to apply it repeatedly until the > point differences stabilize. I'm satisfied with the result > for these simple test cases: > > ]tsts=. 0 1 10,0 10 11,:0 5 10 > 0 1 10 > 0 10 11 > 0 5 10 > ] evenOut"1 tsts > 0 5.5 10 > 0 5 11 > 0 5 10 > > (Testing with verb "]" for simplicity). However, this result > > ] evenOut 0 2 4 5 > 0 1 2 5 > > isn't as good; a result like "0 2 3 > 5" might be better in this case. We could define a measure > of evenness: > > msrEveness=: 13 : '%:+/*:2-/\|2-/\y' > > to quantify this preference (where a lower measure is > better). This shows us that of the three possibilities, > > msrEveness ] evenOut 0 2 4 5 > 2 > msrEveness 0 2 4 5 > 1 > msrEveness 0 2 3 5 > 1.4142136 > > the initial arrangement is best. An arrangement like this > > msrEveness 0 5r3 10r3 5 > 0 > > is optimal in this case (we want to retain the endpoints unchanged). > > Any ideas on how to approach this? > > > > > > > > -- > Devon McCormick, CFA > ^me^ at acm. > org is my > preferred e-mail > > > ------------------------------ > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > End of Programming Digest, Vol 27, Issue 57 > ******************************************* > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
