Hello,

On Wed, Jan 28, 2009 at 11:56 PM, martin Campos Pinto
<mcp.st...@gmail.com> wrote:
>
> Hi everybody,
>
> in my Notebook (version 3.2.3) I get the following:
>
> sage: a = float(1>1)
> sage: a
>
> 0.0
>
> sage: var('x')
> sage: b(x) = float(x>1)

When you make a definition like this, float is immediately applied to
x>1.  Since x is a symbolic variable, it cannot be determined whether
or not that inequality is true or false.  To delay the evaluation of
float until a value is plugged in for x, you can do something like the
following:

sage: b = lambda x: float(x>1)
sage: b(2)
1.0
sage: b(-1)
0.0

--Mike

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

Reply via email to