Ask Your Question
1

The Pleasures of 'Perp Dot' Products in Sagemath

asked 2016-07-25 04:13:01 -0600

etb gravatar image

updated 2016-07-25 04:19:54 -0600

Francis S. Hill, Jr. has an vector operation he calls a-Perp. It is defined as the vector perpendicular to a that is rotated 90° counterclockwise (Hill 1994:138). Wolfram also has a page on the concept here. Similar to the Normal vector, but not quite.

I wonder if there's a default Sage function, or some handy way, to do this?

Say I have vector a

a = vector(QQ, [3, 4])

and I want to get

a_Perp = vector(QQ, [-4, 3])

Hill, F. S. Jr. "The Pleasures of 'Perp Dot' Products." Ch. II.5 in Graphics Gems IV (Ed. P. S. Heckbert). San Diego: Academic Press, pp. 138-148, 1994.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2016-07-25 08:45:38 -0600

calc314 gravatar image

Alternatively, you can use the rotation matrix.

a = vector(QQ, [3, 4])
m=matrix(QQ,[[0,-1],[1,0]])
a_perp=m*a
edit flag offensive delete link more

Comments

I prefer this solution as it seems most flexible to me. Please chime in if if you have comments. I'm eager to learn.

etb gravatar imageetb ( 2016-07-25 11:25:35 -0600 )edit
1

answered 2016-07-25 07:22:45 -0600

B r u n o gravatar image

There is no such function defined in Sage. Yet, you can write it as:

sage: a_perp = vector([-a[1], a[0]])
sage: a_perp
(-4, 3)

If you think this function is useful, I urge you to add it (as well as maybe "perp-dot products") into Sage by creating a ticket on trac.sagemath.org.

edit flag offensive delete link more

Comments

@b-r-u-n-o, thank you for your feedback and your answer.

etb gravatar imageetb ( 2016-07-25 11:23:10 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-07-25 04:13:01 -0600

Seen: 90 times

Last updated: Jul 25 '16