| Line 4... |
Line 4... |
| 4 |
\description{
|
4 |
\description{
|
| 5 |
If the \code{text} argument to one of the text-drawing functions
|
5 |
If the \code{text} argument to one of the text-drawing functions
|
| 6 |
(\code{\link{text}}, \code{\link{mtext}}, \code{\link{axis}}) in \R
|
6 |
(\code{\link{text}}, \code{\link{mtext}}, \code{\link{axis}}) in \R
|
| 7 |
is an expression, the argument is interpreted as a mathematical
|
7 |
is an expression, the argument is interpreted as a mathematical
|
| 8 |
expression and the output will be formatted according to TeX-like
|
8 |
expression and the output will be formatted according to TeX-like
|
| 9 |
rules. A mathematical expression must obey the normal rules of syntax
|
- |
|
| 10 |
for any \R expression, but it is interpreted according to very
|
- |
|
| 11 |
different rules than for normal \R expressions.}
|
9 |
rules.
|
| - |
|
10 |
}
|
| 12 |
\details{
|
11 |
\details{
|
| 13 |
%% FIXME: use \describe instead when this works in nroff!
|
12 |
%% FIXME: use \describe instead when this works in nroff!
|
| - |
|
13 |
A mathematical expression must obey the normal rules of syntax
|
| - |
|
14 |
for any \R expression, but it is interpreted according to very
|
| - |
|
15 |
different rules than for normal \R expressions.
|
| - |
|
16 |
|
| 14 |
\emph{Binary operators:} addition, subtraction, multiplication, and
|
17 |
\emph{Binary operators:} addition, subtraction, multiplication, and
|
| 15 |
division use the standard \R\ syntax, although multiplication only
|
18 |
division use the standard \R syntax, although multiplication only
|
| 16 |
juxtaposes the arguments. For example, \code{a+b}, \code{a-b}, and
|
19 |
juxtaposes the arguments. For example, \code{a+b}, \code{a-b}, and
|
| 17 |
\code{a/b}, produce \eqn{a+b}, \eqn{a-b}, and \eqn{a/b}, but
|
20 |
\code{a/b}, produce \eqn{a+b}, \eqn{a-b}, and \eqn{a/b}, but
|
| 18 |
\code{a*b} produces \eqn{ab}.
|
21 |
\code{a*b} produces \eqn{ab}.
|
| 19 |
|
22 |
|
| 20 |
\emph{Unary operators:} positive and negative numbers are specified
|
23 |
\emph{Unary operators:} positive and negative numbers are specified
|
| Line 23... |
Line 26... |
| 23 |
|
26 |
|
| 24 |
\emph{Subscripts and superscripts:} a subscript is specified using the
|
27 |
\emph{Subscripts and superscripts:} a subscript is specified using the
|
| 25 |
subsetting syntax and a superscript is specified using the power
|
28 |
subsetting syntax and a superscript is specified using the power
|
| 26 |
syntax. For example, \code{x[i]} produces \eqn{x_i} and \code{x^2}
|
29 |
syntax. For example, \code{x[i]} produces \eqn{x_i} and \code{x^2}
|
| 27 |
produces \eqn{x^2}.
|
30 |
produces \eqn{x^2}.
|
| 28 |
|
31 |
|
| 29 |
\emph{Accents:} accented expressions are specified using the special
|
32 |
\emph{Accents:} accented expressions are specified using the special
|
| 30 |
mathematical functions \code{hat} and \code{bar}.
|
33 |
mathematical functions \code{hat} and \code{bar}.
|
| 31 |
% For example, \code{hat(x)} produces \eqn{\hat{x}} and \code{bar(x)}
|
34 |
% For example, \code{hat(x)} produces \eqn{\hat{x}} and \code{bar(x)}
|
| 32 |
% produces \eqn{\bar{x}}.
|
35 |
% produces \eqn{\bar{x}}.
|
| 33 |
|
36 |
|
| Line 36... |
Line 39... |
| 36 |
% For example, \code{frac(1,2)} produces \eqn{1\over2}.
|
39 |
% For example, \code{frac(1,2)} produces \eqn{1\over2}.
|
| 37 |
|
40 |
|
| 38 |
\emph{Relations:} equality or assignment of terms is specified using
|
41 |
\emph{Relations:} equality or assignment of terms is specified using
|
| 39 |
the \code{==} relation. For example, \code{x == y} produces
|
42 |
the \code{==} relation. For example, \code{x == y} produces
|
| 40 |
\eqn{x=y}.
|
43 |
\eqn{x=y}.
|
| 41 |
|
44 |
|
| 42 |
\emph{Visible grouping:} terms are visibly grouped by placing them
|
45 |
\emph{Visible grouping:} terms are visibly grouped by placing them
|
| 43 |
within parentheses. For example, \code{(x+y)} produces \eqn{(x+y)}.
|
46 |
within parentheses. For example, \code{(x+y)} produces \eqn{(x+y)}.
|
| 44 |
|
47 |
|
| 45 |
\emph{Invisible grouping:} terms are invisibly grouped by placing them
|
48 |
\emph{Invisible grouping:} terms are invisibly grouped by placing them
|
| 46 |
within curly braces. For example, \code{x^{2*y}} produces
|
49 |
within curly braces. For example, \code{x^{2*y}} produces
|
| Line 50... |
Line 53... |
| 50 |
the special mathematical function of the corresponding name. Each of
|
53 |
the special mathematical function of the corresponding name. Each of
|
| 51 |
these functions takes three arguments; the first indicates what is
|
54 |
these functions takes three arguments; the first indicates what is
|
| 52 |
being summed/multiplied/integrated and the second and third specify
|
55 |
being summed/multiplied/integrated and the second and third specify
|
| 53 |
the limits of the summation/product/integral.
|
56 |
the limits of the summation/product/integral.
|
| 54 |
For example, \code{sum(x[i], i==0, n)} produces
|
57 |
For example, \code{sum(x[i], i==0, n)} produces
|
| 55 |
\eqn{\sum\limits_{i=0}^n x_i}{sum_{i=0}^n x_i}.
|
58 |
\deqn{\sum\limits_{i=0}^n x_i}{sum_{i=0}^n x_i}.
|
| 56 |
|
59 |
|
| 57 |
\emph{Radicals:} a square root expression is specified using the
|
60 |
\emph{Radicals:} a square root expression is specified using the
|
| 58 |
special mathematical functions \code{root} and \code{sqrt}.
|
61 |
special mathematical functions \code{root} and \code{sqrt}.
|
| 59 |
% For example, \code{sqrt(x)} produces \eqn{\sqrt x}.
|
62 |
% For example, \code{sqrt(x)} produces \eqn{\sqrt x}.
|
| 60 |
|
63 |
|
| Line 98... |
Line 101... |
| 98 |
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
|
101 |
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
|
| 99 |
lab = expression(-pi, -pi/2, 0, pi/2, pi))
|
102 |
lab = expression(-pi, -pi/2, 0, pi/2, pi))
|
| 100 |
|
103 |
|
| 101 |
plot(1:10, 1:10)
|
104 |
plot(1:10, 1:10)
|
| 102 |
text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
|
105 |
text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
|
| 103 |
text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)", cex = .6)
|
106 |
text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)", cex = .8)
|
| 104 |
text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
|
107 |
text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
|
| 105 |
text(4, 6.4, "expression(bar(x) == sum(frac(x[i], n), i==1, n))", cex = .6)
|
108 |
text(4, 6.4, "expression(bar(x) == sum(frac(x[i], n), i==1, n))", cex = .8)
|
| 106 |
text(8, 5, expression(paste(frac(1, sigma*sqrt(2*pi)), " ",
|
109 |
text(8, 5, expression(paste(frac(1, sigma*sqrt(2*pi)), " ",
|
| 107 |
plain(e)^{frac(-(x-mu)^2, 2*sigma^2)})))
|
110 |
plain(e)^{frac(-(x-mu)^2, 2*sigma^2)})), cex= 1.2)
|
| - |
|
111 |
}
|
| 108 |
\keyword{aplot}
|
112 |
\keyword{aplot}
|