/////////////////////////////////////////////////////////////////// // Moltiplicatori di Lagrange, esempio [CLO, p. 99, Example 3] // /////////////////////////////////////////////////////////////////// ring R = 0, (lambda,x,y,z), lp; // ordine lessicografico lambda > x > y > z option(redSB); poly f = x^3 + 2*x*y*z - z^2; // obiettivo poly g = x^2 + y^2 + z^2 - 1; // vincolo poly L = f - lambda * g; // lagrangiana ideal J = jacob(L); // ideale generato dalle derivate parziali della lagrangiana J; J[1]=-x^2-y^2-z^2+1 J[2]=-2*lambda*x+3*x^2+2*y*z J[3]=-2*lambda*y+2*x*z J[4]=-2*lambda*z+2*x*y-2*z ideal sJ = std(J); // base di Groebner per trovare i punti critici della lagrangiana // "a mano" dim(sJ); 0 sJ; sJ[1]=1152*z^7-1763*z^5+655*z^3-44*z sJ[2]=118*y*z^3-118*y*z-1152*z^6+1605*z^4-453*z^2 sJ[3]=3835*y^2*z-6912*z^5+10751*z^3-3839*z sJ[4]=3835*y^3+3835*y*z^2-3835*y-9216*z^5+11778*z^3-2562*z sJ[5]=3835*x*z+3835*y*z^2-1152*z^5-1404*z^3+2556*z sJ[6]=3835*x*y-19584*z^5+25987*z^3-6403*z sJ[7]=x^2+y^2+z^2-1 sJ[8]=7670*lambda-11505*x-11505*y*z-335232*z^6+477321*z^4-134419*z^2 factorize(sJ[1]); // per trovare le coordinate z dei punti critici, [1]: _[1]=1 _[2]=z-1 _[3]=z _[4]=128*z^2-11 _[5]=3*z-2 _[6]=z+1 _[7]=3*z+2 [2]: 1,1,1,1,1,1,1 // le coordinate y si trovano utilizzando sJ[2], sJ[3], sJ[4], // le x con sJ[5], sJ[6], sJ[7]; //////////////////////////////////////////////////////////////////////////// // I 10 punti critici si trovano piu' comodamente con il comando solve: // //////////////////////////////////////////////////////////////////////////// LIB "solve.lib"; // ** loaded /usr/bin/../share/singular/LIB/solve.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/ring.lib (4.0.2.2,Jan_2016) // ** loaded /usr/bin/../share/singular/LIB/primdec.lib (4.0.2.0,Apr_2015) // ** loaded /usr/bin/../share/singular/LIB/absfact.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/matrix.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/nctools.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/random.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/poly.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/elim.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/general.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/inout.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/triang.lib (4.0.0.0,Jun_2013) solve(sJ,6,0); [1]: [1]: -1 [2]: 0 [3]: 0 [4]: -1 [2]: [1]: -1 [2]: 0 [3]: 0 [4]: 1 [3]: [1]: -1.333333 [2]: -0.666667 [3]: -0.333333 [4]: -0.666667 [4]: [1]: 0.125 [2]: -0.375 [3]: 0.879453 [4]: -0.293151 [5]: [1]: 0.125 [2]: -0.375 [3]: -0.879453 [4]: 0.293151 [6]: [1]: -1.333333 [2]: -0.666667 [3]: 0.333333 [4]: 0.666667 [7]: [1]: 0 [2]: 0 [3]: -1 [4]: 0 [8]: [1]: 0 [2]: 0 [3]: 1 [4]: 0 [9]: [1]: -1.5 [2]: -1 [3]: 0 [4]: 0 [10]: [1]: 1.5 [2]: 1 [3]: 0 [4]: 0 // 'solve' created a ring, in which a list SOL of numbers (the complex solutions) // is stored. // To access the list of complex solutions, type (if the name R was assigned // to the return value): setring R; SOL; // characteristic : 0 (complex:6 digits, additional 6 digits) // 1 parameter : i // minpoly : (i^2+1) // number of vars : 4 // block 1 : ordering lp // : names lambda x y z // block 2 : ordering C def S = _; setring S; poly fS = imap(R,f); list l; // crea una lista vuota l int i; for (i=1; i<=10; i=i+1) {l=insert(l,subst(fS,x,SOL[i][2],y,SOL[i][3],z,SOL[i][4]),size(l));}; // ciclo for per elencare i valori di f nei punti critici l; [1]: -1 [2]: -1 [3]: -1.037037 [4]: 0.0546875 [5]: 0.0546875 [6]: -1.037037 [7]: 0 [8]: 0 [9]: -1 [10]: 1 setring R; subst(f,x,-2/3,y,1/3,z,2/3); -28/27 // vediamo che // min: f(-2/3,1/3,2/3) = f(-2/3,-1/3,-2/3) = -28/27, max: f(1,0,0) = 1 monitor(""); /////////////////////////////////////////////////////// // Punti singolari di curve, esempio [CLO, p. 146] // /////////////////////////////////////////////////////// ring R = 0, (x,y), lp; option(redSB); poly f = -1156+688*x^2-191*x^4+16*x^6+544*y+30*x^2*y-40*x^4*y+225*y^2 -96*x^2*y^2+16*x^4*y^2-136*y^3-32*x^2*y^3+16*y^4; // trovare i punti singolari della curva affina piana V(f) ideal F = f; ideal J = jacob(f); ideal I = F + J; // V(I) = unione dei punti singolari, il "luogo singolare" ideal sI = std(I); size(sI); 3 // dimensione del luogo singolare: dim(sI); 0 sI; sI[1]=16384y7-45056y6-89088y5-281344y4+753344y3+659568y2+918892y-3157937 sI[2]=4096xy6+6144xy5+3840xy4-54016xy3-41232xy2-10344xy+185761x sI[3]=311040x2+4096y6-14336y5-21760y4-66816y3+508528y2-45304y-1023859 factorize(sI[1]); // per trovare le ordinate dei punti singolari [1]: _[1]=1 _[2]=64y3+48y2+12y-431 _[3]=4y-17 [2]: 1,2,1 diff(_[1][2],y); // derivata del secondo fattore rispetto ad y 192y2+96y+12 _/192; // dividiamo la derivata per 192 y2+1/2y+1/16 ////////////////////////////////////////////////// // Altro metodo: utilizzare il comando solve. // ////////////////////////////////////////////////// LIB "solve.lib"; // ** loaded /usr/bin/../share/singular/LIB/solve.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/ring.lib (4.0.2.2,Jan_2016) // ** loaded /usr/bin/../share/singular/LIB/primdec.lib (4.0.2.0,Apr_2015) // ** loaded /usr/bin/../share/singular/LIB/absfact.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/matrix.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/nctools.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/random.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/poly.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/elim.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/general.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/inout.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/triang.lib (4.0.0.0,Jun_2013) solve(sI,6,0); [1]: [1]: 0 [2]: 4.25 [2]: [1]: -0.936845 [2]: 1.639882 [3]: [1]: 0.936845 [2]: 1.639882 [4]: [1]: (-2.543378+i*1.132524) [2]: (-1.194941-i*1.636685) [5]: [1]: (2.543378-i*1.132524) [2]: (-1.194941-i*1.636685) [6]: [1]: (-2.543378-i*1.132524) [2]: (-1.194941+i*1.636685) [7]: [1]: (2.543378+i*1.132524) [2]: (-1.194941+i*1.636685) // 'solve' created a ring, in which a list SOL of numbers (the complex solutions) // is stored. // To access the list of complex solutions, type (if the name R was assigned // to the return value): setring R; SOL; // characteristic : 0 (complex:6 digits, additional 6 digits) // 1 parameter : i // minpoly : (i^2+1) // number of vars : 2 // block 1 : ordering lp // : names x y // block 2 : ordering C // Ci sono 7 punti singolari di cui (i primi) 3 reali. LIB "sing.lib"; // ** loaded /usr/bin/../share/singular/LIB/sing.lib (4.0.0.0,Jun_2013) slocus(I); _[1]=16x6+16x4y2-40x4y-191x4-32x2y3-96x2y2+30x2y+688x2+16y4-136y3+225y2+544y-1156 _[2]=96x5+64x3y2-160x3y-764x3-64xy3-192xy2+60xy+1376x _[3]=32x4y-40x4-96x2y2-192x2y+30x2+64y3-408y2+450y+544 _[4]=-15360x8+10240x6y2+66560x6y+191104x6-10240x4y3-178176x4y2-4224x4y-719296x4-12288x2y4+347136x2y3+61056x2y2-1424640x2y+1299192x2+12288y5-15360y4-139392y3-128832y2+1095816y-619200 _[5]=-3072x9+2048x7y2+13312x7y+49280x7-4096x5y3-44544x5y2-49152x5y-241120x5+2048x3y4+45056x3y3+147072x3y2-301120x3y+522752x3+38400xy4-65280xy3-430560xy2+913920xy-586560x _[6]=-3072x8y+3840x8+2048x6y3+19968x6y2+37248x6y+21920x6-44544x4y3+118656x4y2-232992x4y-403320x4-6144x2y5+139776x2y4-106368x2y3-972960x2y2+1030128x2y+1288128x2+4096y6-13824y5-53376y4+57632y3+638856y2-651840y-748544 ////////////////////////////////////////////////////////// // Altro metodo ancora: utilizzare il comando slocus. // ////////////////////////////////////////////////////////// LIB "sing.lib"; // ** loaded /usr/bin/../share/singular/LIB/sing.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/primdec.lib (4.0.2.0,Apr_2015) // ** loaded /usr/bin/../share/singular/LIB/ring.lib (4.0.2.2,Jan_2016) // ** loaded /usr/bin/../share/singular/LIB/absfact.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/triang.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/matrix.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/nctools.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/poly.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/elim.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/general.lib (4.0.0.1,Jan_2014) // ** loaded /usr/bin/../share/singular/LIB/random.lib (4.0.0.0,Jun_2013) // ** loaded /usr/bin/../share/singular/LIB/inout.lib (4.0.0.0,Jun_2013) // si ricordi che f era il polinimio che definisce la curva // V(slocus(f)) e' il luogo singolare della curva slocus(f); _[1]=16x6+16x4y2-40x4y-191x4-32x2y3-96x2y2+30x2y+688x2+16y4-136y3+225y2+544y-1156 _[2]=32x4y-40x4-96x2y2-192x2y+30x2+64y3-408y2+450y+544 _[3]=96x5+64x3y2-160x3y-764x3-64xy3-192xy2+60xy+1376x solve(_,10,0); [1]: [1]: 0 [2]: 4.25 [2]: [1]: -0.9368449279 [2]: 1.6398815748 [3]: [1]: 0.9368449279 [2]: 1.6398815748 [4]: [1]: (-2.54337804+i*1.1325242008) [2]: (-1.1949407874-i*1.636685454) [5]: [1]: (2.54337804-i*1.1325242008) [2]: (-1.1949407874-i*1.636685454) [6]: [1]: (-2.54337804-i*1.1325242008) [2]: (-1.1949407874+i*1.636685454) [7]: [1]: (2.54337804+i*1.1325242008) [2]: (-1.1949407874+i*1.636685454) // 'solve' created a ring, in which a list SOL of numbers (the complex solutions) // is stored. // To access the list of complex solutions, type (if the name R was assigned // to the return value): setring R; SOL; // characteristic : 0 (complex:10 digits, additional 10 digits) // 1 parameter : i // minpoly : (i^2+1) // number of vars : 2 // block 1 : ordering lp // : names x y // block 2 : ordering C monitor("");