I can express a point direction approach as well as the 2 point approach 

rotheta=: ([: r. [) * ] 
pt=:_1j0 
dir=:1j1 
ctr=:_1j1 



( ctr,0)+ (1r4p1) rotheta (pt-ctr),dir 


_0.292893j0.292893 0j1.41421 


which is, I believe , your desired point/direc tion approach. 
My previous appr oach gave 2 points on the lin e which can give you the A and B 
and t can be extracted. ( original magnitude of t unchange d but direction 
giving dy/dx is changed) 



Old math te acher f orgiven 

EE prof emeritus (latin for "has been") whose approach to math is as a tool 

and less pro ficient in J , also ask s for forgiveness 



Don 


----- Original Message -----

From: "Kip Murray" <[email protected]> 
To: [email protected] 
Sent: Saturday, March 12, 2016 6:37:28 AM 
Subject: Re: [Jprogramming] A plane rotation 

What you are doing is very nice. 

I call mine a point direction approach. A point on a straight line is 
described by 

S + t * D 

Where t is a real number, and S And D are points in a vector space, the 
starting point and the direction point. 

Another approach valid in any vector space is the two-point approach where 
a point on the straight line through two points A and B is described by 

((1-t)*A) + t*B 

-- this point is " t of the way from A towards B ", for example when t is 
1r2 you have the midpoint between A and B, and if t is 2 then B is the 
midpoint between A and ((1-t)*A) + t*B , and if t is _1 . . . You are 
establishing a coordinate system on line AB in which A has coordinate 0 and 
B has coordinate 1. 

Forgive an old math teacher, 
Kip Murray 

On Friday, March 11, 2016, Donald Kelly <[email protected]> wrote: 

> We are trying to do the same thing- where you concentrate on a point- 
> slope approach, I tend to a rotation of points -and there can be many- 
> points on a shape or a curve. With this latest example I use the following. 
> 
> 
> rotheta=:([:r.[)*] 
> pts=:_1j0 0j1 1j2 
> ctr=:_1j1 
> 
> ] s=:ctr+ (1r4p1) rotheta pts-ctr 
> _0.292893j0.292893 _0.292893j1.70711 _0.292893j3.12132 
> 
> 
> which are the the rotated positions of the original points -a vertical 
> line at x=_0.292893 (_1+%:0.5) 
> 
> as you have . The distance between adjacent points is % :2 as in the ori 
> ginal points . 
> 
> 
> 
> My earlier posted rotheta was m eant to give input and output in (x,y) 
> form and didn't work for this example. 
> I realize why you de alt with 3 points although t his wa sn't needed. 
> 
> 
> As far as the verbs themselves are considered- as simple as possible is 
> the target. 
> 
> 
> Don 
> 
> ----- Original Message ----- 
> 
> From: "Kip Murray" <[email protected] <javascript:;>> 
> To: [email protected] <javascript:;> 
> Sent: Wednesday, March 9, 2016 8:26:09 PM 
> Subject: Re: [Jprogramming] A plane rotation 
> 
> 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] <javascript:;>> 
> 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] 
> <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

Reply via email to