Ask Your Question

Revision history [back]

piecewise has been completely rewritten as a symbolic function in Sage 7.2 and requires its component arguments to be symbolic as well. Symbolic functions are constructed from numeric functions using function. Here's an example of how to include numerical_integral in a piecewise function:

def numeric(self, x, **kwds):
  var('u')
  return numerical_integral(u,0,x)[0] 

symbolic = function('symbolic', nargs=1, evalf_func=numeric)

f = piecewise([[(0,1),symbolic(x)]])
plot( f, 0, 1 )

The resulting plot can be seen here. Note that it is critical to include the arguments self and **kdws in the definition of the numeric function.