-
Notifications
You must be signed in to change notification settings - Fork 1
/
g4
256 lines (256 loc) · 4.85 KB
/
g4
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.SC "A Large Example"
.PP
Here is the complete source for the three display equations
in the abstract of this guide.
.DS L
.ps -2
.vs -2
.\" Keep the copy of this in file "g0" in sync.
.EQ I
G(z)~mark =~ e sup { ln ~ G(z) }
~=~ exp left (
sum from k>=1 {S sub k z sup k} over k right )
~=~ prod from k>=1 e sup {S sub k z sup k /k}
.EN
.EQ I
define cdots "{ \[md]~\[md]~\[md] }"
define ldots "{ .~.~. }"
lineup = left ( 1 + S sub 1 z +
{ S sub 1 sup 2 z sup 2 } over 2! + ~ cdots right )
~ left ( 1+ { S sub 2 z sup 2 } over 2
+ { S sub 2 sup 2 z sup 4 } over { 2 sup 2 cdot 2! }
+ ~ cdots right ) ~ cdots
.EN
.EQ I
lineup = sum from m>=0 left (
sum from
pile { k sub 1 ,k sub 2 , ~ ldots ~ , k sub m >=0
above
k sub 1 +2k sub 2 + ~ cdots ~ +mk sub m =m}
{ S sub 1 sup {k sub 1} } over {1 sup k sub 1 k sub 1 ! } ~
{ S sub 2 sup {k sub 2} } over {2 sup k sub 2 k sub 2 ! } ~
cdots
{ S sub m sup {k sub m} } over {m sup k sub m k sub m ! }
right ) ~ z sup m
.EN
.DE
.ps +2
.vs +2
.SC "Keywords, Precedences, Etc."
.PP
If you don't use braces,
.UC EQN
will
do operations in the order shown in this list.
.P1 3
.ft I
dyad vec under bar tilde hat dot dotdot
fwd back down up
fat roman italic bold size
sub sup sqrt over
from to
.ft R
.P2
These operations group to the left:
.P1
.ft I
over sqrt left right
.ft R
.P2
All others group to the right.
.PP
Digits, parentheses, brackets, punctuation marks, and these mathematical words
are converted
to Roman font when encountered:
.P1 3 \" reduce indentation, GBR 2022
sin cos tan sinh cosh tanh arc
max min lim log ln exp
Re Im and if for det
.P2
These character sequences are recognized and translated as shown.
.sp
.nf
.tr -\(mi
.in .5i
.ta 1i
>= $>=$
<= $<=$
== $==$
!= $!=$
+- $+-$
-> $->$
<- $<-$
<< $<<$
>> $>>$
inf $inf$
partial $partial$
half $half$
prime $prime$
approx $approx$
nothing $nothing$
cdot $cdot$
times $times$
del $del$
grad $grad$
\&... $...$
,..., $,...,$
sum $sum$
.sp 3p
int $int$
.sp 2p
prod $prod$
union $union$
inter $inter$
.sp
.in
.fi
.tr --
.PP
To obtain Greek letters,
simply spell them out in whatever case you want:
.sp
.nf
.in .2i
.ta .7i 1.4i 2.1i
DELTA $DELTA$ iota $iota$
GAMMA $GAMMA$ kappa $kappa$
LAMBDA $LAMBDA$ lambda $lambda$
OMEGA $OMEGA$ mu $mu$
PHI $PHI$ nu $nu$
PI $PI$ omega $omega$
PSI $PSI$ omicron $omicron$
SIGMA $SIGMA$ phi $phi$
THETA $THETA$ pi $pi$
UPSILON $UPSILON$ psi $psi$
XI $XI$ rho $rho$
alpha $alpha$ sigma $sigma$
beta $beta$ tau $tau$
chi $chi$ theta $theta$
delta $delta$ upsilon $upsilon$
epsilon $epsilon$ xi $xi$
eta $eta$ zeta $zeta$
gamma $gamma$
.sp
.in
.fi
.PP
These are all the words known to
.UC EQN
(except for characters with names),
together with the section where they are discussed.
.sp
.nf
.in .2i
.ta .7i 1.4i 2.0i \" reduce last tab stop, GBR 2022
above 17, 18 lpile 17
back 21 mark 15
bar 13 matrix 18
bold 12 ndefine 20
ccol 18 over 9
col 18 pile 17
cpile 17 rcol 18
define 20 right 16
delim 19 roman 12
dot 13 rpile 17
dotdot 13 size 12
down 21 sqrt 10
dyad 13 sub 7
fat 12 sup 7
font 12 tdefine 20
from 11 tilde 13
fwd 21 to 11
gfont 12 under 13
gsize 12 up 21
hat 13 vec 13
italic 12 ~, ^ 4, 6
lcol 18 { } 8
left 16 "..." 8, 14
lineup 15
.sp
.in 0
.fi
.SC Troubleshooting
.PP
If you make a mistake in an equation,
like leaving out a brace (very common)
or having one too many (very common)
or having a
.ul
sup
with nothing before it (common),
.UC EQN
will tell you with the message
.P1 2
.ft I
syntax error between lines x and y, file z
.ft R
.P2
where
.ul
x
and
.ul
y
are approximately the lines
between which the trouble occurred, and
.ul
z
is the name
of the file in question.
The line numbers are approximate _ look nearby as well.
There are also self-explanatory messages that arise if you leave out a quote
or try to run
.UC EQN
on a non-existent file.
.PP
If you want to check a document before actually printing it
(on
.UC UNIX
only),
.P1
eqn files >/dev/null
.P2
will
throw away the output but print the messages.
.PP
If you use something like dollar signs as delimiters,
it is easy to leave one out.
This causes very strange troubles.
The program
.ul
checkeq
(on
.UC GCOS ,
use
.ul
\&./checkeq
instead)
checks for misplaced or missing dollar signs
and similar troubles.
.PP
In-line equations can only be so big
because of an internal buffer in
.UC TROFF .
If you get a message
``word overflow'',
you have exceeded this limit.
If you print the equation as a displayed equation
this message will usually go away.
The message
``line overflow''
indicates you have exceeded an even bigger buffer.
The only cure for this is to break the equation into two separate ones.
.PP
On a related topic,
.UC EQN
does not break equations by itself _
you must split long equations up across multiple lines
by yourself,
marking each by a separate
.UC .EQ
\&...\&
.UC .EN
sequence.
.UC EQN
does warn about equations that are too long
to fit on one line.