Ask Your Question
1

Basic question about annihilator

asked 2016-10-22 11:09:47 -0500

Jsevillamol gravatar image

updated 2016-10-22 12:02:11 -0500

kcrisman gravatar image

I want to compute the intersection of a plane r spanned by two vectors and another plane s defined by its implicit equation. I thought the following would work:

var('x0,x1,x2')
r0 = vector(QQ,[3,1,-2])
r1 = vector(QQ,[1,-5,3])
r = span([r0,r1])
s = 2*x0 - 3*x1 - 4*x2 == 0
r.annihilator([vector([2,-3,-4])])

But instead I am greeted with an error message saying that AttributeError: 'sage.rings.rational.Rational' object has no attribute '_vector_'.

What am I doing wrong?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-10-23 14:21:29 -0500

tmonteil gravatar image

updated 2016-10-23 14:25:26 -0500

r is correctly defined. For s, i would just do:

sage: s = matrix(QQ,[2,-3,-4]).right_kernel()
sage: s
Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[   1    0  1/2]
[   0    1 -3/4]

Then you can do:

sage: s.intersection(r)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

And check

sage: r.intersection(s)
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[    1    15 -43/4]

sage: b = r.intersection(s).basis()[0] ; b
(1, 15, -43/4)
sage: b in r
True
sage: b in s
True

As a general rule, unlike say complex analysis, Sage already offers precise objects to work with linear spaces, polynomials, combinatorics, so that you should avoid the use of fuzzy symbolic things.

edit flag offensive delete link more
1

answered 2016-10-22 12:13:00 -0500

kcrisman gravatar image

If you use the syntax in r.annihilator? then it makes it one step further:

sage: r.annihilator([2,-3,-4])
...
AttributeError: 'FreeModule_submodule_field_with_category' object has no attribute 'from_vector'

But I think you meant one vector, not three rationals, so that isn't helpful. I have opened Trac 21742 for this; I suspect this simply isn't a case where this was intended to be used.

edit flag offensive delete link more

Comments

My intention was to filter the elements of r such that they satisfied s's equation. That is, the elements of r which map to 0 when you do the dot vector with [2,-3,-4]. What would be the canonical way of doing this?

Jsevillamol gravatar imageJsevillamol ( 2016-10-22 13:47:44 -0500 )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

1 follower

Stats

Asked: 2016-10-22 11:09:47 -0500

Seen: 68 times

Last updated: Oct 23 '16