Changes between Initial Version and Version 7 of Ticket #12075


Ignore:
Timestamp:
01/10/12 22:16:34 (9 years ago)
Author:
gbe
Comment:

Progress thus far:

  1. calculus/all.py is modified so that sage recognizes the creation of callable symbolic matrices via function notation. In particular:
    sage: m(X) = [[cos(X), -sin(X)],[sin(X), cos(X)]]
    

and is now valid syntax.

sage.matrix.matrix2.Matrix now has a method function() so the function notation syntax correctly returns a callable matrix. However, the method function() currently is creating a matrix of type Matrix_generic_dense; in analogy to the vector this this should probably be Matrix_callable_symbolic_dense. I'm unsure how significant an issue this is as most of the important things work. This certain does affect how these matrices are displayed - in all the following examples, the entries are of the form "X> f(X)" where what should probably be output is something like "X> [f(X), g(X)]\n[h(X), j(X)]".
  1. Things that work correctly:
    sage: m(pi/2)
    [ 0 -1]
    [ 1  0]
    sage: m.trace()
    X |--> 2*cos(X)
    sage: m(3).eigenvalues()
    [-I*sin(3) + cos(3), I*sin(3) + cos(3)]
    sage: m.derivative()
    [X |--> -sin(X) X |--> -cos(X)]
    [ X |--> cos(X) X |--> -sin(X)]
    sage: m.kernel()
    Vector space of degree 2 and dimension 0 over Callable function ring with arguments (X,)
    Basis matrix:
    []
    sage: m.image()
    Vector space of degree 2 and dimension 2 over Callable function ring with arguments (X,)
    Basis matrix:
    [X |--> 1 X |--> 0]
    [X |--> 0 X |--> 1]
    

Things that don't work (and should?):

sage: m.eigenvalues()
NotImplementedError ...

Things that I'm not sure about/work incorrectly(?):

sage: m.charpoly()
(X |--> 1)*x^2 + (X |--> -2*cos(X))*x + X |--> sin(X)^2 + cos(X)^2
sage: m.echelon_form()
[X |--> 1 X |--> 0]
[X |--> 0 X |--> 1]

What remains to do:

  1. Matrix.function() is defined in sage/matrix/matrix2.pyx. It might be better placed in sage/matrix/matrix_generic_dense.pyx as the method for function() is defined only for FreeModuleElement_generic_dense. (Minor)
  1. Matrix.function() is written as an exact analog to FreeModuleElement_generic_dense.function(). This is the cause of the problem I mentioned in (2). I think the root of the problem is that the vector case is being coerced to the correct class via the category framework and the matrix class is currently lacks the code needed to coerce correctly. It's also quite possible there's a better way to write this method. I've looked through some of the matrix and module code however, and I don't yet have any sensible ideas.
  1. Generalizing from (2) I've tried to make function notation for matrices as similar to function notation for vectors as similar as possible. Is this sensible, or are there enough salient differences that this is unreasonable?
  1. The file sage/matrix/matrix_callable_symbolic_dense.py purposely produces several doctest failures due again to the type issue in (2). Any other failures should be considered bugs.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12075

    • Property Keywords sd35.5 added
    • Property Authors changed from to Geoffrey Ehrman
  • Ticket #12075 – Description

    initial v7  
    2020$SAGE_ROOT/devel/sage/sage/modules/vector_callable_symbolic_dense.py
    2121does for vectors (i.e., changes the printing).
    22 }}}
     22}}}[[Image()]]