I can’t think of any immediate use, other than drawing some (kind of
ugly) polygons.
I amended my linrot to accept several angles at once:
linrot=: ({: %. 1 ,. {.)"2@rotposmat
rotposmat=: centre +"1 2 j./@posmat |:@:+.@:*"1 0 r.@angle
Now you can do for example:
require ‘plot'
plot (1 1 linrot (1r4 + o. 0.5 * i.4) ; 0 0) p."1 1 i:1
and draw a little square :)
Louis
> On 19 Feb 2016, at 08:19, Raul Miller <[email protected]> wrote:
>
> Ah, I see. I was somehow thinking that these were parametric curves.
>
> Thanks,
>
> --
> Raul
>
>
> On Fri, Feb 19, 2016 at 1:16 AM, Kip Murray <[email protected]> wrote:
>> In your example, 0 1 is the polynomial coefficients for the straight line
>> being rotated. In usual math notation this is the line y = x = 0 + 1 x .
>> When you rotate this line by 1p1 radians about the origin 0 0 you get the
>> same straight line, described by 0 1 which is the answer given. (I am
>> "cleaning", of course.)
>>
>> Also when you consider the straight line y = 1 + 2x (described by 1 2) you
>> notice the point 0 1 is on this line so when you rotate this line by 1p1
>> radians about the point 0 1 you get the same line, described by the answer
>> 1 2 .
>>
>> It helps to draw pictures of the indicated straight lines. Hope this helps.
>>
>> --Kip
>>
>> On Thursday, February 18, 2016, Raul Miller <[email protected]> wrote:
>>
>>> Changing the center of rotation to 0 0 doesn't seem to make a difference.
>>>
>>> 0 1 linrot 1p1;0 0
>>> 1.11022e_16 1
>>>
>>> But presumably this means I am not understanding what it means to
>>> "rotate a linear polynomial"?
>>>
>>> --
>>> Raul
>>>
>>> On Thu, Feb 18, 2016 at 11:46 PM, Kip Murray <[email protected]
>>> <javascript:;>> wrote:
>>>> No, because his center of rotation is not 0 0 . In his first two
>>> examples
>>>> the center of rotation is 0 1 and in the third it is 1 1 . --Kip
>>>>
>>>> On Thursday, February 18, 2016, Raul Miller <[email protected]
>>> <javascript:;>> wrote:
>>>>
>>>>> I'm not quite sure I follow what you are doing here.
>>>>>
>>>>> Shouldn't 2p1 be a neutral rotation, with 1p1 being a reversal of
>>>>> direction?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> --
>>>>> Raul
>>>>>
>>>>>
>>>>> On Thu, Feb 18, 2016 at 10:23 PM, Louis de Forcrand <[email protected]
>>> <javascript:;>
>>>>> <javascript:;>> 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:;>
>>>>> <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:;>
>>>>> <javascript:;> <mailto:[email protected] <javascript:;>
>>> <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:;>
>>>>>>>> <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:;>
>>>>>>>> <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:;>
>>>>>>>> <javascript:;> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Date: Tue, 16 Feb 2016 15:18:43 -0600
>>>>>>>>>>>> From: Kip Murray<[email protected] <javascript:;>
>>> <javascript:;>
>>>>> <javascript:;>>
>>>>>>>>>>>> To:"[email protected] <javascript:;> <javascript:;>
>>> <javascript:;>" <
>>>>>>>> [email protected] <javascript:;> <javascript:;>
>>> <javascript:;>>
>>>>>>>>>>>> Subject: [Jprogramming] A plane rotation
>>>>>>>>>>>> Message-ID:
>>>>>>>>>>>> <
>>>>>>>> caofworgvydb1nmjwxkb0wosyfnlubxcdz20sv11uksfcfay...@mail.gmail.com
>>> <javascript:;>
>>>>> <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
>>> ----------------------------------------------------------------------
>>> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm