|
|
last edited 7 years ago by test1 |
1 2 3 4 | ||
Editor: 127.0.0.1
Time: 2007/11/15 20:21:53 GMT-8 |
||
Note: transferred from axiom-developer |
changed: - Let's examine a simple case: \begin{axiom} Dg := [p3 - 3*p2 + 3*p1 - p0,3*p2 - 6*p1 + 3*p0,3*p1 - 3*p0,p0] \end{axiom} Now calculate coefficients in two ways: \begin{axiom} map(coefficients, Dg::List MPOLY([p0,p1,p2,p3],?)) \end{axiom} and \begin{axiom} map(coefficients, Dg::List MPOLY([p3,p2,p1,p0],?)) \end{axiom} As you see the list are all reversed, but... they were not padded with zeros. While in my opinion they should be - we have a given order of variables, and alone 1 in the last list suggests that this is a coefficient of p3 while it isn't. It is a coefficient of p0. According to the Axiom book function 'coefficients' does not include zeros in the list. Furthermore it does not say explicitly in what order the coefficients themselves are listed. Remember that there are also terms of degree higher than 1. In fact the two multivariate polynomials that you used above are formally identical \begin{axiom} (Dg::List MPOLY([p0,p1,p2,p3],?)=Dg::List MPOLY([p3,p2,p1,p0],?))::Boolean \end{axiom} To produce a list of coefficients of the terms of degree 1, including the zeros and in a specific order, use the function 'coefficient' like this: \begin{axiom} [[coefficient(p,x,1) for x in [p0,p1,p2,p3]] for p in Dg] \end{axiom} And of course you can use this to produce a matrix. \begin{axiom} matrix % \end{axiom} From unknown Mon Dec 19 19:25:59 -0600 2005 From: unknown Date: Mon, 19 Dec 2005 19:25:59 -0600 Subject: Message-ID: <20051219192559-0600@wiki.axiom-developer.org> atan
Let's examine a simple case:
Dg := [p3 - 3*p2 + 3*p1 - p0,3*p2 - 6*p1 + 3*p0, 3*p1 - 3*p0, p0]
(1) |
Now calculate coefficients in two ways:
map(coefficients,Dg::List MPOLY([p0, p1, p2, p3], ?))
(2) |
and
map(coefficients,Dg::List MPOLY([p3, p2, p1, p0], ?))
(3) |
As you see the list are all reversed, but... they were not padded with zeros. While in my opinion they should be - we have a given order of variables, and alone 1 in the last list suggests that this is a coefficient of p3 while it isn't. It is a coefficient of p0.
According to the Axiom book function coefficients
does not
include zeros in the list. Furthermore it does not say explicitly
in what order the coefficients themselves are listed. Remember
that there are also terms of degree higher than 1. In fact the
two multivariate polynomials that you used above are formally
identical
(Dg::List MPOLY([p0,p1, p2, p3], ?)=Dg::List MPOLY([p3, p2, p1, p0], ?))::Boolean
(4) |
To produce a list of coefficients of the terms of degree 1,
including the zeros and in a specific order, use the function
coefficient
like this:
[[coefficient(p,x, 1) for x in [p0, p1, p2, p3]] for p in Dg]
(5) |
And of course you can use this to produce a matrix.
matrix %
(6) |