[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-mail] Help on polynomial coefficients
From: |
root |
Subject: |
Re: [Axiom-mail] Help on polynomial coefficients |
Date: |
Thu, 4 Sep 2008 07:11:56 -0400 |
>I am making a program to find a polynomial P(x,y) that is the solution to a
>given system. The degree of P is given. I need one variable to represent
>each coefficient P, so I can find all coefficients, determining the
>polinomial.
>Problem is, I don't know how to assign one variable to each coefficient, as
>I don't know in advance the degree of P, thus don't even know in advance how
>many coefficients I am going to use
>
>What I wish I could do is, given the degree P, build P as a sum of terms
>where each coefficient is a variable.
>If my degree was 1, for example, I want to build P as
>P:=A*x+B*y+C
>If my degree was 2, I would have:
>P:=A*x^2 + B*y^2 +C*x*y +D*x +E*y +F
>I have no idea how to do it for a general degree, on axiom
I'm not sure I understand your question fully.
You can generate coefficients quite simply with:
a:=[subscript(A,[i]) for i in 1..5]
[A ,A ,A ,A ,A ]
1 2 3 4 5
and you can construct polynomial with
f:=subscript(A,[0])
for i in 1..5 repeat f:=y**i*a.i
f
5 4 3 2
A y + A y + A y + A y + A y + A
5 4 3 2 1 0
Perhaps you could say more about the general pattern you want.
Tim