Changeset d85126 in git
- Timestamp:
- Jul 21, 2005, 11:19:42 AM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 54e883b94f59e2e4f4eae57d4ab1d445925534ad
- Parents:
- 634dab087e9b393fec1655c78c584e20750b3db3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/surf.lib
r634dab0 rd85126 1 // last change: 02.03.2001 (Eric Westenberger)1 // last modified 21.07.2005, Oliver Wienand 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: surf.lib,v 1.2 4 2005-05-06 14:39:19 hannesExp $";3 version="$Id: surf.lib,v 1.25 2005-07-21 09:19:42 wienand Exp $"; 4 4 category="Visualization"; 5 5 info=" … … 39 39 } 40 40 41 proc 41 proc plot(ideal I,list #) 42 42 "USAGE: plot(I); I ideal or poly 43 43 ASSUME: I defines a plane curve or a surface given by one equation 44 44 RETURN: nothing 45 NOTE: requires the external program 'surf' to be installed 45 NOTE: requires the external program 'surf' to be installed, to close the graphical just press 'Q' 46 46 EXAMPLE: example plot; shows an example 47 47 " 48 48 { 49 string extra_surf_opts=" -x "; // remove this line for surf 0.950 string l ="/tmp/surf"+string(system("pid"));49 string extra_surf_opts=" -x --auto-resize "; // remove this line for surf 0.9 50 string l = "/tmp/surf"+string(system("pid")); 51 51 string err_mes; // string containing error messages 52 52 def base=basering; … … 96 96 if (ncols(I)==1 and (n==3 or nvars(base)==3)) // surface 97 97 { 98 write(":w "+l, 99 "root_finder=d_chain_bisection;epsilon=0.0000000001;iterations=20000;"); 100 write(l, "width=500; height=500; set_size; do_background=yes; 101 background_red=255; background_green=255; background_blue=255;"); 102 write(l,"rot_x=0.14; rot_y=-0.3;"); 103 if (size(#)>0) 104 { 105 write(l,#[1]); 106 } 107 write(l,"surface=",I[1],";"); 108 write(l,"draw_surface;"); 98 write(":w " + l, 99 "root_finder=d_chain_bisection;epsilon=0.0000000001;iterations=20000;"); 100 write(l, "width=500; height=500; set_size; do_background=yes; background_red=255; background_green=255; background_blue=255;"); 101 write(l, "rot_x=0.14; rot_y=-0.3;"); 102 if (size(#) > 0) 103 { 104 write(l, #[1]); 105 } 106 write(l, "surface=",I[1],";"); 107 write(l, "draw_surface;"); 109 108 } 110 109 else 111 110 { 112 err_mes ="cannot plot "+string(ncols(I))+" equations in "113 +string(n)+" variables";111 err_mes = "cannot plot " + string(ncols(I)) + " equations in " 112 + string(n) + " variables"; 114 113 ERROR(err_mes); 115 114 } … … 119 118 if (defined(extra_surf_opts)) 120 119 { 121 surf_call = surf_call + extra_surf_opts + " ";120 surf_call = surf_call + " " + extra_surf_opts; 122 121 } 123 surf_call =surf_call + l +" >/dev/null 2>&1";122 surf_call =surf_call + l + " >/dev/null 2>&1"; 124 123 125 if ("ppcMac-darwin"!=system("uname")){126 i=system("sh", surf_call);124 if ("ppcMac-darwin" != system("uname")) { 125 i=system("sh", surf_call); 127 126 } else { 128 surf_call= surf_call + " || "+ "singularsurf " +129 extra_surf_opts + " " +l +" >/dev/null 2>&1";130 i=system("sh",surf_call);127 surf_call = surf_call + " || " + "singularsurf " 128 + extra_surf_opts + " " + l +" >/dev/null 2>&1"; 129 i = system("sh", surf_call); 131 130 } 132 131 133 if (i !=0)132 if (i != 0) 134 133 { 135 134 err_mes = "calling `surf` failed. (the shell return the error code " 136 + string(i)+")."+newline+137 "probably the executable `surf` is not found.";135 + string(i) + ")." + newline + 136 "probably the executable `surf` is not found."; 138 137 ERROR(err_mes); 139 138 } 140 i =system("sh","/bin/rm "+l);139 i = system("sh", "/bin/rm "+l); 141 140 } 142 141 example 143 { "EXAMPLE:"; echo = 2;142 { "EXAMPLE:"; echo = 2; 144 143 // --------- plane curves ------------ 145 144 ring rr0 = 0,(x1,x2),dp;
Note: See TracChangeset
for help on using the changeset viewer.