[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] RE: How can I get every term of an expression ?
From: |
Page, Bill |
Subject: |
[Axiom-developer] RE: How can I get every term of an expression ? |
Date: |
Mon, 19 Sep 2005 21:20:39 -0400 |
On Sunday, September 18, 2005 4:23 PM Francois Maltey wrote:
>
> I start from ... an Expression :
> (2*log(x)+3*exp(y))*(4*sin(z)+2*log(x))
>
> And I want to get every term : ... 6 %e^y log(x), etc.
> and get easily the integer 6, 8, 12 or 4.
>
> ...
> I want to play with expression, not polynomial ;
> then what coerce must I do ?
>
Tim Daly answered the part of Francois' question concerning the
case of polynomials (which I have omitted above) but in this case
the example expression is not a polynomial. It is assumed by Axiom
to be of type Expression Integer and cannot be converted to any
of the polynomial types except in a trivial manner, e.g.
DistributedMultivariatePolynomial([x,y,z],Expression Integer)
I have not been able to find any acceptible answer to Francois'
question.
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)
In Axiom, both of these expressions are rendered as
(8log(x) + 12exp(y))sin(z) + 4log(x) + 6exp(y)log(x)
Type: Expression Integer
Why does Axiom choose this peculiar form instead of (1) or (2)?
Why can't Axiom factor and expand such expressions?
In the case of polynomials I can write:
(3) -> ((2*x+3*y)*(4*z+2*x))::DMP([x,y,z],INT)
2
(3) 4x + 6x y + 8x z + 12y z
Type: DistributedMultivariatePolynomial([x,y,z],Integer)
But there does not seem to be anything type equivalent to
Type: DistributedExpression Integer
Why not?
Would it make sense to define Distributed as a generic domain
constructor similar to Complex?
Would it be possible to write
Distributed MultivariatePolynomial([x.y.z],Integer)
and
Distributed Expression Integer?
(Note the space between Distributed and MultivariatePolynomial.)
Would it be simple to "extend" Expression to a new domain were
expressions are represented (when possible) as sums of products?
Regards,
Bill Page.
- [Axiom-developer] RE: How can I get every term of an expression ?,
Page, Bill <=