Hi Francois, On Mon, 11 Oct 2010 18:12:57 +0200 Francois Maltey <fmal...@nerim.fr> wrote:
> // 1 // And what do you think about log ? Look at these test : > > exp(x).operator() == exp # is True, and all(?) trigonometric > functions are fine > log(x).operator() == ln # is True, yes the alias ln is better than > the log name > log(x).operator() == log # is False (this feature looks like the > binomial one) > log(x).operator() == sage.function.log.function_log # is True The test with log() fails, since that is a python function which wraps ln() to allow optionally specifying a base for the logarithm. We should define a __call__() method in the Function_log class from sage/functions/log.py, to handle the base argument. Then ln() and log() can be the same function and log(x).operator() == log will return True. http://trac.sagemath.org/sage_trac/ticket/10136 > // 2 // > > Do you want I place somewhere the rewrite function I test and > improve ? Where ? Yes, that's a great idea. I opened a ticket for this: http://trac.sagemath.org/sage_trac/ticket/10137 You can attach your implementation on the ticket. I created a page on the wiki to document the design. You can post ideas there and we can all edit the page together. http://wiki.sagemath.org/symbolics/rewrite The first step might be to agree on the arguments of the rewrite() function. I put up a suggestion on that page. > I code a syntax with strings "from2target", by example > "tancot2sincos" or "trigo2exp". > > Do you prefer the syntax with a parameter as rewrite (expr, source = > "trigo", target=exp) > > But in this case It's impossible to compose these rewrite rules. > The syntax "_from_2_to_" allows the composed rewrite rules. > > tan(x)^2 -> 1/cos(x)^2 - 1 -> 2 / (exp(I*x) . . .) - 1 -> 1/cos(x)^2 > - 1 -> tan^2(x) > > sage: rewrite (tan(x)^2, "tancot22sincos", "sincos2exp", > "lessIinExp", "cos22tan") > tan(x)^2 I think we should use the standard object oriented syntax instead of parsing the arguments of a function creatively. IMHO, this is more explicit: sage: (tan(x)^2).rewrite("tancot22sincos").rewrite("sincos2exp")\ .rewrite("lessIinExp").rewrite( "cos22tan") tan(x)^2 Thank you. Burcin -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org