Jorge, For what it's worth, it appears that f(2) and g(-1) are elements of the symbolic ring, rather than the integer ring. As such, the equation
sage: f(2)==g(-1) is not interpreted as "evaluate this as a boolean expression". Rather, it is interpreted as another symbolic expression. This does not happen when the two sides of the equation are in the integer ring. sage: parent(0) Integer Ring sage: 0==0 True but f(2) is 0 in the symbolic ring, thus the equation of symbolics is interpreted as a symbolic element itself. sage: parent(f(2)) Symbolic Ring sage: f(2)==g(-1) 0 == 0 sage: parent(f(2)==g(-1)) Symbolic Ring sage: SR(0)==SR(0) 0 == 0 As a workaround, I noticed that if you define your functions using lambda, this does not happen. sage: f = lambda x:x**2-4 sage: g = lambda x:x**2-2*x+1 sage: parent(f(2)) Integer Ring sage: f(2)==g(-1) True This may not be the ideal way to present the functions to your class, but it might be better than something of the form sage: (f(2)-g(-1)).is_zero() Here's hoping this was helpful! -Micah On Sep 21, 2:04 pm, "A. Jorge Garcia" <[email protected]> wrote: > I had a weird problem in class today. Let's say I had the following > code in a cell: > > f(x)=x**2-4 > g(x)=x**2+2*x+1 > f(2)==g(-1) > > What output should I get? I was expecting: True Am I crazy? Needless > to say I didn't! > > TIA, > A. Jorge > Garciahttp://shadowfaxrant.blogspot.comhttp://www.youtube.com/calcpage2009 -- You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en.
