Challenge: devise a verb ratio so that if
data1 =: ((,-)2j1) ,: _1^(%~i:)60
data2 =: _1^(%~i:)60
then
ratio data1
0.5
ratio data2
1
i.e., if data is complex plot data and r is the result of ratio data then
circles in
'aspect r' plot data
appear circular.
--Kip Murray
Sent from my iPad
> On Sep 21, 2013, at 4:08 AM, km <[email protected]> wrote:
>
> Try
>
> 'aspect 0.5' plot ((,-)2j1) ,: _1^(%~i:)60
>
> and
>
> 'aspect 1' plot _1^(%~i:)60
>
> --Kip Murray
>
> Sent from my iPad
>
>> On Sep 21, 2013, at 3:15 AM, Bo Jacoby <[email protected]> wrote:
>>
>> 'aspect 1' plot ((,-)2j1) ,: _1^(%~i:)60 NB. This makes the frame of the
>> plot square, but it has different units on the two axes, so the circle is
>> deformed. How do I make the circle circular?
>> plot ((,-)2j1),:_1^(%~i:)60 NB. This is different, but not correct either.
>>
>>
>>> ________________________________
>>> Fra: Linda Alvord <[email protected]>
>>> Til: [email protected]
>>> Sendt: 3:39 lørdag den 21. september 2013
>>> Emne: Re: [Jprogramming] Plotting complex lists
>>>
>>>
>>> Square isn't so square either. Linda (Yet again, life is a series of
>>> approximations.)
>>>
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of Bo Jacoby
>>> Sent: Wednesday, September 18, 2013 9:52 PM
>>> To: [email protected]
>>> Subject: Re: [Jprogramming] Plotting complex lists
>>>
>>> Thanks Linda! The 'aspect 1' makes the plot square. Do you know how to make
>>> circles circular?
>>>
>>>
>>>> ________________________________
>>>> Fra: Linda Alvord <[email protected]>
>>>> Til: [email protected]
>>>> Sendt: 2:48 torsdag den 19. september 2013
>>>> Emne: Re: [Jprogramming] Plotting complex lists
>>>>
>>>>
>>>> Try replacing the last line with:
>>>>
>>>> 'aspect 1' plot circle,ellipse,:hyperbola
>>>>
>>>> Linda
>>>>
>>>> -----Original Message-----
>>>> From: [email protected]
>>>> [mailto:[email protected]] On Behalf Of Bo
>>>> Jacoby
>>>> Sent: Tuesday, September 17, 2013 12:00 PM
>>>> To: [email protected]
>>>> Subject: Re: [Jprogramming] Plotting complex lists
>>>>
>>>> One benefit of using complex numbers is that you may forget about
>>>> trigonometry.
>>>>
>>>> load'plot'
>>>> circle=._1^n=.(%~i:)60
>>>> ellipse=.(circle*-.a)+(+circle)*a=.0.8
>>>> hyperbola=.-:((+%)j.(-%))^n
>>>> plot circle,ellipse,:hyperbola
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> ________________________________
>>>>> Fra: km <[email protected]>
>>>>> Til: "[email protected]" <[email protected]>
>>>>> Sendt: 0:40 tirsdag den 17. september 2013
>>>>> Emne: Re: [Jprogramming] Plotting complex lists
>>>>>
>>>>>
>>>>> Summary of results. The strategy of hyperbola below (plotting a
>>>>> complex
>>>> table) is not well known. Henry Rich found it and reported it.
>>>>>
>>>>> Bo Jacoby gave the best way to change the sign of the real part of a
>>>> complex number.
>>>>> Simply do [: + - .
>>>>>
>>>>>
>>>>>
>>>>> NB. Complex Analytic Geometry
>>>>>
>>>>>
>>>>> NB. How to calculate complex number lists and tables for NB. plotting
>>>>> lines, circles, ellipses, and hyperbolas. How to NB. modify these
>>>>> tables to achieve translations, rotations, NB. and reflections. Begin
>>>>> with preliminaries:
>>>>>
>>>>>
>>>>> steps =: {.@] + -~/@] * [ %~ [: i. >:@[
>>>>>
>>>>> NB. n steps a,b produces n+1 equally spaced values from a to b
>>>>>
>>>>> to =: 512 steps , NB. Usage a to b for 512 steps from a to b
>>>>>
>>>>> sin =: 1&o.
>>>>>
>>>>> cos =: 2&o.
>>>>>
>>>>> sinh =: 5&o.
>>>>>
>>>>> cosh =: 6&o.
>>>>>
>>>>> arcsinh =: _5&o.
>>>>>
>>>>>
>>>>> NB. Now, results
>>>>>
>>>>>
>>>>> line =: 2 : 'm + (n-m)*]'
>>>>>
>>>>> NB. A line B [ t is point "t of the way from A to B". Command NB.
>>>>> NB. plot 0 line 1j1 [ _1 to 2
>>>>> NB.
>>>>> NB. shows the line segment from _1j_1 to 2j2
>>>>>
>>>>> NB. You are plotting a list of 513 complex numbers.
>>>>>
>>>>>
>>>>> parabola =: 1 : '] j. (1 % 4 * m) * *:'
>>>>>
>>>>> NB. p parabola x produces point x j. y on parabola NB. (*: x) = 4*p*y
>>>>> . Command NB.
>>>>> NB. plot 1r4 parabola _2 to 2
>>>>> NB.
>>>>> NB. plots parabola y = *: x for x from _2 to 2
>>>>>
>>>>> NB. You are plotting a list of 513 complex numbers.
>>>>>
>>>>>
>>>>> ellipse =: 2 : '((m * cos) j. n * sin) 0 to 2p1'
>>>>>
>>>>> NB. Suggested by Henry Rich
>>>>>
>>>>> NB. Command
>>>>> NB.
>>>>> NB. plot a ellipse b
>>>>> NB.
>>>>> NB. plots the ellipse 1 = (*: x % a) + *: y % b .
>>>>>
>>>>> NB. If a = b you get the circle (*: x) + (*: y) = *: a
>>>>>
>>>>>
>>>>> hyperbola =: 2 : '[: (,: +) (n * sinh) j. m * cosh'
>>>>>
>>>>> NB. Suggested by Henry Rich
>>>>>
>>>>> toh =: [: to/ [: arcsinh %~
>>>>>
>>>>> NB. b toh c,d is (arcsinh c%b) to (arcsinh d%b)
>>>>>
>>>>> NB. Command
>>>>> NB.
>>>>> NB. plot a hyperbola b [ b toh c,d
>>>>> NB.
>>>>> NB. plots y^2/a^2 - x^2/b^2 = 1 for x from c to d.
>>>>>
>>>>> NB. Remember the pattern b [ b toh c,d
>>>>>
>>>>> NB. You are plotting rows of a 2 by 513 table to get the two NB.
>>>>> branches of the hyperbola.
>>>>>
>>>>>
>>>>> NB. Rotations, translations, and reflections
>>>>>
>>>>> NB. Multiply a complex number list or table by (^&j. theta) NB. to
>>>>> rotate all of its points by theta radians. The center NB. of rotation
>>>>> is the origin 0 = 0j0 .
>>>>>
>>>>> NB. Add 5j3 to a complex list or table to move all of its points NB.
>>>>> the distance and direction of 5j3 from 0j0.
>>>>>
>>>>> NB. Use (+ list) or (+ table) (monadic + is conjugate) to NB. reflect
>>>>> all the points of the list or table across the NB. line through 0j0
>>>>> and
>>>>> 1j0 -- the x-axis. Afterwards NB. multiply by (^&j. theta) to achieve
>>>>> a reflection across NB. the line through 0j0 and (^&j. theta).
>>>>>
>>>>> NB. Multiply a positive number p times a list or table to NB. achieve
>>>>> an expansion from 0 or compression toward 0 NB. according as p > 1
>>>>> or p < 1 .
>>>>>
>>>>> NB. If you want to combine several operations do the NB. reflection
>>>>> first and the translation last.
>>>>>
>>>>> NB. Example
>>>>> NB.
>>>>> NB. plot (^&j. theta) * p parabola _2 to 3 NB.
>>>>> NB. plots a parabola rotated by theta radians, with 0j0 NB. the center
>>>>> of rotation. If theta is _1r2p1 (that is NB. - pi%2 radians) you have
>>>>> converted a (*: x) = 4 * p * y NB. parabola into a (*: y) = 4 * p *
>>>>> x parabola.
>>>>>
>>>>>
>>>>> --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
>>>>
>>>>
>>> ----------------------------------------------------------------------
>>> 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