On Tuesday, February 17, 2015 at 4:14:37 AM UTC-8, pdenapo wrote: > > Writing something like > > SR(0).function(x) > > instead of > > ConstantFunction(0) > > is not what most mathematicians or students would do, I guess. Maybe > there is something to improve here. >
Yes, looking at the documentation and the use of ConstantFunction in the sage library, it seems this was put in to have a convenient way of making constant maps in the coercion system. It is not at all integrated with symbolics. So from a calculus point of view, it is unfortunate this is exposed and discoverable (because it's presently useless for calculus). Perhaps it can be equipped with some hooks to better integrate it with symbolics or otherwise be hidden from view. Incidentally, the fact that f.derivative() and f.integral() work for some symbolic functions (notably, the ones made with expr.function(...) ) is a byproduct of their implementation. Neither works in general: sage: sin.derivative() AttributeError: 'Function_sin' object has no attribute 'derivative' sage: sin.integral() AttributeError: 'Function_sin' object has no attribute 'integral' Both operations need to be performed on expressions, i.e., sin(x).derivative(x) and sin(x).integral(x), because they need a variable name to do the operation with respect to. The present situation: sage: sin(x+y).function(x,y).integral() #gives a deprecation warning (x, y) |--> -cos(x + y) sage: sin(x+y).function(x,y).derivative() #this makes perfect sense: it's the total derivative. (x, y) |--> (cos(x + y), cos(x + y)) sage: sin(x+y).function(x,y).derivative().derivative() [(x, y) |--> -sin(x + y) (x, y) |--> -sin(x + y)] [(x, y) |--> -sin(x + y) (x, y) |--> -sin(x + y)] sage: sin(x+y).function(x,y).derivative().derivative().derivative() #fails -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.