On Sep 26, 2008, at 12:15 AM, Paisa Seeluangsawat wrote:

> Hi
>
> The command 'bool(3<pi)' takes 0.1 second on my machine.  This
> makes plotting/computing piecewise-defined trigonometric functions
> rather slow.
>
> The culprit seems to be sage.calculus.SymbolicExpression.__lt__ 
> (self, right).
> It always yields a SymbolicEquation, which is then solved in Maxima.
> Maybe we can speed this up with a check along the line of,
>
>   if ( self is constant
>        and  type(right) is Integer, RealNumber,... ):
>
>        temp = self, coerced into RealNumber with appropriate  
> precision.
>        return temp.__lt__(right)

We are currently weaning ourselves away from using Maxima for all our  
symbolics, which will make things such as this much faster.

> Related issue: '3<4' yields a bool, while '3<pi' yields an
> instance of SymbolicEquation.  Maybe '3<pi' should just yield a
> bool too.

For consistency, we would like the type of 3 < f to depend only on  
the parent (e.g. type) of f. Otherwise things become too hard to  
reason with. However, in your case you might want to do something like

n_pi = RDF.pi()

in which case things like 3<n_pi will be very fast.

- Robert


--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to