Hello, This purpose about expression has 3 differents aspects.
A/ The first aspect we discover is the user interface. This interface must be coherent. This means that 1/ it's possible to describe it with "few word" 2/ The most common calculus has no option 3/ This system will be able to be refined for more difficult computations. B/ Theses mathematic rules are well known and this coding aspect is a visit inside the expressions, its branchs, its leaves, its operands and its operators. I feel that this point is not so difficult when A/ is well described. C/ I can't test my ideas about A/ by B/ in sage/python because I need some primitives I don't find. a- expr.operator() and expr.operands() are already right. a'-Extract and test sin in sin(x) is easy, but recognize the + in x+y is heavy. b- Burcin is working about an very fine automatic retract. If the result is an (defined) integer as in 0*x, its type becomes integer, and doesn't remain expression. b'- test for rational numbers, real numbers, positive ones will also be used. c- I don't find the test "this expression is an atomic variable" True for x, False for sqrt(2) d- For a later Sage tests around assume will be integrate in theses predicates. After assume (n, Integer), (-1)^(2*n) computes 1, sin(n*pi) answers 0 and cos(n*pi) remains. But this mail isn't the right place for the test x>0 or x<0 ! One time theses methods exist, code B/ becomes easy. With some tips, the d- improvement may be partially predict. From my point of view, the hardest aspect is the B-point. I used Maple, Mupad and Axiom... and I see what way is nice to use, and what way is disagreable. And I don't love Maxima manner with its numerous flags and numerous functions. The C-point is a play I'll done one day or an other because I make tipo every time I type expr.subs_expr(cos(x)==(exp(i*x)+exp(-i*x))/2), sin(x)==...) Francois. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---