That's a good point. I do not actually need a slope on my horizontal lines. I just need them to have at least one point that are not on the x axis: So this works:
require'plot' pd 'reset' pd j./1 2 o./o.0.001*i.2002 pd (0.001*i:2002)*j./2 1 o. 22.5%180p_1 pd (_1.6+0.001*i.100)j.0.6-0.001*i.100 pd (_1.6+0.001*i.100)j.0.4+0.001*i.100 pd (_2+0.001*i.500)j.0.5 pd (_1.6+0.001*i.100)j.0.1-0.001*i.100 pd (_1.6+0.001*i.100)j._0.1+0.001*i.100 pd (_2+0.001*i.500)j.1e_12 pd (_1.6+0.001*i.100)j._0.4-0.001*i.100 pd (_1.6+0.001*i.100)j._0.6+0.001*i.100 pd (_2+0.001*i.500)j._0.5 pd 'show' And I could replace pd (_2+0.001*i.500)j.1e_12 with pd (_2+0.001*i.500)j.(499#0),1e_12 if I really wanted. Thanks, -- Raul On Sun, May 11, 2014 at 12:03 PM, robert therriault <[email protected]> wrote: > I think that is probably right Ian, > > 5j0 produces an integer result of 5 whereas 5j000.1 is a complex result. > > You can force the whole array to revert to complex by appending a complex > number so: > > _2j.1,(_2+0.001*i.500)j.0 > > would produce a vector of complex. > > As I just discovered as i played with it, you can then drop the first element > and the list remains complex in JHS [1] > > }. _2j.1,(_2+0.001*i.500)j.0 > > Cheers, bob > > [1] Shameless self promotion that I used my shapes and types tool in JHS to > play around with this > http://bobtherriault.wordpress.com/2014/02/14/an-update-on-display-shapes-and-types-on-jhs/ > > > On May 11, 2014, at 7:44 AM, Ian Clark <[email protected]> wrote: > >> Is this a reappearance of the issue first discussed here? ... >> http://www.jsoftware.com/pipermail/programming/2011-July/023384.html >> >> Except maybe in reverse: whereas the problem back then was (logically) real >> data accidentally becoming complex, perhaps your horizontal arrow is >> (logically) complex data that has accidentally become real? >> >> Just guessing... haven't had time to try your example out and verify my >> conjecture. But I would guess Bill has put his finger on the spot that >> hurts. >> >> >> On Sun, May 11, 2014 at 5:56 AM, Raul Miller <[email protected]> wrote: >> >>> The tropic of cancer is the farthest north you can be and still have >>> the sun be directly overhead at some time during the year (in the >>> middle of northern hemisphere summer). This is approximately 22.5 >>> degrees latitude. See also: >>> >>> http://www.geog.ucsb.edu/~joel/g110_w08/lecture_notes/sun_angle/sun_angle.html >>> for a lot more detail on this and related issues. >>> >>> This is relevant, for example, when building a home. Depending on the >>> latitude and the time of the year, the noon sun will range from >>> 90-latitude+22.5 to 90-latitude-22.5 degree. This means that if you >>> build your house right (with south facing insulated glass and the >>> right kind of south facing roof overhang) you can have solar heat in >>> the winter while mostly getting shade in the summer. >>> >>> (Deciduous trees can achieve similar effects. And, of course, not >>> everyone is in a position to have trees, nor is everyone in a position >>> to build a house. And there are other issues to consider. But there's >>> only so much material I'm going to cover in one email message.) >>> >>> So let's draw a picture of this. >>> >>> require 'plot' >>> plot j./1 2 o./o.0.001*i.2002 >>> >>> Note that I'm using j./ to get a parametric curve. and the numbers >>> give me a range from 0 to approximately 2*pi. Also, of course 1 o. is >>> sine and 2 o. is cosine (since sine is an odd function and cosine is >>> an even function. See: >>> https://en.wikipedia.org/wiki/Even_and_odd_functions) >>> >>> That plot supposed to be a circle, representing the earth. You'll have >>> to manually adjust the size of the window so that my circle is >>> circular. >>> >>> Now, let's draw in the angle of the equator. >>> >>> require'plot' >>> pd 'reset' >>> pd j./1 2 o./o.0.001*i.2002 >>> pd (0.001*i:2002)*j./2 1 o. 22.5%180p_1 >>> pd 'show' >>> >>> You'll have to make my circle be circular again. >>> >>> Also, %180p_1 converts from degrees (the typical treatment for >>> latitude) to radians (the math used by plot). >>> >>> You can imagine the sun being off to one side, and light coming in >>> horizontally. In fact, it might be nice to draw some arrows. >>> >>> So, how do I draw horizontal lines? >>> >>> A horizontal line has y=0 and x ranging over the range of values we >>> want to display. This is a bit odd to think about because plot is >>> sensitive to data type in a non-mathematical fashion. But before I can >>> show what that means, I've a bug to report: >>> >>> require'plot' >>> pd 'reset' >>> pd j./1 2 o./o.0.001*i.2002 >>> pd (0.001*i:2002)*j./2 1 o. 22.5%180p_1 >>> pd (_1.6+0.001*i.100)j.0.1-0.001*i.100 >>> pd (_1.6+0.001*i.100)j._0.1+0.001*i.100 >>> pd (_2+0.001*i.500)j.0 >>> pd 'show' >>> >>> That last line gives me a domain error in J6, and silently does >>> nothing in J8. It's supposed to be a horizontal line - I'm trying to >>> draw an arrow. But for whatever reason that fails. (This is where >>> someone is supposed to loudly assert how wonderful data types are >>> because of how they make things fail. And, in fact, those failure >>> modes can be put to good use. But they are not exactly a universal >>> good.) >>> >>> The workaround is to make the line be not quite horizontal (but not so >>> much that it's visible. For example: >>> >>> require'plot' >>> pd 'reset' >>> pd j./1 2 o./o.0.001*i.2002 >>> pd (0.001*i:2002)*j./2 1 o. 22.5%180p_1 >>> pd (_1.6+0.001*i.100)j.0.1-0.001*i.100 >>> pd (_1.6+0.001*i.100)j._0.1+0.001*i.100 >>> pd (_2+0.001*i.500)j.1e_12*i.500 >>> pd 'show' >>> >>> Actually, it might be nice to have several arrows: >>> >>> require'plot' >>> pd 'reset' >>> pd j./1 2 o./o.0.001*i.2002 >>> pd (0.001*i:2002)*j./2 1 o. 22.5%180p_1 >>> pd (_1.6+0.001*i.100)j.0.6-0.001*i.100 >>> pd (_1.6+0.001*i.100)j.0.4+0.001*i.100 >>> pd (_2+0.001*i.500)j.0.5+1e_12*i.500 >>> pd (_1.6+0.001*i.100)j.0.1-0.001*i.100 >>> pd (_1.6+0.001*i.100)j._0.1+0.001*i.100 >>> pd (_2+0.001*i.500)j.1e_12*i.500 >>> pd (_1.6+0.001*i.100)j._0.4-0.001*i.100 >>> pd (_1.6+0.001*i.100)j._0.6+0.001*i.100 >>> pd (_2+0.001*i.500)j._0.5+1e_12*i.500 >>> pd 'show' >>> >>> Or maybe that's getting to be too much? >>> >>> Anyways... to take this further, I should probably pick a latitude and >>> draw a side view of a house and draw in the noon-time extreme sun >>> angles for winter and summer (along with the more typical >>> autumn/spring sun angles). And then maybe do some architectural >>> drawings. But this is probably enough for one message. >>> >>> Thanks, >>> >>> -- >>> Raul >>> ---------------------------------------------------------------------- >>> For information about J forums see 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
