@Section
   @Title { Defining new mathematical symbols }
@Begin
@PP
Whenever you type a particular piece of mathematics repeatedly, you
can save time by using definitions.  Definitions are the subject of
Section {@NumberOf definitions}, so here we will just give a few examples
mathematics.definitions @SubIndex { definitions, use with }
definitions. @RawIndex { definitions }
definitions.use.with.mathematics @SubIndex { use with mathematics }
of their use in formatting mathematics.
@PP
Suppose for example that @OneCol @Math { p sub i ` log sub 2 ` p sub i }
occurs frequently in your document.  Then
@ID @Code "def epi { p sub i ` log sub 2 ` p sub i }"
makes the symbol @Code "epi" stand for the object between the braces:
@ID {
@Code @Verbatim { sum from { i=1 } to { n } ` epi }
|7ct
@Math { sum from { i=1 } to { n } ` epi }
}
Parameters are very useful when parts of the symbol vary:
@ID @OneRow @Code @Verbatim {
def ep right x
{
   p sub x ` log sub 2 ` p sub x
}
}
The parameter @Code x will be replaced by the object just to the right
of {@Code "ep"}:
@ID {
@Code {
"sum from { i=1 } to { k } ` ep i +"
"sum from { j=k+1 } to { n } ep j"
}
||7ct
@Math {
sum from { i=1 } to { k } ` ep i +
sum from { j=k+1 } to { n } ep j
}
}
The precedence of the symbols you define will be 100 by default.
To make the symbols of @Code "@Math" available within such definitions,
each must be preceded by {@Code "import @Math"}.  As explained in Section
{@NumberOf definitions}, the definitions go into a file called
{@Code "mydefs"}, which might look like this:
@ID @OneRow @Code @Verbatim {
import @Math
def epi { p sub i ` log sub 2 ` p sub i }

import @Math
def ep right x { p sub x ` log sub 2 ` p sub x }
}
Use of @Code "epi" and @Code "ep" outside @Code "@Math" will cause an error.
@End @Section
