Hi!

I guess this has to do with the data structure in piecewise.py file in the 
latest sage.

When I check the type of a piecewise function object, for example:

my_abs = piecewise([((-1, 0), -x), ([0, 1], x)], var=x) 
type(my_abs)

I got 

<class 'sage.functions.piecewise.Expression_with_dynamic_methods'>

In piecewise.py file, there are two classes. One is PiecewiseFunction, the 
other one is EvaluationMethod. I am guessing the above my_abs is an 
instance of EvaluationMethod. Is that right? If so, what is 
Expression_with_dynamic_methods class and how is it related to 
EvaluationMethod class?

This is a problem for me because I want to write a new class that inherits 
from PiecewiseFunction. When I evaluate the function (as an instance in my 
new class) value at a point, it only uses the __call__ method from 
PiecewiseFunction but not from EvaluationMethod. But __call__ from 
EvaluationMethod should be the right one to call. But in EvaluationMethod, 
there is not even a constructor. I do not know if I can even write my new 
class inherits from EvaluationMethod class. 

The last thing I do not understand is that in the last line of the file, 
piecewise = PiecewiseFunction(). In this case, why when I do 

my_abs = piecewise([((-1, 0), -x), ([0, 1], x)], var=x) 
type(my_abs)

instead of an PiecewiseFunction object, I got an 
Expression_with_dynamic_methods object?

It would be really nice if someone could explain these questions! Thank you 
in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to