Changeset 590998 in git
 Timestamp:
 Dec 12, 2000, 2:50:08 PM (22 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
 Children:
 8893c4b18dc23caf911d7ec697a8a89d60b36248
 Parents:
 ebbe4a2df3136602d7e171ea5a1f83cca4c3e013
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/poly.lib
rebbe4a r590998 1 // $Id: poly.lib,v 1.2 6 20000512 12:17:16 kruegerExp $1 // $Id: poly.lib,v 1.27 20001212 13:50:08 anne Exp $ 2 2 //(GMG, last modified 22.06.96) 3 3 //(obachman: 17.12.97  added katsura) 4 /////////////////////////////////////////////////////////////////////////////// 5 6 version="$Id: poly.lib,v 1.26 20000512 12:17:16 krueger Exp $"; 4 //(anne: 11.12.2000  added mod2id, id2mod, subrInterred) 5 /////////////////////////////////////////////////////////////////////////////// 6 7 version="$Id: poly.lib,v 1.27 20001212 13:50:08 anne Exp $"; 7 8 info=" 8 9 LIBRARY: poly.lib PROCEDURES FOR MANIPULATING POLYS, IDEALS, MODULES … … 25 26 numerator(n); numerator of number n 26 27 denominator(n) denominator of number n 28 mod2id(M,iv); conversion of a module M to an ideal 29 id2mod(i,iv); conversion inverse to mod2id 30 subrInterred(i1,i2,iv);interred w.r.t. a subset of variables 27 31 (parameters in square brackets [] are optional) 28 32 "; … … 718 722 denominator(n); 719 723 } 724 //////////////////////////////////////////////////////////////////////// 725 726 proc mod2id(matrix M,intvec vpos) 727 "USAGE: mod2id(M,vpos); M matrix, vpos intvec 728 ASSUME: vpos is an integer vector such that gen(i) corresponds 729 to var(vpos[i]) 730 the basering contains variables var(vpos[i]) which do not occur 731 in M 732 NOTE: this procedure should be used in the following situation: 733 one wants to pass to a ring with new variables, say e(1),..,e(s), 734 which correspond to the components gen(1),..,gen(s) of the 735 module M such that e(i)*e(j)=0 for all i,j 736 the new ring should already exist and be the current ring 737 RETURN: ideal i in which each gen(i) from the module is replaced by 738 var(vpos[i]) and all monomials var(vpos[i])*var(vpos[j]) have 739 been added to the generating set of i 740 EXAMPLE: example mod2id; shows an example" 741 { 742 int p = printlevelvoice+3; // p=printlevel+1 (default: p=1) 743 // 744 // define the ideal generated by the var(vpos[i]) and set up the matrix 745 // for the multiplication 746 // 747 ideal vars=var(vpos[1]); 748 for(int i=2;i<=size(vpos);i++) 749 { 750 vars=vars,var(vpos[i]); 751 } 752 matrix varm[1][size(vpos)]=vars; 753 if (size(vpos) > nrows(M)) 754 { 755 matrix Mt[size(vpos)][ncols(M)]; 756 Mt[1..nrows(M),1..ncols(M)]=M; 757 kill M; 758 matrix M=Mt; 759 } 760 // 761 // define the desired ideal 762 // 763 ideal ret=vars^2,varm*M; 764 return(ret); 765 } 766 example 767 { "EXAMPLE:"; echo=2; 768 ring r=0,(e(1),e(2),x,y,z),(dp(2),ds(3)); 769 module mo=x*gen(1)+y*gen(2); 770 intvec iv=2,1; 771 mod2id(mo,iv); 772 } 773 //////////////////////////////////////////////////////////////////////// 774 775 proc id2mod(ideal i,intvec vpos) 776 "USAGE: id2mod(I,vpos); I ideal, vpos intvec 777 NOTE: * use this procedure only makes sense if the ideal contains 778 all var(vpos[i])*var(vpos[j]) as monomial generators and 779 all other generators are linear combinations of the 780 var(vpos[i]) over the ring in the other variables 781 * this is the inverse procedure to mod2id and should be applied 782 only to ideals created by mod2id using the same intvec vpos 783 (possibly after a standard basis computation) 784 RETURN: module corresponding to the ideal by replacing var(vpos[i]) by 785 gen(i) and omitting all generators var(vpos[i])*var(vpos[j]) 786 EXAMPLE: example id2mod; shows an example" 787 { 788 int p = printlevelvoice+3; // p=printlevel+1 (default: p=1) 789 // 790 // Initialization 791 // 792 int n=size(i); 793 int v=size(vpos); 794 matrix tempmat; 795 matrix mm[v][n]; 796 // 797 // Conversion 798 // 799 for(int j=1;j<=v;j++) 800 { 801 tempmat=coeffs(i,var(vpos[j])); 802 mm[j,1..n]=tempmat[2,1..n]; 803 } 804 for(j=1;j<=v;j++) 805 { 806 mm=subst(mm,var(vpos[j]),0); 807 } 808 module ret=simplify(mm,10); 809 return(ret); 810 } 811 example 812 { "EXAMPLE:"; echo=2; 813 ring r=0,(e(1),e(2),x,y,z),(dp(2),ds(3)); 814 ideal i=e(2)^2,e(1)*e(2),e(1)^2,e(1)*y+e(2)*x; 815 intvec iv=2,1; 816 id2mod(i,iv); 817 } 818 /////////////////////////////////////////////////////////////////////// 819 820 proc subrInterred(ideal mon, ideal sm, intvec iv) 821 "USAGE: subrInterred(mon,sm,iv); 822 sm: ideal in a ring r with n + s variables, 823 e.g. x_1,..,x_n and t_1,..,t_s 824 mon: ideal with monomial generators (not divisible by 825 one of the t_i) such that sm is contained in the module 826 k[t_1,..,t_s]*mon[1]+..+k[t_1,..,t_s]*mon[size(mon)] 827 iv: intvec listing the variables which are supposed to be used 828 as x_i 829 RETURN: list l: 830 l[1]=the monomials from mon in the order used 831 l[2]=their coefficients after interreduction 832 l[3]=l[1]*l[2] 833 (interreduced system of generators of sm seen as a submodule 834 of k[t_1,..,t_s]*mon[1]+..+k[t_1,..,t_s]*mon[size(mon)]) 835 EXAMPLE: example subrInterred; shows an example" 836 { 837 int p = printlevelvoice+3; // p=printlevel+1 (default: p=1) 838 // 839 // check that mon is really generated by monomials 840 // and sort its generators with respect to the monomial ordering 841 // 842 int err; 843 for(int i=1;i<=ncols(mon);i++) 844 { 845 if ( size(mon[i]) > 1 ) 846 { 847 err=1; 848 } 849 } 850 if (err==1) 851 { 852 ERROR("mon has to be generated by monomials"); 853 } 854 intvec sv=sortvec(mon); 855 ideal mons; 856 for(i=1;i<=size(sv);i++) 857 { 858 mons[i]=mon[sv[i]]; 859 } 860 ideal itemp=maxideal(1); 861 for(i=1;i<=size(iv);i++) 862 { 863 itemp=subst(itemp,var(iv[i]),0); 864 } 865 itemp=simplify(itemp,10); 866 def r=basering; 867 string tempstr="ring rtemp=" + charstr(basering) + ",(" + string(itemp) 868 + "),(C,dp);"; 869 // 870 // express m in terms of the generators of mon and check whether m 871 // can be considered as a submodule of k[t_1,..,t_n]*mon 872 // 873 module motemp; 874 motemp[ncols(sm)]=0; 875 poly ptemp; 876 int j; 877 for(i=1;i<=ncols(mons);i++) 878 { 879 for(j=1;j<=ncols(sm);j++) 880 { 881 ptemp=sm[j]/mons[i]; 882 motemp[j]=motemp[j]+ptemp*gen(i); 883 } 884 } 885 for(i=1;i<=size(iv);i++) 886 { 887 motemp=subst(motemp,var(iv[i]),0); 888 } 889 matrix monmat[1][ncols(mons)]=mons; 890 ideal dummy=monmat*motemp; 891 for(i=1;i<=size(sm);i++) 892 { 893 if(sm[i]dummy[i]!=0) 894 { 895 ERROR("the second argument is not a submodule of the assumed structure"); 896 } 897 } 898 // 899 // do the interreduction and convert back 900 // 901 execute(tempstr); 902 def motemp=imap(r,motemp); 903 motemp=interred(motemp); 904 setring r; 905 kill motemp; 906 def motemp=imap(rtemp,motemp); 907 list ret=monmat,motemp,monmat*motemp; 908 for(i=1;i<=ncols(ret[2]);i++) 909 { 910 ret[2][i]=cleardenom(ret[2][i]); 911 } 912 for(i=1;i<=ncols(ret[3]);i++) 913 { 914 ret[3][i]=cleardenom(ret[3][i]); 915 } 916 return(ret); 917 } 918 example 919 { "EXAMPLE:"; echo=2; 920 ring r=0,(x,y,z),dp; 921 ideal i=x^2+x*y^2,x*y+x^2*y,z; 922 ideal j=x^2+x*y^2,x*y,z; 923 ideal mon=x^2,z,x*y; 924 intvec iv=1,3; 925 subrInterred(mon,i,iv); 926 subrInterred(mon,j,iv); 927 } 928 //////////////////////////////////////////////////////////////////////// 720 929 721 930
Note: See TracChangeset
for help on using the changeset viewer.