Perhaps I'm missing the point, but I would say:

R =: ((cos , -@sin) ,: sin , cos)

R 1r6p1

0.866025 _0.5

0.5 0.866025


Ben

On Fri, 18 Dec 2020 at 18:59, Francesco Pedulla' <mel...@gmail.com> wrote:

> 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 http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to