Changeset 94b16b in git


Ignore:
Timestamp:
Feb 10, 2009, 12:06:20 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
ddc52f476994f64e5e45e74617b4caac7a4162bc
Parents:
6623f3f780187952c14ea18c3548ce12c10af980
Message:
*hannes: include surfer


git-svn-id: file:///usr/local/Singular/svn/trunk@11360 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/surf.lib

    r6623f3 r94b16b  
    11// last modified 21.07.2005, Oliver Wienand
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: surf.lib,v 1.29 2008-12-12 17:27:01 Singular Exp $";
     3version="$Id: surf.lib,v 1.30 2009-02-10 11:06:20 Singular Exp $";
    44category="Visualization";
    55info="
     
    1111 @texinfo
    1212 To use this library requires the program @code{surf} to be installed.
    13  @code{surf} is only available for Linux PCs and Sun workstations.
    1413 You can download @code{surf} either from
    1514  @uref{http://sourceforge.net/projects/surf}
    1615  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}
    1719 @end texinfo
    1820
     
    144146
    145147  "Press q to exit from 'surf'";
    146   if ("ppcMac-darwin" != system("uname")) {
     148  if ("ppcMac-darwin" != system("uname"))
     149  {
    147150     i=system("sh", surf_call);
    148   } else {
     151  }
     152  else
     153  {
    149154     surf_call = surf_call + " || " + "singularsurf "
    150155                 + extra_surf_opts + " " + l +" >/dev/null 2>&1";
     
    191196
    192197}
     198proc surfer(ideal f)
     199"USAGE:   surfer(f);  f poly
     200ASSUME: f defines a surface given by one equation
     201RETURN: nothing
     202NOTE: requires the external program 'surfer' to be installed,
     203      to close the graphical interface just close the window of surfer
     204EXAMPLE: 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}
     261example
     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}
    193278///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.