On 05/29/2008 02:48 PM, Francois Maltey wrote: > Ralf wrote : > > >> In this last case I must be able to recognize the domain : > >> Expression Complex Integer or Expression XXXX Complex YYYYYYY, as > >> Expression Fraction Complex Integer and Expression Complex Fraction > >> Integer or others. > > > What does "Expression(X)" actually tell you? Why the X at all? > > Is the imaginary i an element of Expression(Integer)?
> This is the question. > I want to code functions for expressions which depend if %i is in the > domain or not. > If I code it in expr.spad I write inside Domain Expression (R) ... > > if R has imaginary:()->R and conjugate:()->R > then > expand x == > a function which separates real and imaginary parts. > exp (1+%i*%pi/7) = exp 1 * (cos (%pi/7) + %i * sin (%pi/7)) > else > expand x == expands terms in (nx) to x+x+x+x...+x and a+b That is wrong by design as you have seen by my previous example. Think yourself about an expression. Isn't that simply a tree of nodes? If you rething that in terms of "Expression(X)", where does the type X come in in that tree? Nowhere. The X is, in fact, an implementation detail. In some situations it is clever, but using Expression(X) everywhere actually says that you like to compute without types. So why do you use Axiom? > I hope I can explain what perplexity I feel in this example. Just look at the implementation of Expression(X) and see what it really does. An expression in Axiom is not a tree. Search for "Rep :=". Ralf ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel