2017-12-17 04:39:44 -0600 received badge ● Notable Question (source) 2013-02-20 01:05:55 -0600 received badge ● Popular Question (source) 2011-01-26 07:35:41 -0600 received badge ● Student (source) 2011-01-25 03:55:29 -0600 commented answer Coercion problem while defining piecewise function That was very clear and informative. Thanks a bunch! 2011-01-25 03:54:35 -0600 received badge ● Supporter (source) 2011-01-24 18:52:38 -0600 asked a question Coercion problem while defining piecewise function In a nutshell: I begin by defining the following function: def g(x): return math.exp(-1/(1 - x^2))  which poses no problem. Then, I try to use this function g to define a new function, as follows: f = Piecewise([ [(-.5,.5), 0.44399*g(x)] ])  which returns the following error: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Applications/sage/ in () /Applications/sage/ in g(x) /Applications/sage/local/lib/python2.6/site-packages/sage/rings/fraction_field_element.so in sage.rings.fraction_field_element.FractionFieldElement.__float__ (sage/rings/fraction_field_element.c:8540)() /Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_element.so in sage.rings.polynomial.polynomial_element.Polynomial.__float__ (sage/rings/polynomial/polynomial_element.c:8243)() TypeError: cannot coerce nonconstant polynomial to float -----------  I am not sure of what is going wrong here. Any ideas/solutions would be deeply appreciated. -jl