RFC: extracting coefficients of a multivariate polynomial
Subject: RFC: extracting coefficients of a multivariate polynomial
From: andre maute
Date: Thu, 24 Apr 2008 23:01:39 +0200
> You're doing several substitutions, re-assignments, and three loops. Did
> you try Fateman's code in his reply? I would bet that it will run
> faster. It does one nested loop and functions written in lisp. Also, you
> could try the 'compile' option.
I never got the replies from Fateman with KMail under KDE.
Using the web interface of the mailinglist I saw them the first time.
the substs can easilly be removed, they are a leftover from a maple migration.
the timing for Fateman's
my_coeff5 : 14m10.050s
the fastest is at the moment
my_coeff6: 13m49.501s
I'm using maxima 5.13.0 with clisp 2.41
-------------------------------------------------------
my_coeff6(v,exps,poly) := block(
[c,k,l,h],
c : [],
for k : 1 thru length(exps) do block(
h : poly,
for l : 1 thru length(v) do block(
h : coeff(h,v[l],exps[k][l])
),
h : ratsimp(h),
c : append(c,[h])
),
return(c)
)$
-------------------------------------------------------
I expected a more sensational speedup.
>
> Having written your program, try
> compile(all);
I'll try it.
> Where are these polynomials coming from? Can you convert them to rat form
> *once* instead of each time you call my_coeff?
Polynomials living on 3d solids.
Products of different Jacobi Polynomials and Lagrange Polynomials,
with an additional nonlinear transformation.
They are generated *once*, expanded *once*, then the coefficients are computed
*once* and dumped *once* to a text file. ;-)
I only wanted to minimize the maintainment hassle
for the Maxima part of my application.
Nevertheless, thank you all
Andre
> and then execute it.
>
> HTH,
> -sen