General routines Polynomials Making and building Further routines

Further routines

If we use the standard routine init, then we get an empty POLYNOM, which means, that the self is the NULL pointer and the next part is also NULL: But note that the example
main()
{ 
OP c;
anfang();
c =callocobject();
init(POLYNOM,c);
println(s_po_s(c));
freeall(c);
ende();
}
produces an error, because the self part is not yet initialised.

If you want to get a TeX-readable output of a polynom, then the standard routine tex() calls the special routine tex_polynom() which numbers the variables of the POLYNOMobject by a,b,c,….

The degree of a single-variable polynomial can be evaluated by The evaluation of a POLYNOM at a given value of the variables can be done as follows: You can also evaluate Gaussian polynomials: It is a well known fact, that for n given values at n given points, there is exactly one polynomial in one variable of degree n-1 with these values at these points, it is the so called Lagrange polynomial.
Example:
#include "def.h"
#include "macro.h"
main()
{
OP a,b,c;
anfang();
a=callocobject(); b=callocobject(); c=callocobject(); 
m_il_v(2L,a);
m_i_i(1L, s_v_i(a,0L));
m_i_i(7L, s_v_i(a,1L));
m_il_v(2L,b);
m_i_i(5L, s_v_i(b,0L));
m_i_i(7L, s_v_i(b,1L));
lagrange_polynom(a,b,c);println(c);
freeall(a); freeall(b); freeall(c); 
ende();
}
In order easily to build monomials we have the following routine which allows to build polynomials like a + b + c+…:
Example:
...
{
OP a,b;
INT i;
anfang();
a=callocobject(); b=callocobject(); 
for (i=0L; i<= 10L; i++) 
{
   m_iindex_monom(i,b); add(b,a,a); 
   mult(a,a,b); println(b);
}
freeall(a); freeall(b);
ende();
}
...
This routine is a special case of the following one: which allows you to generate the polynomial aiex: A routine that transforms an object into the constant term of a polynomial consisting of this term only: The product of polynomials on different alphabets:
Example: The following example program reads a POLYNOMobject and multiplies it with itself, assumming the two alphabets to be different
#include "def.h"
#include "macro.h"
main()
{
OP b,d;
anfang();
b=callocobject(); 
d=callocobject(); 
scan(POLYNOM,b);
mult_disjunkt_polynom_polynom(b,b,d);
println(d);
freeall(b); freeall(d);
ende();
}
The next routine allows the so-called Pólya-substitution (in two variables):
Example: The following example program computes the Pólya-substitution in a Schur polynomial (see the file ex21.c, a Pólya-substitution into cycle indicator polynomials can be found in ex20.c):
#include "def.h"
#include "macro.h"
main()
{
OP a,b,c,d;
anfang();
a=callocobject(); b=callocobject(); 
c=callocobject(); d=callocobject(); 
scan(PARTITION,a);println(a);
scan(INTEGER,b);println(b);
compute_schur_with_alphabet(a,b,c);println(c);
polya_sub(c,b,d); println(d);
freeall(a); freeall(b); freeall(c); freeall(d); 
ende();
}
There is also a routine that does Pólya-substitution in a prescribable number of indeterminates: Here is a test of the implementation of POLYNOMobjects: A routine for the test on unimodality (of a polynomial in a single variable):
harald.fripertinger "at" uni-graz.at, May 26, 2011

General routines Polynomials Making and building Uni-Graz Mathematik Further routines Valid HTML 4.0 Transitional Valid CSS!