mcdewey wrote:
> Given the following input;
> sage: var('x')
> sage: var('y')
> sage: e1 = (y + x + 2)
> sage: e2 = (y - x^2 + 2*x + 3)
> sage: e3 = (y + x + 42)
> sage: e4 = min(e1, e2, e3)
> sage: e4(-10, -10)
> 
> I get the result -18. (the value of e1(-10, -10)
> 
> I would expect to get -127 (the value of e2(-10,-10)
> 

typing

sage: e4
y+x+4

shows the problem.  min is a builtin python function and isn't smart 
about symbolic functions; it just returns the first thing when it comes 
to symbolic expressions:

sage: var("x,y")
sage: min(x,y)
x
sage: min(y,x)
y

> I want the smallest value selected from the 3 equations at the
> specified point.

I would do this like:

sage: min(f(-10,-10) for f in [e1,e2,e3])
-127

In other words, evaluate the functions before calling min.

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to