Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Evaluating the derivative of piecewise functions


In Sage 7.5 you can numerically evaluate the derivative of a regular symbolic expression using:

sage: h(x) = sin(x)
sage: diff(h)(2).n()

Old Piecewise functions could be treated in the same way:

sage: g = Piecewise([([0,2], sin(x)), ((2,3), cos(x))])
... DeprecationWarning ...
sage: diff(g)(1).n()

However, new piecewise functions don't:

sage: f = piecewise([([0,2], sin(x)), ((2,3), cos(x))])
sage: diff(f)(1).n()
... Error ...

Thanks in advance.