This file is indexed.

/usr/share/axiom-20170501/src/algebra/GDRAW.spad is in axiom-source 20170501-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
)abbrev package GDRAW GnuDraw
++ Author: Bill Page and David Cyganski
++ Date: June 25, 2008
++ Description:
++ This package provides support for gnuplot. These routines
++ generate output files contain gnuplot scripts that may be
++ processed directly by gnuplot. This is especially convenient
++ in the axiom-wiki environment where gnuplot is called from
++ LaTeX via gnuplottex.

GnuDraw() : SIG == CODE where

 EF    ==> Expression Float
 SBF   ==> SegmentBinding Float
 DROP  ==> DrawOption
 DROP0 ==> DrawOptionFunctions0
 STR   ==> String

 SIG ==> with

  gnuDraw : (EF, SBF, STR, List DROP)->Void
    ++ \spad{gnuDraw} provides 2d plotting with options
    ++
    ++X gnuDraw(D(cos(exp(z))/exp(z^2),z),z=-5..5,"out2d.dat",title=="out2d")
    ++X )sys gnuplot -persist out2d.dat
    ++X )sys evince out2d.dat.ps    -- linux
    ++X )sys open out2d.dat.ps      -- mac
    ++X )sys firefox out2d.dat.ps   -- everywhere

  gnuDraw : (EF, SBF, STR)->Void
    ++ \spad{gnuDraw} provides 2d plotting, default options
    ++
    ++X gnuDraw(D(cos(exp(z))/exp(z^2),z),z=-5..5,"out2d.dat")
    ++X )sys gnuplot -persist out2d.dat
    ++X )sys evince out2d.dat.ps    -- linux
    ++X )sys open out2d.dat.ps      -- mac
    ++X )sys firefox out2d.dat.ps   -- everywhere

  gnuDraw : (EF, SBF, SBF, STR, List DROP)->Void
    ++ \spad{gnuDraw} provides 3d surface plotting with options
    ++
    ++X gnuDraw(sin(x)*cos(y),x=-6..4,y=-4..6,"out3d.dat",title=="out3d")
    ++X )sys gnuplot -persist out3d.dat
    ++X )sys evince out2d.dat.ps    -- linux
    ++X )sys open out2d.dat.ps      -- mac
    ++X )sys firefox out2d.dat.ps   -- everywhere

  gnuDraw : (EF, SBF, SBF, STR)->Void
    ++ \spad{gnuDraw} provides 3d surface plotting, default options
    ++
    ++X gnuDraw(sin(x)*cos(y),x=-6..4,y=-4..6,"out3d.dat")
    ++X )sys gnuplot -persist out3d.dat
    ++X )sys evince out2d.dat.ps    -- linux
    ++X )sys open out2d.dat.ps      -- mac
    ++X )sys firefox out2d.dat.ps   -- everywhere

 CODE ==> add

  -- 2-d plotting
  gnuDraw(f:EF,segbind:SBF,filename:STR,opts:List DROP):Void ==
    import TwoDimensionalViewport, GraphImage, TopLevelDrawFunctions EF
    f1:TextFile:=open(filename::FileName,"output")
    -- handle optional parameters
    writeLine!(f1,"set terminal postscript color solid")
    writeLine!(f1,concat(["set output _"",filename,".ps_""]))
    writeLine!(f1,concat(["set title _"",title(opts,"")$DROP0,"_""]))
    writeLine!(f1,"plot '-' title '' lw 3 with lines")
    -- extract data as List List Point DoubleFloat
    p2:=pointLists(getGraph(draw(f, segbind),1));
    for p1 in p2 repeat
      for p in p1 repeat
        writeLine!(f1,concat([unparse(convert(p.1)@InputForm)," ",
                              unparse(convert(p.2)@InputForm)]))
      writeLine!(f1); -- blank line need to mark a "branch"
    close! f1

  -- default title is ""
  gnuDraw(f:EF,segbind:SBF,filename:STR):Void ==
    gnuDraw(f,segbind,filename,[title("")$DROP])

  -- 3-d plotting
  gnuDraw(f:EF,segbind1:SBF,segbind2:SBF,filename:STR,opts:List DROP):Void ==
    import SubSpace, ThreeSpace DoubleFloat, TopLevelDrawFunctions EF
    f1:TextFile:=open(filename::FileName,"output")
    -- process optional parameters
    writeLine!(f1,concat(["set title _"",title(opts,"")$DROP0,"_""]))
    writeLine!(f1,"splot '-' title '' with pm3d")
    -- extract data as List List Point DoubleFloat
    p2:=mesh(subspace(draw(f, segbind1, segbind2)));
    for p1 in p2 repeat
      for p in p1 repeat
        writeLine!(f1,concat([unparse(convert(p.1)@InputForm)," ",
                              unparse(convert(p.2)@InputForm)," ",
                              unparse(convert(p.3)@InputForm)]))
      writeLine!(f1); -- blank line need to mark a "branch"
    close! f1

  -- default title is ""
  gnuDraw(f:EF,segbind1:SBF, segbind2:SBF, filename:STR):Void ==
    gnuDraw(f,segbind1,segbind2,filename,[title("")$DROP])