📄 unx24.htm
字号:
<TR>
<TD>
<P>det</P>
<TD>
<P>exp</P>
<TD>
<P>for</P>
<TD>
<P>if</P>
<TR>
<TD>
<P>Im</P>
<TD>
<P>lim</P>
<TD>
<P>ln</P>
<TD>
<P>log</P>
<TR>
<TD>
<P>max</P>
<TD>
<P>min</P>
<TD>
<P>Re</P>
<TD>
<P>sin</P>
<TR>
<TD>
<P>sinh</P>
<TD>
<P>tan</P>
<TD>
<P>tanh</P>
<TD>
<P><BR></P></TABLE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I7" NAME="I7">
<FONT SIZE=4><B><I>eqn</I></B><B> Operators</B>
<BR></FONT></A></CENTER></H3>
<P>You've already met some of the eqn operators—+, -, =, and >. Table 24.2 lists the other eqn operators.
<BR></P>
<A HREF="tab2402.gif"><B>Table 24.2. Some eqn operators.</B></A>
<BR>
<P>In addition, eqn offers nine diacritical marks, which are listed in Table 24.3.
<BR></P>
<A HREF="tab2403.gif"><B>Table 24.3. Diacritical marks.</B></A>
<BR>
<P>If you need to use a bar with one of the other diacritical marks, use highbar to place the bar correctly. There is also a lowbar. For example, the following code
<BR></P>
<PRE>.EQ
delim ##
.EN
#X highbar#
.sp .5
#x highbar#
.sp .5
#x bar#
.sp .5
#x lowbar#
.sp .5
#x dotdot highbar#
.sp .5
#{x tilde} highbar#</PRE>
<P>produces this output:</P>
<BR><IMG SRC="24unx02.gif"><BR>
<P>To draw a bar over an entire expression, use braces. For example:
<BR></P>
<PRE>{ ( alpha - beta ) * gamma } bar</PRE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I8" NAME="I8">
<FONT SIZE=4><B>Spaces and Braces</B>
<BR></FONT></A></CENTER></H3>
<P>Like most UNIX programs, eqn has to be able to recognize keywords. And, like UNIX, eqn understands that spaces delimit keywords, as do certain operators. For example, UNIX understands
<BR></P>
<PRE>who|grep sally</PRE>
<P>or
<BR></P>
<PRE>who | grep sally</PRE>
<P>The pipe acts as a delimiter, so UNIX can parse your command. Similarly, UNIX understands both the following:
<BR></P>
<PRE>mail sally<myletter
mail sally < myletter</PRE>
<P>In this example, the redirect (less than) sign acts as a delimiter. UNIX does not recognize the hyphen (minus sign) as a delimiter, despite the fact that many options must be preceded by this character. If you type ls-1, UNIX politely responds: ls-1:
not found.
<BR></P>
<P>eqn behaves the same way. If you write
<BR></P>
<PRE>.EQ
a+b=c
.EN</PRE>
<P>eqn will process this easily because it recognizes + and = as delimiters. The output of this code will be identical to the output from
<BR></P>
<PRE>.EQ
a + b = c
.EN</PRE>
<P>or even
<BR></P>
<PRE>.EQ
a+ b
=
c
.EN</PRE>
<P>All of these are output as a+b=c.
<BR></P>
<P>eqn pays no attention to spaces or newlines except as delimiters. Once eqn has determined what you mean (or what it thinks you mean), it throws away spaces and newlines.
<BR></P>
<P>To obtain spaces in your output, use a tilde (~) for a 1-character space, or a circumflex (^) for a half-character space:
<BR></P>
<PRE>.EQ
a~+~b~=~c
a^+^b~=~c
.EN</PRE>
<P>This produces
<BR></P>
<P>a+b=c
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I9" NAME="I9">
<FONT SIZE=3><B>Grouping</B>
<BR></FONT></A></CENTER></H4>
<P>If you say, "3 plus 2 times 5" your listener doesn't know whether you mean 25 or 13. eqn has the same problem. Like your listener, eqn makes an assumption about # a + b * c #. If you provide no more information, eqn groups according to the
order in which you enter information. In other words, it assumes parentheses.
<BR></P>
<P>Although computers do this, mathematicians don't. They believe in precedence, which holds that multiplication always precedes addition. Therefore, 3 + 2 <B>´</B> 5 is 13. Period. Even mathematicians, though, sometimes need parentheses.
<BR></P>
<P>Because parentheses are used so often in mathematical expressions, eqn wants you to use curly braces—{ and }—to indicate grouping in your expressions. Therefore, if you really meant 13, you would write
<BR></P>
<PRE># a + {b * c} #</PRE>
<P>The spaces here are important.
<BR></P>
<P>Because eqn's treatment of spaces is its hardest aspect to get used to, here is a list of rules to memorize. You could have them printed on a tee-shirt or tattooed on your hand if that seems easier.
<BR></P>
<OL>
<LI>eqn throws away all internal spaces once it has used them.
<BR>
<BR></LI>
<LI>eqn uses internal spaces to recognize special words and symbols.
<BR>
<BR></LI>
<LI>You can use circumflexes (^)—eqn calls them hats—or tildes (~) to set off special words and symbols. eqn replaces each tilde with a space in the output. It replaces each circumflex with a half space.
<BR>
<BR></LI>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> Earlier versions of eqn may not replace the circumflex with a half space. They may simply throw the circumflex away.
<BR></NOTE>
<HR ALIGN=CENTER>
<LI>You can use braces or quotation marks to set off parts of an equation, but they have special meanings.
<BR>
<BR>Braces are used for grouping. They force eqn to treat the enclosed term (or terms) as a unit. Braces can be nested.
<BR>
<BR>Quotation marks force eqn to treat the enclosed term literally. For example, to print a brace, enclose it in quotation marks.
<BR>
<BR></LI>
<LI>When in doubt, use a space.
<BR>
<BR></LI>
<LI>eqn ignores newlines, so you can spread your equation over several lines to make it more readable.
<BR>
<BR></LI></OL>
<P>Table 24.4 contains some examples that may help:
<BR></P>
<UL>
<LH><B>Table 24.4. Using spaces and brackets in </B><B>eqn</B><B>.</B>
<BR></LH></UL>
<TABLE BORDER>
<TR>
<TD>
<PRE><I>Desired Output</I>
<BR></PRE>
<TD>
<PRE><I>Code</I>
<BR></PRE>
<TD>
<PRE><I>Actual Output</I>
<BR></PRE>
<TR>
<TD>
<P>a + b = c</P>
<TD>
<P>a~+~b~=~c</P>
<TD>
<P>(as desired)</P>
<TR>
<TD>
<P>a + b = c</P>
<TD>
<P>a + b = c</P>
<TD>
<P>a+b=c</P>
<TR>
<TD>
<P>a=(x<SUP>2</SUP>)+1</P>
<TD>
<P>a=(x sup 2) + 1</P>
<TD>
<P>(as desired)</P>
<TR>
<TD>
<P>a=(x<SUB>2</SUB>)+1</P>
<TD>
<P>a=(x sup 2)+ 1</P>
<TD>
<P>a=(x<SUP>2)+1</SUP></P>
<TR>
<TD>
<P>x<SUB>2</SUB></P>
<TD>
<P>x sub 2</P>
<TD>
<P>(as desired)</P>
<TR>
<TD>
<P>x<SUB>2</SUB></P>
<TD>
<P>x sub2</P>
<TD>
<P>xsub2</P>
<TR>
<TD>
<P>x<SUB>i</SUB><SUP>2</SUP></P>
<TD>
<P>x sub i sup 2</P>
<TD>
<P>(as desired)</P>
<TR>
<TD>
<P>xi<SUP>2</SUP></P>
<TD>
<P>x sup 2 sub i</P>
<TD>
<P>x2i</P></TABLE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I10" NAME="I10">
<FONT SIZE=4><B>Fractions</B>
<BR></FONT></A></CENTER></H3>
<P>Fractions are produced in a straightforward way. Simply use the word over. For example, the code
<BR></P>
<PRE># a over b #</PRE>
<P>produces
<BR></P>
<P><B><IMG SRC="24unx03.gif"></B></P><BR>
<P>More complex fractions present additional problems. Think about the following equation for a moment:
<BR></P>
<PRE>a + b over c</PRE>
<P>This code line could mean # {a+b} over c # or # a + {b over c} #. The most important thing to remember about fractions is to use braces.
<BR></P>
<P>You can, of course, produce an expression with a fraction like this:
<BR></P>
<P><B><IMG SRC="24unx04.gif"></B></P><BR>
<H3 ALIGN="CENTER">
<CENTER><A ID="I11" NAME="I11">
<FONT SIZE=4><B>Square Roots</B>
<BR></FONT></A></CENTER></H3>
<P>The keyword sqrt produces the root sign. Consider these expressions:
<BR></P>
<P><B><IMG SRC="24unx05.gif"></B></P>
<P>They are produced with the following code:
<BR></P>
<PRE>sqrt a+b=x
sqrt {X bar}
y= sqrt {a-b}
y = sigma over {sqrt N}</PRE>
<P>You can also produce large root signs. For example,
<BR></P>
<PRE>sqrt {{a sup x} over b sub y}</PRE>
<P>When you do this, however, the root sign doesn't just get bigger; it gets thicker—and uglier. In cases like this, you're better off using a fractional power. For example,
<BR></P>
<PRE>{( a sup x /b sub y ) } sup half</PRE>
<P>produces
<BR></P>
<P><B><IMG SRC="24unx06.gif"></B></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I12" NAME="I12">
<FONT SIZE=4><B>Sums, Integrals, and Limits</B>
<BR></FONT></A></CENTER></H3>
<P>In their simplest form, sums, integrals, and limits are produced by sum, int, and lim. Of course, you never see them in their simplest form. Usually included is a from or even a from and a to. For example,
<BR></P>
<PRE>sum from 1=0 to {i=inf} x sup i
int from a to b
lim from {n -> inf} sum from i=0 to m c sup i</PRE>
<P>produces
<BR></P>
<P><B><IMG SRC="24unx07.gif"></B></P>
<P>In addition, you can use prod, union, and inter to produce the symbols used with sets.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I13" NAME="I13">
<FONT SIZE=4><B>Brackets, Braces, and Piles</B>
<BR></FONT></A></CENTER></H3>
<P>You can create big braces and brackets by enclosing expressions that require them. Consider the following code:
<BR></P>
<PRE>#left [ {a over b} + {c over d} right ]#
#left { {s over t} - {r over q} right }#</PRE>
<P>The expression that this code produces is
<BR></P>
<P><B><IMG SRC="24unx08.gif"></B></P>
<P>You can specify floor and ceiling characters. For example,
<BR></P>
<PRE>left floor a over b right floor =>
left ceiling x over y right ceiling</PRE>
<P>produces
<BR></P>
<P><B><IMG SRC="24unx09.gif"></B></P>
<P>Although piles look like big brackets, they are actually different. Piles line up in three ways: left, right, and centered. For example,
<BR></P>
<PRE>A= left [
pile { a above b above c }
pile { x above y above z }
right ]</PRE>
<P>produces
<BR></P>
<P><B><IMG SRC="24unx10.gif"></B></P>
<P>If you require only one brace, you must include a null argument for the missing side. Consider
<BR></P>
<PRE>left ""
lpile
{SIGMA X sub 3 above SIGMA X sub 1
X sub 3 above SIGMA X sub 2 X sub 3}
right )</PRE>
<P>which produces
<BR></P>
<P><B><IMG SRC="24unx11.gif"></B></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I14" NAME="I14">
<FONT SIZE=4><B>Arrays and Matrices</B>
<BR></FONT></A></CENTER></H3>
<P>To create an array or a matrix, use the keyword matrix, as in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -