ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 04 Feb 2017 19:43:29 +0100Evaluating the derivative of piecewise functionshttps://ask.sagemath.org/question/36451/evaluating-the-derivative-of-piecewise-functions/ Hi,
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()
-0.416146836547142
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()
0.540302305868140
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.
franpenaSat, 04 Feb 2017 19:43:29 +0100https://ask.sagemath.org/question/36451/