1 | initial version |
By the way, you can do this in one go by defining a symbolic function.
sage: f(a,b,c) = [a-b, b-c, c-a]
sage: f.derivative()
[ (a, b, c) |--> 1 (a, b, c) |--> -1 (a, b, c) |--> 0]
[ (a, b, c) |--> 0 (a, b, c) |--> 1 (a, b, c) |--> -1]
[(a, b, c) |--> -1 (a, b, c) |--> 0 (a, b, c) |--> 1]
sage: f.derivative()(a,b,c)
[ 1 -1 0]
[ 0 1 -1]
[-1 0 1]
sage: type(_)
<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
2 | No.2 Revision |
By the way, you can do this in one go by defining a symbolic function.
sage: f(a,b,c) = [a-b, b-c, c-a]
sage: f.derivative()
[ (a, b, c) |--> 1 (a, b, c) |--> -1 (a, b, c) |--> 0]
[ (a, b, c) |--> 0 (a, b, c) |--> 1 (a, b, c) |--> -1]
[(a, b, c) |--> -1 (a, b, c) |--> 0 (a, b, c) |--> 1]
sage: f.derivative()(a,b,c)
[ 1 -1 0]
[ 0 1 -1]
[-1 0 1]
sage: type(_)
<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
If you started out with a vector in your computations then you can get a list by doing this
sage: a,b,c = var('a,b,c')
sage: v = vector([a-b, b-c, c-a])
sage: f(a,b,c) = v.list()