AC[0] is the first *row* of the matrix. In other words a vector
sage: M = matrix(3, range(9))
sage: M[0]
(0, 1, 2)
sage: _.parent()
Ambient free module of rank 3 over the principal ideal
domain Integer Ring
Replace AC[0] by AC[0,0] in your code or whatever is appropriate...
Vincent
On 01/01/16 19:41, saad khalid wrote:
Hey everyone:
For what I'm working on, I'm trying to take transform two variables over a
matrix A, and then have the transformed variables plug into a function.
reset()
n = var("n")
x = var("x")
j = var("j")
k = var("k")
y = var('y')
z = var('z')
A = lambda n,j: (matrix([[cos(2*pi/n), -sin(2*pi/n)],[sin(2*pi/n), cos(2*pi/
n)]]))^j
C = matrix([[2],[3]])
AC = A(3,2)*C
a = AC[0]
b = AC[1]
fx1y0 = lambda x,y: x + 11
fx1y1 = lambda x,y: x + y + 11
fx2y1 = lambda x,y: x^2 + y + 11
fx1y0(a,b)
The error I'm getting when I plug in a and b into fx1y0 is this:
TypeError: unsupported operand parent(s) for '+': 'Vector space of dimension 1
over Symbolic Ring' and 'Integer Ring'
I think the problem is that it is treating a and b as 1 dimensional vectors,
when all I want is for a and b to contain the values at the location in the
matrix that I specify. Basically, I think I want it to treat the matrix as an
array, in terms of me getting values from it. Does anyone know how I could fix
this?
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.