On Sunday, May 10, 2015 at 2:22:49 AM UTC-7, vdelecroix wrote:
>
> > But that is precisely the problem: we are halfway through replacing 
> > Python's functions with symbolic functions. Cos, sin, log, sqrt, abs. 
> > All these are already overwritten by Sage symbolic equivalents. Though 
> > not 'min' and 'max'. We should do it for all or for none, shouldn't 
> > we? By not respecting any standard convention we are making it 
> > unreliable. 
>
> cos is different from max. cos is in a Python library (math for 
> instance) while max is a builtin. 
>

Perhaps sum is a better example. We do override it, it has an interface 
that is comparable to that of max, and the performance penalty for 
overriding it in sage is huge:

 sage: L=[1,2,3,4,5]
sage: %timeit sum(L)
1000000 loops, best of 3: 1.32 µs per loop
sage: %timeit __builtin__.sum(L)
1000000 loops, best of 3: 387 ns per loop

Sum, however, gives access to a fundamental symbolic construct that is 
genuinely unavailable via the python routine. The results from 
symbolic_min/symbolic_max are rarely useful (because we hardly support any 
non-trivial automatic manipulation of these things), so there is an 
argument to be made that the performance penalty isn't worth the gain.

In that case we'd need to raise an exception on bool(sin(x)<cos(x)) rather 
than "false for don't know", because clearly a silent erroneous result, as 
we get now, is unacceptable if sum(1/n^2,n,1,oo) does work.

And then it gets complicated, because then the domain starts playing a 
role: Do we get an exception from bool(sin(x)<abs(x)) because for complex x 
this doesn't hold work? Luckily we don't have much compatibility to worry 
about, since symbolic equalities have very poor functionality anyway:

sage: bool(sin(x)^2+cos(x)^2==1)
True
sage: bool(sin(x)^2+cos(x)^2<=1)
False

so perhaps current;ly symbolic inequalities are just convenient to ship 
constraints to linear programming routines?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to