Changeset 94b16b in git
- Timestamp:
- Feb 10, 2009, 12:06:20 PM (14 years ago)
- Branches:
- (u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
- Children:
- ddc52f476994f64e5e45e74617b4caac7a4162bc
- Parents:
- 6623f3f780187952c14ea18c3548ce12c10af980
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/surf.lib
r6623f3 r94b16b 1 1 // last modified 21.07.2005, Oliver Wienand 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: surf.lib,v 1. 29 2008-12-12 17:27:01Singular Exp $";3 version="$Id: surf.lib,v 1.30 2009-02-10 11:06:20 Singular Exp $"; 4 4 category="Visualization"; 5 5 info=" … … 11 11 @texinfo 12 12 To use this library requires the program @code{surf} to be installed. 13 @code{surf} is only available for Linux PCs and Sun workstations.14 13 You can download @code{surf} either from 15 14 @uref{http://sourceforge.net/projects/surf} 16 15 or from @uref{ftp://www.mathematik.uni-kl.de/pub/Math/Singular/utils/}. 16 The procedure surfer requires the program @code{surfer} to be installed. 17 You can download @code{surfer} from 18 @uref{http://www.imaginary2008.de/surfer.php} 17 19 @end texinfo 18 20 … … 144 146 145 147 "Press q to exit from 'surf'"; 146 if ("ppcMac-darwin" != system("uname")) { 148 if ("ppcMac-darwin" != system("uname")) 149 { 147 150 i=system("sh", surf_call); 148 } else { 151 } 152 else 153 { 149 154 surf_call = surf_call + " || " + "singularsurf " 150 155 + extra_surf_opts + " " + l +" >/dev/null 2>&1"; … … 191 196 192 197 } 198 proc surfer(ideal f) 199 "USAGE: surfer(f); f poly 200 ASSUME: f defines a surface given by one equation 201 RETURN: nothing 202 NOTE: requires the external program 'surfer' to be installed, 203 to close the graphical interface just close the window of surfer 204 EXAMPLE: example surfer; shows an example 205 " 206 { 207 string l = "/tmp/surf"+string(system("pid")); 208 string err_mes; // string containing error messages 209 def base=basering; 210 intvec v=num_of_vars(I); 211 int i,j,n; 212 for(i=size(v);i>0;i--) 213 { 214 if (v[i]!=0) { n++; } 215 } 216 if (n==0 or n>3) 217 { 218 err_mes="Cannot plot equations with "+string(n)+" variables"; 219 ERROR(err_mes); 220 } 221 ring r=0,(x,y,z),dp; 222 short=0; 223 map phi=base,0; 224 j=1; 225 for(i=1;i<=size(v);i++) 226 { 227 if (v[i]!=0) 228 { 229 phi[i]=var(j); 230 j++; 231 if(j==4) break; 232 } 233 } 234 ideal I=simplify(phi(I),2); 235 if (leadcoef(I[1]) <0) { I[1]=-I[1]; } 236 if (ncols(I)==1 and (n==3 or nvars(base)==3)) // surface 237 { 238 write(":w " + l, "surface=",I[1],";"); 239 } 240 else 241 { 242 err_mes = "cannot plot " + string(ncols(I)) + " equations in " 243 + string(n) + " variables"; 244 ERROR(err_mes); 245 } 246 string surf_call; 247 surf_call ="surfer " + l + " >/dev/null 2>&1"; 248 249 "Close window to exit from 'surfer'"; 250 i=system("sh", surf_call); 251 252 if (i != 0) 253 { 254 err_mes = "calling `surfer` failed. (the shell return the error code " 255 + string(i) + ")." + newline + 256 "probably the executable `surfer` is not found."; 257 ERROR(err_mes); 258 } 259 i = system("sh", "/bin/rm "+l); 260 } 261 example 262 { "EXAMPLE:"; echo = 2; 263 ring rr1 = 0,(x,y,z),dp; 264 // Steiner surface 265 ideal J(2) = x^2*y^2+x^2*z^2+y^2*z^2-17*x*y*z; 266 surfer(J(2)); 267 268 // -------------------- 269 surfer(x*(x2-y2)+z2); 270 271 // E7 272 surfer(x^3-x*y^3+z^2); 273 274 // Whitney umbrella 275 surfer(z^2-x^2*y); 276 277 } 193 278 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.