[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] RE: How can I get every term of an expression ?
From: |
root |
Subject: |
Re: [Axiom-developer] RE: How can I get every term of an expression ? |
Date: |
Tue, 20 Sep 2005 01:35:58 -0400 |
Bill, Francois,
The output form of an expression is determined by the domain.
The simple example is
m:= 1/2*x^2 + 1/3*x + 1/5
yields
1 2 1 1
- x + - x + -
2 3 5
Type: Polynomial Fraction Integer
the type was chosen by the interpreter. The "simplest" expression
of this form (a polynomial with fractional coefficients) is printed.
However we can change the type (and thus the printed representation)
by coercion:
m::Fraction(Polynomial(Integer))
2
15x + 10x + 6
--------------
30
which is now a fraction whose numerator is a polynomial with
integer coefficients and whose denominator is a polynomial
with integer coefficients.
It is, however, essentially the same expression (module zeros).
Bill writes:
> How can I persuade Axiom to write out
>
> (1) -> (2*log(x)+3*exp(y))*(4*sin(z)+2*log(x))
>
> as a "sum of products"? E.g.
>
> (2) -> 8*log(x)*sin(z)+4*log(x)^2+12*exp(y)*sin(z)+6*exp(y)*log(x)
so you're asking for a domain whose print representation is a "factored"
form, something like asking axiom:
n:= 345
Type: PositiveInteger
Now Factored(Integer) has a print representation of:
n::Factored(Integer)
3 5 23
Type: Factored Integer
I'm unaware of any existing domain that has a print representation as
a "sum of products" although one could be written.
Bill writes
> Why can't Axiom factor and expand such expressions?
Axiom can factor and expand such expressions. However when the results
get printed (in Expression(Integer)) they get printed in the form shown.
Instead of "Distributed" perhaps you wanted "Factored" such as
Factored(Expression(Integer))
however factored currently does not know how to print anything in
factored from other than integers it seems. Since this is a valid
type clearly the print representation could be expanded to cover
the Expression(Integer) values.
Tim