PLOT CONTOUR V
The "V" in this statement is a local variable of the PLOT-FIELD command which equals the electrostatic potential at a given point. The name and value of these variables is not under your control. Moreover, you usually only have access to them in the context of the command being executed.
Garfield also has variables which are entirely under your control: you choose their name and value, you determine when expressions are to be evaluated, and you decide when and how to display their values. These are called global variables, or Globals for short. The name has been chosen to reflect the broader scope of globals, as compared to the local variables mentioned above. Local variables have a scope limited to one command, while global variables can be used across sections.
Global variables can be used for a variety of things:
Additional information on:
There are also operators for certain kinds of mixed arithmetic, such as between numbers and histograms and between numbers and matrices. Mixed arithmetic of logicals and numbers is not permitted.
Garfield recognises the following binary operators:
Operator | Acts on | Gives | Effect |
---|---|---|---|
+ |
-N-HM |
same |
addition |
+ |
--L-- |
--L-- |
or |
+ |
S---- |
S---- |
commutative concatenation |
- |
-N-HM |
same |
subtraction |
- |
--L-- |
--L-- |
exclusive or |
* |
-N-HM |
same |
multiplication |
* |
--L-- |
--L-- |
and |
/ |
-N-HM |
same |
division |
/ |
S---- |
S---- |
concatenate strings |
**, ^ |
-N-HM |
same |
exponentiation |
& |
--L-- |
--L-- |
and |
& |
-N--M |
----M |
concatenate matrices |
& |
S---- |
S---- |
concatenate strings |
| |
--L-- |
--L-- |
or |
= |
SN-HM |
--L-- |
equality |
= |
--L-- |
--L-- |
equivalence |
#, <>, >< |
SN-HM |
--L-- |
non-equality |
#, <>, >< |
--L-- |
--L-- |
non-equivalence |
> |
SN-HM |
--L-- |
greater than |
>=, => |
SN-HM |
--L-- |
greater than or equal to |
< |
SN-HM |
--L-- |
less than |
<=, =< |
SN-HM |
--L-- |
less than or equal to |
Unary operators are treated like functions, and therefore have higher precedence than binary operators. As a result, '-x^2' is always positive. The following unary operators are currently known:
Operator | Acts on | Gives | Effect |
---|---|---|---|
+ |
-N-HM |
same |
assignment |
- |
-N-HM |
same |
negative |
^, ~ |
--L-- |
--L-- |
not |
Notes:
Function | Acts on | Gives | Effect |
---|---|---|---|
ABS |
-N-HM |
same |
absolute value |
ARCCOS |
-N-HM |
same |
arc cosine |
ARCCOSH |
-N-HM |
same |
arc hyperbolic cosine |
ARCSIN |
-N-HM |
same |
arc sine |
ARCSINH |
-N-HM |
same |
arc hyperbolic sine |
ARCTAN |
-N-HM |
same |
arc tangent |
ARCTANH |
-N-HM |
same |
arc hyperbolic tangent |
COS |
-N-HM |
same |
cosine |
COSH |
-N-HM |
same |
hyperbolic cosine |
ENTIER |
-N-HM |
same |
integer part |
EXIST |
S---- |
--L-- |
existence of a file |
EXP |
-N-HM |
same |
exponential |
GAMMA |
-N-HM |
same |
\Γ-function |
GLOBAL |
S---- |
any |
global with name of the string |
LANDAU |
-N-HM |
same |
Landau density function |
LOG |
-N-HM |
same |
logarithm |
LOG_GAMMA |
-N-HM |
same |
logarithm of \Γ-function |
MAXIMUM |
---HM |
-N--- |
maximum of matrix or histogram |
MEAN |
---HM |
-N--- |
mean of a matrix or histogram |
MINIMUM |
---HM |
-N--- |
minimum of matrix or histogram |
NOT |
--L-- |
--L-- |
negation of logical value |
NUMBER |
S---M |
-N--- |
conversion to a number |
ONES |
-N--- |
----M |
row of 1's |
PRODUCT |
---HM |
-N--- |
product of matrix or histogram |
REFERENCE |
S--HM |
-N--- |
reference of a given string etc |
REF_HISTOGRAM |
-N--- |
---H- |
histogram with given reference |
REF_MATRIX |
-N--- |
----M |
matrix with given reference |
REF_STRING |
-N--- |
S---- |
string with given reference |
REVERSE |
----M |
----M |
reverse order in a matrix |
RMS |
---HM |
-N--- |
RMS of a matrix or histogram |
ROW |
-N--- |
----M |
row of number 1 to argument |
SIN |
-N-HM |
same |
sine |
SINH |
-N-HM |
same |
hyperbolic sine |
SIZE |
----M |
-N--- |
total number of elements |
SQRT |
-N-HM |
same |
square root |
STRING |
SNLHM |
S---- |
conversion to string |
SUM |
---HM |
-N--- |
sum of matrix or histogram |
TAN |
-N-HM |
same |
tangent |
TANH |
-N-HM |
same |
hyperbolic tangent |
TRAILING |
-N-HM |
same |
complement of ENTIER |
TYPE |
SNLHM |
S---- |
type of the argument |
ZEROES |
-N--- |
----M |
row of 0's |
In addition, the following random number generators are known:
Function | Argument | Effect |
---|---|---|
RND_EXPONENTIAL |
mean | Exponential distribution with given mean |
RND_FUNCTION |
- | Random number according to a function |
RND_GAMMA |
mean | \Γ-distribution with given mean |
RND_GAUSS |
- | Normal distribution N(0,1) |
RND_HISTOGRAM |
histogram | Random number according to an histogram |
RND_LANDAU |
- | Landau distribution |
RND_LAPLACE |
width | Laplace distribution |
RND_POISSON |
mean | Poisson distribution with given mean |
RND_POLYA |
\θ | Polya distribution with given \θ |
RND_UNIFORM |
scaling | Uniform distribution |
Notes:
Additional information on:
The instruction list usually contains many pieces, identified by entry_points which can be executed independently.
The instruction list consists, as the name says, of a list of instructions.
Each instruction is made up of 4 integers:
Additional information on:
Each time you ask a function to be translated, this will be done in a new entry point. Similarly, when you enter the editor, you are assigned an entry point to store your instructions in. The entry point description for en edited entry point is updated when leaving the editor.
You can not change the description of an entry point but you can delete entry points, add new ones and see the description of one.
Format:
ADD-ENTRY-POINT
Format:
CL-ENTRY [entry_reference]
Examples:
CL-ENTRY CL-ENTRY 5
In the first example, the current entry point (the one you are editing) is dropped. You may continue to modify it etc. and it can also be executed as long as no garbage collect is done.
In the second example, the entry point with reference number 5 is dropped. The reference number can be obtained from the MEMORY command, details about an entry point are provided by the DISPLAY-ENTRY-POINT command.
Format:
DELETE [from [to|LAST]]
Example:
DEL DEL 1 LAST
(Both examples delete all instructions.)
Note that the description of an entry point that is being edited is not always entirely up to date.
Format:
DISPLAY-ENTRY-POINT [entry_reference]
Example:
DISP-ENTRY
Shows details about your current entry point.
Format:
EXECUTE [from [to|LAST]]
Example:
EXEC
(Execute the whole instruction list, skipping branching statements.)
Format:
EXIT
Format:
FUNCTION function
Example:
F ARCTAN (EX/EY)
Format:
GARBAGE-COLLECT
Format:
INSERT before
Format:
LIST [from [to|LAST]]
Example:
LIST 5
(Lists line 5 only.)
This command can be used both in the algebra editor, which is entered by typing @ instead of a formula, or as part of regular input, provided the command is prefixed by a @ symbol.
Formats:
MEMORY @ MEMORY
The algebra OPTIONS can be set via a single-line command as shown in the example, and also from within the algebra editor which is entered by typing @ instead of a formula.
Format:
OPTIONS [NO-SYNTAX-CHECK | ALGEBRA-SYNTAX-CHECK | ... PROCEDURE-SYNTAX-CHECK] ... [SIGNAL-EXPONENTIAL-UNDERFLOW | IGNORE-EXPONENTIAL-UNDERFLOW]
Examples:
&SIGNAL // insert avalanche, time resolution and other settings Global phi0=10*pi/180 @opt ignore-exponential-underflow signal ion-tail cross-induced noelectron-pulse ... ion-angles 20 angular-spread exp(-((phi/{phi0})^2))
Avalanches are spread around the wire with a standard deviation of 10\°. This would lead to many underflows in the calculation and the spread would be rejected as a result. This is why the IGNORE-EXPONENTIAL-UNDERFLOW option is used.
OPTION NO-SYNTAX-CHECK DEBUG
If you are confident you won't make typing errors\ ...
Additional information on:
Format:
PRINT [from [to|LAST]]
Example:
PRINT 2 10
(Prints lines 2 through 10.)
You have access to the entire storage area, constant elements included.
Format:
REGISTER array_index value
Examples:
REG 5 10 REG 5
(First assign the value 10 to R(5), then check the value.)
Format:
RESET
Format:
RESULTS
During the simplification, constants are evaluated, complementary operations are cancelled, assignments are propagated and removed, equal subexpressions are identified and stored, steps that are not executed are dropped from the instruction list.
Some of these simplifications are skipped if the instruction list contains (un)conditional jumps since the jump address can not a priori be assumed to be known.
Format:
SIMPLIFY
This instruction differs from EXECUTE in that goto is executed. Loops, jumps and if's therefore work as usual.
Format:
TEST var1 var2 ...
Example:
TEST 2 3 6 10
(Execute the instruction list after substituting 2 for R(1), 3 for R(2), 6 for R(3) and 10 for R(4).)
Format:
VARIABLES
Formatted on 21/01/18 at 16:55.