//////////////////////////////////////////////////////////////// version="version ComAlgLib 4.1.1.0 May_2019"; //$Id: eecdbafd0811d291ba6adc1fc144d110da851fcd $ category="Teaching"; info=" AUTHORS: Raul Epure, epure@mathematik.uni-kl.de REFERENCES: PROCEDURES: "; ////First programming exercise//// proc aufgabe1 (list P, ideal I, poly f) "USAGE: aufgabe1(P,I,f); The list P of pairs of polynomials is expanded by pairs (f,fi) with fi in I. RETURN: list P as described above. EXAMPLE: example aufgabe1; shows an example" { int numGenerators = ncols(I); int listSize = size(P); list L = P; //copy list P into new list for (int i = 1; i <= numGenerators; i++) { // add pair (f,f_i) to the list L[listSize + i] = list(f,I[i]); } return(L); } example { "EXAMPLE: "; echo = 2; ring r = 0,(x,y),dp; poly f = x^2; list P = list(x,y), list(2x+y,y^3); ideal I = 3x^2+4y,xy2,x+y+x^2+y^2; list L = aufgabe1(P,I,f); L; } ////Second programming exercise//// proc aufgabe2 (poly f, int n) "USAGE: aufgabe2(f,n); Returns the series expansion of up to order n or returns an error if f is not invertible. RETURN: see above EXAMPLE: example aufgabe2; shows an example of an expansion and returning zero" { // Dummy variables: int i; poly g,h; // Computing result: if(leadmonom(f)!=1) { ERROR("Polynomial is not invertible."); } else { //Initialize von g,h,i i=0; g=0; h= 1/leadcoef(f)*(lead(f)-f); //Compute g=1/(f)=1/1-(1-f): while (deg(g)<=n) { g=g+h^i; i++; } /// Truncate terms of order higher than n g=1/leadcoef(f) * g; g=jet(g,n); return(g); } } example { "EXAMPLE:"; echo=2; ring r=0,(x,y,z),ds; int n=5; poly f=xyz2; poly g=2+x2y2z2; aufgabe2(g,n); aufgabe2(f,n); }