Very cool, Henry! You can also use
ellipse2 =: [: j./ ((cos ,: sin) 0 to 2p1) * ,
An advantage of complex number plots is they are easy to rotate and translate.
Try
plot (^&j. _1r4p1) * 2 ellipse 1 NB. rotates -45 degrees
--Kip Murray
Sent from my iPad
On Sep 14, 2013, at 12:04 PM, Henry Rich <[email protected]> wrote:
> Verb rather than conjunction:
>
> ellipse =: [: +.^:_1 ((cos ,. sin) 0 to 2p1) *"1 ,
>
> If you just want to plot, you can leave the real/imaginary separate:
>
> ellipse2 =: ((cos ; sin) 0 to 2p1) *&.> ,
>
> Henry Rich
>
> On 9/13/2013 6:22 PM, km wrote:
>> You can plot a complex list.
>>
>> Try
>>
>> L =: _1j1 0 1j1
>>
>> and
>>
>> plot L
>>
>> plot 0j1 + L
>>
>> plot 0j1 * L
>>
>> (It is easy to translate and rotate a plot defined by a complex list.)
>>
>>
>> Challenge: devise a conjunction ellipse that produces a complex list for
>> plotting the ellipse
>>
>> 1 = (*: x % a) + (*: y % b) NB. In algebra x^2/a^2 + y^2/b^2 = 1
>>
>> The command
>>
>> plot a ellipse b
>>
>> should produce a plot of the above ellipse.
>>
>>
>> Easier: devise an adverb parabola that produces complex numbers for plotting
>> the parabola
>>
>> (*: x) = 4 * p * y
>>
>> You want the command
>>
>> plot p parabola c to d
>>
>> to plot the above parabola for x in the interval from c to d.
>>
>>
>> Here is verb "to"
>>
>> to =: [ + -~ * 1r512 * [: i. 513"_
>>
>> NB. c to d produces 513 equally spaced values from (real) c to d
>>
>>
>> Above tested on my iPad
>>
>> IFIPAD
>> 1
>> VERSION
>> 1.3 5
>>
>>
>> --Kip Murray
>>
>> Sent from my iPad
>>
>> ----------------------------------------------------------------------
>> 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