From ab8cc85adde879fb963c94d15675783f2cf4b183 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 14 Aug 2007 05:14:52 +0000 Subject: Initial population. --- src/hyper/pages/SYMBOL.ht | 151 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 src/hyper/pages/SYMBOL.ht (limited to 'src/hyper/pages/SYMBOL.ht') diff --git a/src/hyper/pages/SYMBOL.ht b/src/hyper/pages/SYMBOL.ht new file mode 100644 index 00000000..da25d20c --- /dev/null +++ b/src/hyper/pages/SYMBOL.ht @@ -0,0 +1,151 @@ +% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved. +% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk. +\newcommand{\SymbolXmpTitle}{Symbol} +\newcommand{\SymbolXmpNumber}{9.79} +% +% ===================================================================== +\begin{page}{SymbolXmpPage}{9.79 Symbol} +% ===================================================================== +\beginscroll + +Symbols are one of the basic types manipulated by \Language{}. +The \spadtype{Symbol} domain provides ways to create +symbols of many varieties. +\showBlurb{Symbol} + +\xtc{ +The simplest way to create a symbol is to ``single quote'' an identifier. +%-% \HDindex{quote}{SymbolXmpPage}{9.79}{Symbol} +}{ +\spadpaste{X: Symbol := 'x \bound{X}} +} +\xtc{ +This gives the symbol even if \spad{x} has been assigned a value. +If \spad{x} has not been assigned a value, then it is possible to omit +the quote. +}{ +\spadpaste{XX: Symbol := x} +} +\xtc{ +Declarations must be used when working +with symbols, because otherwise the interpreter tries to place +values in a more specialized type \spadtype{Variable}. +}{ +\spadpaste{A := 'a} +} +\xtc{ +}{ +\spadpaste{B := b} +} +\xtc{ +The normal way of entering polynomials uses this fact. +}{ +\spadpaste{x**2 + 1} +} + +\xtc{ +Another convenient way to create symbols is to convert a string. +This is useful when the name is to be constructed by a program. +}{ +\spadpaste{"Hello"::Symbol} +} +\xtc{ +Sometimes it is necessary to generate new unique symbols, for example, to +name constants of integration. +The expression \spad{new()} generates a symbol starting with \spad{\%}. +}{ +\spadpaste{new()\$Symbol} +} +\xtc{ +Successive calls to \spadfunFrom{new}{Symbol} produce different symbols. +}{ +\spadpaste{new()\$Symbol} +} +\xtc{ +The expression \spad{new("s")} produces a symbol starting with \spad{\%s}. +}{ +\spadpaste{new("xyz")\$Symbol} +} + +\xtc{ +A symbol can be adorned in various ways. +The most basic thing is applying a symbol to a list +of subscripts. +}{ +\spadpaste{X[i,j] \free{X}} +} + +\xtc{ +Somewhat less pretty is to attach subscripts, superscripts or arguments. +}{ +\spadpaste{U := subscript(u, [1,2,1,2]) \bound{U}} +} +\xtc{ +}{ +\spadpaste{V := superscript(v, [n]) \bound{V}} +} +\xtc{ +}{ +\spadpaste{P := argscript(p, [t]) \bound{P}} +} + +\xtc{ +It is possible to test whether a symbol has scripts using the +\spadfunFrom{scripted?}{Symbol} test. +}{ +\spadpaste{scripted? U \free{U}} +} +\xtc{ +}{ +\spadpaste{scripted? X \free{X}} +} +\xtc{ +If a symbol is not scripted, then it may be converted to a string. +}{ +\spadpaste{string X \free{X}} +} +\xtc{ +The basic parts can always be extracted using the +\spadfunFrom{name}{Symbol} and \spadfunFrom{scripts}{Symbol} operations. +}{ +\spadpaste{name U \free{U}} +} +\xtc{ +}{ +\spadpaste{scripts U \free{U}} +} +\xtc{ +}{ +\spadpaste{name X \free{X}} +} +\xtc{ +}{ +\spadpaste{scripts X \free{X}} +} + +\xtc{ +The most general form is obtained using the \spadfunFrom{script}{Symbol} +operation. +This operation takes an argument which is a list containing, in this order, +lists of subscripts, superscripts, presuperscripts, presubscripts and +arguments to a symbol. +}{ +\spadpaste{M := script(Mammoth, [[i,j],[k,l],[0,1],[2],[u,v,w]]) \bound{M}} +} +\xtc{ +}{ +\spadpaste{scripts M \free{M}} +} +\xtc{ +If trailing lists of scripts are omitted, they are assumed to be empty. +}{ +\spadpaste{N := script(Nut, [[i,j],[k,l],[0,1]]) \bound{N}} +} +\xtc{ +}{ +\spadpaste{scripts N \free{N}} +} +\endscroll +\autobuttons +\end{page} +% -- cgit v1.2.3