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]> 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]> 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] 
>> <mailto:[email protected]>> 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:;>> 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:;>> 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:;> wrote:
>>>>>>
>>>>>>> Date: Tue, 16 Feb 2016 15:18:43 -0600
>>>>>>> From: Kip Murray<[email protected] <javascript:;>>
>>>>>>> To:"[email protected] <javascript:;>" <
>>> [email protected] <javascript:;>>
>>>>>>> Subject: [Jprogramming] A plane rotation
>>>>>>> Message-ID:
>>>>>>>    <
>>> caofworgvydb1nmjwxkb0wosyfnlubxcdz20sv11uksfcfay...@mail.gmail.com
>>> <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

Reply via email to