function( 'name
' [ , arguments
] )
The symbolic function name
in SageMath determined from keyword arguments
for evaluation and manipulation.
Symbolic functions are needed to avoid TypeError
messages when providing input to SageMath functions that only take symbolic expressions as arguments, as for example piecewise.
Keyword arguments:
narg=integer number of arguments eval_func=method for automatic evaluation evalf_func=method for numeric evaluation evalf_params_first=True|False conjugate_func=method for complex conjugation real_part_func=method for taking real parts imag_part_func=method for taking imaginary parts derivative_func=method for (partial) differentiation tderivative_func=method for differentiation power_func=method for taking powers series_func=method for series expansion print_func=method for custom printing print_latex_func=method for custom LaTeX printing latex_name=name for printing in LaTeX mode conversions=dictionary of names of function in other systems
Examples:
Note that arguments self
and **kwds
are critical for avoiding errors here:
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, figsize=[4.5,2], color=(0,.5,1) )
Related functions: piecewise
Function category: basic functions sagemath-docs