Hello

I played some years ago with 2D rotation as part of general linear mappnigs 
with complex numbers.

A small demo below.

Esa

NB. ID rotdemo.ijs v0.0 28.06.17

NB. NO rotate some points

load 'graph'

tographcoord=:[:_0.98&+1.96&*

randompts=. 3 : 0
(y,2) $ tographcoord ?(+:y) #0
)

rot=: 4 : 0
+.(j./"1 x)*^j.y
)

]data=:randompts 20

rotloop=: 4 : 0
i=.0
while. i<y
do.
RED gdrect gddraw (x rot 0.01*i),"(1) 0.02 0.02
i=.>:i
wd 'msgs'
end.
)

data rotloop 1256


-----Original Message-----
From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 
Francesco Pedulla'
Sent: Friday, December 18, 2020 9:59 AM
To: programm...@jsoftware.com
Subject: [Jprogramming] Matrix of functions

Dear all,
I need to represent the 2D rotation matrix 'R'

R = |cos(t)  -sin(t)|
       |sin(t)   cos(t)|

and compute it for different values of the rotation angle 't'. I am aware
the matrix of function can be represented as a gerund, which I like:

R =: 2 2$cos`(-@sin)`sin`cos .

To compute R(t), I wrote the following definition:

mf =: conjunction : '($x)$,(,x)/.((+/$x)$y)'


so that "R mf pi%4" returns R(pi/4). But I find the code for 'mf' not very
elegant. Is there a better way to achieve this?
Thanks in advance for any hint,

Francesco
----------------------------------------------------------------------
For information about J forums see 
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=04%7C01%7C%7C5040891471b24ce209e308d8a32ad00e%7C5090e269dbea4e98a9aa3e70be5890f7%7C0%7C0%7C637438751567848800%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=M5jSS56c5vn1hKjzDdOGKiZHRWTAHxCUi6o%2ByQ592tU%3D&amp;reserved=0

Tämän viestin sisältö liitteineen on luottamuksellinen ja tarkoitettu vain sen 
vastaanottajalle. Jos et ole viestin tarkoitettu vastaanottaja, pyydämme sinua 
poistamaan viestin liitteineen ja sen jälkeen ilmoittamaan asiasta välittömästi 
viestin lähettäjälle. Viestin sisällön paljastaminen, kopioiminen tai muu 
käyttö on kielletty.

The contents of this message and any attachments are confidential and meant 
solely for the intended recipient. If you are not the intended recipient, we 
kindly ask that you delete the message and its attachments, and immediately 
notify the sender of the email. Disclosing, copying or using the contents of 
the message is strictly prohibited.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to