Verbs ff , gg , and (gg mab) below represent straight lines.  If one of
them is evaluated at a real number t the result is a point on the
represented line.  I calculated three points on each represented line as a
kind of substitute for graphing the line, and to let you see how the
y-coordinates (imaginary parts) were related to the x-coordinates (real
parts).  For me the "results" are the verbs themselves, not the points
calculated from them!  Here is another example

    hh =: _1j0 1j1 line   NB. line with start _1j0 , direction 1j1
    hh"0 [ 0 1 2   NB. three points on the line
 _1j0 0j1 1j2
    jj =: hh rot 1r4p1 _1j1  NB. rotate line 1r4p1 radians about _1j1
    jj"0 [ _1 0 1  NB.  three points show result is vertical line x = _1 +
%: 0.5
 _0.2928932188j_1.121320344 _0.2928932188j0.2928932188
_0.2928932188j1.707106781

--Kip Murray

On Wednesday, March 9, 2016, Don Kelly <[email protected]> wrote:

> A question- you give you define the line and the center of rotation but
> the results are 3 points on the line. shouldn't the results be shown in
> terms of 2 points on the rotated line?  While usually the line is expressed
> as y=a+bx (a and b real)  which is easy if the the rotation center is on
> the line at x =0.
> new end =. (r.theta) +end  as start is not changed.
> A bigger challenge is to have a rotation center that is not on the
> original line and given points that do not fit the typical y=a+bx
> Example: line ends at  2j3j5 and 3j4  to be rotated about 1j2
> this involves a rotation  of two vectors (1j1 and3j4 )  as seen from 1j2
> about "0"  and then a translation of 1j2
>
> rotheta=:[: +. ([: r. [) * [: +.^:_1 ]
>
> 1j2+ (_1r4p1) rotheta 1j1 2j2
>
> 2.41421j2 3.82843j2                     which is the location of the
> points after rotation
> This can then be put into a y=a+bx form with a =2 and b=1.414..
>
>
> Don
>
>
> On 2/20/2016 2:14 PM, Kip Murray wrote:
>
>> Here after a struggle are my linrot results.
>>
>>     NB. rotate a line in the plane about a point in the plane
>>
>>     NB. here points are complex numbers
>>
>>     NB. below start and direction are complex numbers, could be vectors
>>
>>     NB. (start,direction) line t  is  start + t * direction
>>
>>     line =: 1 : '({. m) + ({: m) * ]'
>>
>>     mab =: 1 : '( (u 0) , (% 9&o.) (u 1) - u 0 ) line' NB. point slope
>> version of u
>>
>>     NB. below u rot (theta,center) rotates results of u by theta radians
>> about the center
>>     NB. it is assumed the results of u and the center are complex numbers
>>
>>     rot =: 2 : '[: r.&({. n)&.(({: n) -~ ]) u'
>>
>>     ff =: 0j1 1j1 line        NB. line starts at 0j1 goes in direction of
>> 1j1
>>
>>     ff"0 [ 0 1 2              NB. Notice y = x + 1
>> 0j1 1j2 2j3
>>
>>     gg =: ff rot _1r4p1 0j1   NB. rotates ff results 45 degees clockwise
>> about 0j1
>>
>>     gg"0 [ 0 1 2              NB. horizontal (y's are all 1)
>> 0j1 1.414213562j1 2.828427125j1
>>
>>     (gg mab)"0 [ 0 1 2.       NB. results x j. y from point slope y = 1 +
>> 0*(x - 0)
>> 0j1 1j1 2j1
>>
>> --Kip
>>
>> On Thursday, February 18, 2016, Louis de Forcrand <[email protected]>
>> wrote:
>>
>> To continue with the rotation challenges, write a verb that rotates a
>>> linear
>>> polynomial (coeffs in x) by 0 {:: y with a centre of 1 {:: y:
>>>
>>>     1 2 linrot 1p1 ; 0 1
>>> 1 2
>>>     1 2 linrot 1r2p1 ; 0 1
>>> 1 _0.5
>>>     1 2 linrot 1p1;1 1
>>> _3 2
>>>
>>> My take:
>>> linrot=: ({: %. 1 ,. {.)@rotposmat
>>>   rotposmat=: centre + j./@posmat |:@:+.@:* r.@angle
>>>    centre=: 1&({::)@]
>>>    posmat=: (] ,: p.)&0 1@[ - centre
>>>    angle=: 0&({::)@]
>>>
>>> It uses matrix division on a rotated set of two points from the original
>>> polynomial. Not very elegant, but I’m pretty sure it works.
>>>
>>> Best regards,
>>> Louis
>>>
>>> On 17 Feb 2016, at 06:40, Kip Murray <[email protected]
>>>>
>>> <javascript:;>> wrote:
>>>
>>>> Not bad.  I didn't know about r.  .  For clean I use
>>>>
>>>> clean =: (* *!.1e_14@|)"0&.+.
>>>>
>>>> --Kip
>>>>
>>>> On Tuesday, February 16, 2016, Raul Miller <[email protected]
>>>>
>>> <javascript:;> <mailto:[email protected] <javascript:;>>> wrote:
>>>
>>>> Well...
>>>>>
>>>>>    rottheta=: (rot~ r.)~
>>>>>    1r2p1 rottheta 3 4
>>>>> _4 3
>>>>>    1r4p1 rottheta _1 1
>>>>> _1.41421 1.11022e_16
>>>>>
>>>>> I remember there being a concise phrase to clean irrelevant bits near
>>>>> zero in a complex number, but I can't remember what I need to search
>>>>> on to find it, and my foggy memory of how to write it is failing me at
>>>>> the moment.
>>>>>
>>>>> Still, this gets you close.
>>>>>
>>>>> --
>>>>> Raul
>>>>>
>>>>>
>>>>> On Tue, Feb 16, 2016 at 11:50 PM, Kip Murray <[email protected]
>>>>>
>>>> <javascript:;>
>>>
>>>> <javascript:;>> wrote:
>>>>>
>>>>>> I'm retired with time to "fool around".  Finding an old rot90 verb
>>>>>> that
>>>>>> used multiplication by a 2 by 2 matrix, I sought a more direct way
>>>>>>
>>>>> using
>>>
>>>> complex numbers and found one of the solutions that was posted.  I also
>>>>>> learned a lot from the other solutions posted, thanks everyone!
>>>>>>
>>>>>> New puzzle: find a complex analysis way to do a rotation given its
>>>>>>
>>>>> angle
>>>
>>>> in
>>>>>
>>>>>> radians, examples:
>>>>>>
>>>>>>     1r2p1 rottheta 3 4
>>>>>> _4 3
>>>>>>
>>>>>>     1r4p1 rottheta _1 1
>>>>>> _1.414213562 0
>>>>>>
>>>>>> --Kip
>>>>>>
>>>>>> I'm also a former math professor!
>>>>>>
>>>>>> On Tuesday, February 16, 2016, David Lambert <[email protected]
>>>>>>
>>>>> <javascript:;>
>>>
>>>> <javascript:;>> wrote:
>>>>>
>>>>>> what's your agenda, are you writing a book? Isn't there a homogeneous
>>>>>>> coordinate system/transformation lab?
>>>>>>>
>>>>>>> On 02/16/2016 06:16 PM, [email protected]
>>>>>>>>
>>>>>>> <javascript:;>
>>>
>>>> <javascript:;> wrote:
>>>>>
>>>>>> Date: Tue, 16 Feb 2016 15:18:43 -0600
>>>>>>>>> From: Kip Murray<[email protected] <javascript:;>
>>>>>>>>>
>>>>>>>> <javascript:;>>
>>>
>>>> To:"[email protected] <javascript:;> <javascript:;>" <
>>>>>>>>>
>>>>>>>> [email protected] <javascript:;> <javascript:;>>
>>>>>
>>>>>> Subject: [Jprogramming] A plane rotation
>>>>>>>>> Message-ID:
>>>>>>>>>     <
>>>>>>>>>
>>>>>>>> caofworgvydb1nmjwxkb0wosyfnlubxcdz20sv11uksfcfay...@mail.gmail.com
>>>>>
>>>> <javascript:;>
>>>
>>>> <javascript:;>>
>>>>>
>>>>>> Content-Type: text/plain; charset=UTF-8
>>>>>>>>>
>>>>>>>>> Fairly easy: write a verb that rotates a point in the plane by the
>>>>>>>>>
>>>>>>>> angle
>>>>>
>>>>>> of
>>>>>>>>> a given complex number.  For example
>>>>>>>>>
>>>>>>>>>      1j1 rot 1 1  NB. Rotate 1 1 counterclockwise 45 degrees
>>>>>>>>>   0 1.414213562
>>>>>>>>>
>>>>>>>>> Background information:  when you multiply two complex numbers the
>>>>>>>>> magnitudes are multiplied and the angles are added.
>>>>>>>>>
>>>>>>>>> --Kip Murray
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see
>>>>>>>
>>>>>> http://www.jsoftware.com/forums.htm
>>>
>>>>
>>>>>>
>>>>>> --
>>>>>> Sent from Gmail Mobile
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see
>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>>>>
>>>>
>>>> --
>>>> Sent from Gmail Mobile
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>> <
>>>>
>>> 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



-- 
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to