> Thanks for this. There still seems to be a manual step in going from,
> say,
> s1 = 2*(1,8) - (1,9)
> to
> s1 = 2*b[1] - b[2]
I may be misunderstanding you. Are you saying you want to enter the line
s1 = 2*(1,8)-(1,9)
verbatim and have it work? That I don't think I can do (unless you're
willing to type them not at the prompt but in a string or file which
is then parsed). One option is to use a dictionary as an intermediary
step:
age: M = ModularSymbols(11,2);M
Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with
sign 0 over Rational Field
sage: m = dict((sage_eval(str(b)), b) for b in M.basis())
sage: m
{(1, 0): (1,0), (1, 8): (1,8), (1, 9): (1,9)}
This dictionary basically maps a tuple to the corresponding
ModularSymbolsElement in the basis. [Yes, to be safer I should really
use ast.literal_eval.] Then you could write:
sage: s = [2*m[1,8] - m[1,9],
....: -m[(1,0)] + m[(1,9)],
....: -m[(1,0)] + m[(1,8)]]
sage: s
[2*(1,8) - (1,9), -(1,0) + (1,9), -(1,0) + (1,8)]
Note that the parentheses () are optional. Finally:
sage: V = span([sx.list() for sx in s],QQ)
sage: V
Vector space of degree 3 and dimension 3 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]
[0 0 1]
Would something like that work or do you have a particular format that
you can't escape?
Doug
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org