sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.21k stars 419 forks source link

Annihilator use where it perhaps wasn't intended #21742

Open kcrisman opened 7 years ago

kcrisman commented 7 years ago

I'm not sure if this example from ask.sagemath is user error, bad doc, or a bug.

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])])

result:

AttributeError: 'sage.rings.rational.Rational' object has no attribute '_vector_'

CC: @nthiery @avirmaux @saliola @videlec @kwankyu

Component: algebra

Issue created by migration from https://trac.sagemath.org/ticket/21742

kcrisman commented 7 years ago
comment:1

(Or is this something which more use of the TestSuite would have caught? Just wondering.)

tscrim commented 7 years ago
comment:2

First, the variables and s are not involved. However, the things in ModulesWithBasis currently don't exactly support the "standard" free modules. The issue is that the action does not result with elements in a vector space per-se. So, strictly speaking, it is user error. However, I feel like this probably should be supported, and this might be (partially) solved by #21737 (which is why I've cc-ed Vincent and Kwankyu).

kcrisman commented 7 years ago
comment:3

By the way, you may want to reply to the user on the ask.sagemath question, who I think really wants to do something more like orthogonal complement ... but I'm not sure since I usually think of annihilators in a commutative algebra context only and maybe there is something more subtle going on here?

tscrim commented 7 years ago
comment:4

I believe that user wants

sage: v = vector([2,-3,-4])
sage: r.intersection(matrix(v).right_kernel())
Free module of degree 3 and rank 1 over Integer Ring
Echelon basis matrix:
[  4  60 -43]

Could you forward this along as I don't have an ask.sagemath account?

Also, I think of annihilators in a more general context, as a ring/algebra R acting on an R-module. This is an explicit assumption of annihilator:

The codomain is any vector space, and ``action`` is
linear on its first argument; typically it is bilinear;

Although the requirement that it is an honest action is not a strict requirement, but it must be something realizable as a module (vector space?).