axiom-math
[Top][All Lists]

## [Axiom-math] expand

 From: root Subject: [Axiom-math] expand Date: Mon, 17 Nov 2003 18:25:00 -0500

```Richy,

> But, just tell me one thing, please.  Is this a bug or need I read the
> book in order to understand?
>
> (1) -> expand((x+y+z)^2-x^2-y^2-z^2)
>
>
>    (1)  (2y + 2x)z + 2x y
>
>                                             Type: Polynomial Integer
> (2) -> expand(expand(expand((x+y+z)^2-x^2-y^2-z^2)))
>
>    (2)  (2y + 2x)z + 2x y
>                                             Type: Polynomial Integer
>
>
> Hmm, not if you use some really funny definition of "to expand".  I would
> rather have expected something like 2x z + 2y z + 2x y.  ?!?

(1) -> a:=(x+y+z)^2-x^2-y^2-z^2
(1)  (2y + 2x)z + 2x y
Type: Polynomial Integer
(2) -> c:DMP([x,y,z],FRAC(INT)):=a
(2)  2x y + 2x z + 2y z
Type: DistributedMultivariatePolynomial([x,y,z],Fraction Integer)

The issue is the type chosen. The result (1) is a polynomial in z of the
form a * z + b where a == (2y + 2x) and b == 2xy

If you want x and y to also be variables you need the second form where
you explicitly request that x, y, and z are variable.

The display of an equation is intimately bound to its type.

Tim

```