1 | initial version |
This is trac ticket #12075.
This way to define a function is syntactic sugar offered by Sage, but it doesn't yet work for matrix functions.
I suggest defining an ordinary Python function instead (using a lambda
for brevity):
sage: var('alpha')
sage: i = matrix(SR, [[ 0, -I], [-I, 0]])
sage: f = lambda alpha: cos(alpha)*i
sage: f(0)
[ 0 -I]
[-I 0]
2 | No.2 Revision |
This is trac ticket #12075.
This way to define a function is syntactic sugar offered by Sage, but it doesn't yet work for matrix functions.
I suggest defining an ordinary Python function instead (using a lambda
for brevity):
sage: var('alpha')
sage: i = matrix(SR, [[ 0, -I], [-I, 0]])
sage: f = lambda alpha: cos(alpha)*i
x: cos(x)*i
sage: f(0)
[ 0 -I]
[-I 0]
sage: f(alpha)
[ 0 -I*cos(alpha)]
[-I*cos(alpha) 0]
3 | No.3 Revision |
This is trac ticket #12075. (since 2011).
This way to define a function is syntactic sugar offered by Sage, but it doesn't yet work for matrix functions.
I suggest defining an ordinary Python function instead (using a lambda
for brevity):
sage: var('alpha')
sage: i = matrix(SR, [[ 0, -I], [-I, 0]])
sage: f = lambda x: cos(x)*i
sage: f(0)
[ 0 -I]
[-I 0]
sage: f(alpha)
[ 0 -I*cos(alpha)]
[-I*cos(alpha) 0]