| 1 2 | ||
|
Editor: Bill Page
Time: 2008/06/26 19:21:25 GMT-7 |
||
| Note: gnuDraw | ||
removed: -The 'draw' command works only under an X-Windows environment (unix/linux). -Work is underway to create a new user interface (AxiomUI) that among other -things will allow graphics to be viewed under other operating systems. If -you're interested in graphics, please pitch in! - changed: -The graphics commands are described in Chapter 7 of the AxiomBook. The graphics commands are described in Chapter 7 of the AxiomBook. added: <em> The 'draw' command works only under an X-Windows environment (unix/linux). Work is underway to create a new user interface (AxiomUI) that among other things will allow graphics to be viewed under other operating systems. If you're interested in graphics, please pitch in! </em> changed: -environment on the Web server) we are not yet able to display the -graph here . But we can still extract the graph data from the view -port. Then for example we can display the list of data points that -would be plotted in the graph. environment on the Web server) we are not yet able to display the graph here. However we description below a similar command named 'gnuDraw' that can be used to generate similar graphics on this web site. gnuDraw It is possible to produce graphics similar to Axioms using gnuplot on this web site. To do this you need to include the GnuDraw (GDRAW) library \begin{axiom} )lib GDRAW \end{axiom} The following examples are taken from Chapter 7 Graphics of the AxiomBook. Section: 7.1 Two-Dimensional Graphics The general format for drawing a function defined by a formula f(x) is:: gnudraw(f(x), x = a..b, "filename.dat", options) where a..b defines the range of x, 'options' are additional draw options and "filename.dat" will contain the gnuplot script necessary to create the graph. \begin{axiom} gnuDraw(sin(x), x=%pi/10..%pi,"AxiomGraphics1.dat") \end{axiom} This file may be displayed on the web page using:: !/begin{gnuplot} load "filename.dat" /end{gnuplot} \begin{gnuplot} load "AxiomGraphics1.dat" \end{gnuplot} Technical Details We can extract the graph data from the view port. For example we can display the list of data points that would be plotted in the graph. removed: - - -Obsolete Instructions - - You need the latest version of Axiom from the Savannah CVS:: - - cd /tmp <-- or someplace where you want axiom - export CVS_RSH=ssh - cvs -z3 -d:ext:anoncvs@savannah.gnu.org/cvsroot/axiom co axiom - cd axiom - export AXIOM=/tmp/axiom/mnt/linux - export PATH=$AXIOM/bin:$PATH - make - .... (get coffee) - sman (lots of warnings but the axiom interpreter should start) - draw(sin(x), x=-10..10) - draw(sin(x*y), x=-10..10, y=-10..10) - -The sman process will eventually be merged into the axiom command -as soon as I finish up the graphics integration. The sman (superman) -process is used to communicate between the axiom interpreter and the -graphics process. If you just start axiom directly with the axiom -command rather than the sman command the draw function won't -do anything. - - -- or -- - -You need the latest version of Axiom from the arch website:: - - cd /tmp <-- or someplace where you want axiom - tla get axiom--main--1 axiom - cd axiom - export AXIOM=/tmp/axiom/mnt/linux - export PATH=$AXIOM/bin:$PATH - make - .... (get coffee) - sman (lots of warnings but the axiom interpreter should start) - draw(sin(x), x=-10..10) - draw(sin(x*y), x=-10..10, y=-10..10) - -The sman process will eventually be merged into the axiom command -as soon as I finish up the graphics integration. The sman (superman) -process is used to communicate between the axiom interpreter and the -graphics process. If you just start axiom directly with the axiom -command rather than the sman command the draw function won't -do anything. -
The graphics commands are described in Chapter 7 of the AxiomBook. The syntax is:
draw(f(x), x=a..b, options)
draw(f(x,y), x=a..b, y=c..d, options)
vp1:=draw(sin(x), x=%pi/10..%pi)
Compiling function %B with type DoubleFloat -> DoubleFloat Graph data being transmitted to the viewport manager... FriCAS2D data being transmitted to the viewport manager...
| (1) |
This command creates a "view port" and would normally (on linux for example) also display the graph.
The draw command works only under an X-Windows environment
(unix/linux). Work is underway to create a new user interface
(AxiomUI) that among other things will allow graphics to be
viewed under other operating systems. If you're interested in
graphics, please pitch in!
Although due to technical limitations of this system (no Xwindows
environment on the Web server) we are not yet able to display
the graph here. However we description below a similar command
named gnuDraw that can be used to generate similar graphics on
this web site.
It is possible to produce graphics similar to Axioms using gnuplot on this web site. To do this you need to include the GnuDraw (GDRAW) library
)lib GDRAW
GnuDraw is now explicitly exposed in frame initial GnuDraw will be automatically loaded when needed from /var/zope2/var/LatexWiki/GDRAW.NRLIB/code
The following examples are taken from Chapter 7 Graphics of the AxiomBook.
Section: 7.1 Two-Dimensional Graphics
The general format for drawing a function defined by a formula f(x) is:
gnudraw(f(x), x = a..b, "filename.dat", options)
where a..b defines the range of x, options are additional
draw options and "filename.dat" will contain the gnuplot
script necessary to create the graph.
gnuDraw(sin(x), x=%pi/10..%pi,"AxiomGraphics1.dat")
Compiling function %F with type DoubleFloat -> DoubleFloat Graph data being transmitted to the viewport manager... FriCAS2D data being transmitted to the viewport manager...
This file may be displayed on the web page using:
!/begin{gnuplot}
load "filename.dat"
/end{gnuplot}

We can extract the graph data from the view port. For example we can display the list of data points that would be plotted in the graph.
(Note: we disable LaTeX output typesetting in order to save space.)
)set output tex off
)set output algebra on
g1:=getGraph(vp1,1)
(3) Graph with 1 point list
pointLists(g1)
(4) [ [[0.31415926535897931,0.3090169943749474,1.0,3.0], [0.37306412761378793,0.36447049987914965,1.0,3.0], [0.43196898986859655,0.41865973753742808,1.0,3.0], [0.49087385212340517,0.47139673682599764,1.0,3.0], [0.5497787143782138,0.5224985647159488,1.0,3.0], [0.60868357663302242,0.57178796022761225,1.0,3.0], [0.66758843888783104,0.61909394930983397,1.0,3.0], [0.72649330114263966,0.66425243791128175,1.0,3.0], [0.78539816339744828,0.70710678118654746,1.0,3.0], [0.8443030256522569,0.74750832686259672,1.0,3.0], [0.90320788790706552,0.78531693088074495,1.0,3.0], [0.96211275016187414,0.82040144352551359,1.0,3.0], [1.0210176124166828,0.85264016435409218,1.0,3.0], [1.0799224746714913,0.88192126434835494,1.0,3.0], [1.1388273369262998,0.90814317382508114,1.0,3.0], [1.1977321991811083,0.93121493475880346,1.0,3.0], [1.2566370614359168,0.95105651629515342,1.0,3.0], [1.3155419236907253,0.96759909236025965,1.0,3.0], [1.3744467859455338,0.98078528040323032,1.0,3.0], [1.4333516482003423,0.99056934044357714,1.0,3.0], [1.4922565104551508,0.99691733373312785,1.0,3.0], [1.5511613727099594,0.99980724048206482,1.0,3.0], [1.6100662349647679,0.99922903624072301,1.0,3.0], [1.6689710972195764,0.99518472667219704,1.0,3.0], [1.7278759594743849,0.98768834059513799,1.0,3.0], [1.7867808217291934,0.97676588132087272,1.0,3.0], [1.8456856839840019,0.96245523645364772,1.0,3.0], [1.9045905462388104,0.9448060464668786,1.0,3.0], [1.9634954084936189,0.92387953251128752,1.0,3.0], [2.0224002707484274,0.89974828405222229,1.0,3.0], [2.0813051330032359,0.87249600707279817,1.0,3.0], [2.1402099952580445,0.84221723371628776,1.0,3.0], [2.199114857512853,0.80901699437494878,1.0,3.0], [2.2580197197676615,0.77301045336273855,1.0,3.0], [2.31692458202247,0.73432250943568722,1.0,3.0], [2.3758294442772785,0.69308736254563774,1.0,3.0], [2.434734306532087,0.64944804833018577,1.0,3.0], [2.4936391687868955,0.60355594195357376,1.0,3.0], [2.552544031041704,0.55557023301960473,1.0,3.0], [2.6114488932965125,0.50565737337798722,1.0,3.0], [2.670353755551321,0.45399049973954964,1.0,3.0], [2.7292586178061295,0.40074883310314402,1.0,3.0], [2.7881634800609381,0.34611705707749618,1.0,3.0], [2.8470683423157466,0.29028467725446577,1.0,3.0], [2.9059732045705551,0.23344536385590897,1.0,3.0], [2.9648780668253636,0.17579627993435823,1.0,3.0], [3.0237829290801721,0.11753739745784152,1.0,3.0], [3.0826877913349806,0.058870803651193036,1.0,3.0], [3.1415926535897931,1.2246467991473532E-16,1.0,3.0]] ]
)set output algebra off
)set output tex on
Using lower level functions the points in such a graph can also be constructed as follows:
First we need this domain
)expose GraphImage
GraphImage is now explicitly exposed in frame initial
lineSegments := [[point [sin(x*%pi/10)$DoubleFloat, _
x*%pi/10], point [sin((x+1)*%pi/10)$DoubleFloat, _
(x+1)*%pi/10]] for x in 1..10]
![]() | (2) |
lineColors := [light blue() for i in 1..10]
![]() | (3) |
pointColors := [dark blue() for i in 1..10]
![]() | (4) |
lineSize := [6 for i in 1..10]
| (5) |
g2:=makeGraphImage(lineSegments, lineColors, pointColors, lineSize)
Graph data being transmitted to the viewport manager...
| (6) |
)set output tex off
)set output algebra on
pointLists(g2)
(10) [ [[0.3090169943749474,0.31415926535897931,22.0,5.0], [0.58778525229247314,0.62831853071795862,22.0,5.0]] ,
[[0.58778525229247314,0.62831853071795862,22.0,5.0], [0.80901699437494745,0.94247779607693793,22.0,5.0]] ,
[[0.80901699437494745,0.94247779607693793,22.0,5.0], [0.95105651629515353,1.2566370614359172,22.0,5.0]] ,
[[0.95105651629515353,1.2566370614359172,22.0,5.0], [1.0,1.5707963267948966,22.0,5.0]] ,
[[1.0,1.5707963267948966,22.0,5.0], [0.95105651629515364,1.8849555921538759,22.0,5.0]] ,
[[0.95105651629515364,1.8849555921538759,22.0,5.0], [0.80901699437494745,2.1991148575128552,22.0,5.0]] ,
[[0.80901699437494745,2.1991148575128552,22.0,5.0], [0.58778525229247325,2.5132741228718345,22.0,5.0]] ,
[[0.58778525229247325,2.5132741228718345,22.0,5.0], [0.30901699437494751,2.8274333882308138,22.0,5.0]] ,
[[0.30901699437494751,2.8274333882308138,22.0,5.0], [1.2246467991473532E-16,3.1415926535897931,22.0,5.0]] ,
[[1.2246467991473532E-16,3.1415926535897931,22.0,5.0], [- 0.3090169943749469,3.455751918948772,22.0,5.0]] ]
)set output algebra off
)set output tex on