Closed jasongrout closed 14 years ago
Right now, all the docs are wrong or missing for the added functionality.
I added docs for each functionality that changed.
make ptestlong appears to pass on 4.4.1 (ubuntu 64-bit).
I'm running tests right now. In the meantime, could this be less ugly? I realize that the naked '4's are not callable, so there is the deprecation warning, but the error warning seems severe.
sage: d=matrix(SR, [[4, 4]])
sage: d(3)
/sage/dev/local/lib/python2.6/site-packages/IPython/iplib.py:2073: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
exec code_obj in self.user_global_ns, self.user_ns
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/sage/dev/<ipython console> in <module>()
/sage/dev/local/lib/python2.6/site-packages/sage/matrix/matrix_symbolic_dense.so in sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense.__call__ (sage/matrix/matrix_symbolic_dense.c:3956)()
ValueError: the number of arguments must be less than or equal to 0
I didn't know you could create a vector space of functions. Complete with a basis. ;-)
sage: g(x,y)=x^2+y^3
sage: g
(x, y) |--> x^2 + y^3
sage: grad=g.diff()
sage: grad
((x, y) |--> 2*x, (x, y) |--> 3*y^2)
sage: grad.parent()
Vector space of dimension 2 over Callable function ring with arguments (x, y)
sage: grad.parent().basis()
[
((x, y) |--> 1, (x, y) |--> 0),
((x, y) |--> 0, (x, y) |--> 1)
]
Replying to @rbeezer:
I'm running tests right now. In the meantime, could this be less ugly? I realize that the naked '4's are not callable, so there is the deprecation warning, but the error warning seems severe.
That's stemming from this, of course:
sage: SR(4)(2)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/jason/<ipython console> in <module>()
/home/jason/sage/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__call__ (sage/symbolic/expression.cpp:15477)()
/home/jason/sage/local/lib/python2.6/site-packages/sage/symbolic/ring.so in sage.symbolic.ring.SymbolicRing._call_element_ (sage/symbolic/ring.cpp:6523)()
ValueError: the number of arguments must be less than or equal to 0
I don't know what should be done about that to make it prettier. Usually you wouldn't "call" an integer by itself (as just a symbolic integer is not a function...)
Note that making matrices callable is just extending the existing behavior for vectors.
I didn't know you could create a vector space of functions. Complete with a basis. ;-)
Yes, interesting. That stems from callable expressions being just normal expressions with a bit of extra information (default variable order for calls). Of course, it gave you back a basis for symbolic expressions.
Replying to @jasongrout:
I don't know what should be done about that to make it prettier.
Me either. ;-) I guess I found it odd that there was a deprecation warning, then a failure. But maybe that's just the way it goes.
This all checks out fine: builds and runs, passes all tests, documentation is fine.
So, positive review.
same as previous but with ticket number in commit message
Attachment: trac-8866-preparse-vector-functions-derivatives.2.patch.gz
Reviewer: Rob Beezer
Merged: sage-4.4.2.alpha0
Here is a rough patch which enables the following:
CC: @mwhansen @burcin @kcrisman @rbeezer
Component: symbolics
Author: Jason Grout
Reviewer: Rob Beezer
Merged: sage-4.4.2.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/8866