| 1 |
%% LyX 2.5.0~RC2 created this file. For more info, see https://www.lyx.org/. |
| 2 |
%% Do not edit unless you really know what you are doing. |
| 3 |
\documentclass[english,hyphens]{report} |
| 4 |
\usepackage{lmodern} |
| 5 |
\renewcommand{\sfdefault}{lmss} |
| 6 |
\renewcommand{\ttdefault}{lmtt} |
| 7 |
\usepackage[T1]{fontenc} |
| 8 |
\usepackage{textcomp} |
| 9 |
\usepackage[utf8]{inputenc} |
| 10 |
\setcounter{secnumdepth}{3} |
| 11 |
\setcounter{tocdepth}{3} |
| 12 |
\synctex=-1 |
| 13 |
\usepackage{xcolor} |
| 14 |
\definecolor{lyxboxbgcolor}{rgb}{1, 0.667969, 0.5} |
| 15 |
\colorlet{shadecolor}{lyxboxbgcolor} |
| 16 |
\usepackage{colortbl} |
| 17 |
\usepackage{babel} |
| 18 |
\usepackage{cprotect} |
| 19 |
\usepackage{wrapfig} |
| 20 |
\usepackage{booktabs} |
| 21 |
\usepackage{framed} |
| 22 |
\usepackage{url} |
| 23 |
\usepackage{amsmath} |
| 24 |
\usepackage{amssymb} |
| 25 |
\usepackage{stmaryrd} |
| 26 |
\usepackage{esint} |
| 27 |
\usepackage[pdfusetitle, |
| 28 |
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, |
| 29 |
breaklinks=true,pdfborder={0 0 1},backref=section,colorlinks=true,pdfpagemode=FullScreen] |
| 30 |
{hyperref} |
| 31 |
\hypersetup{ |
| 32 |
pdfborderstyle=} |
| 33 |
|
| 34 |
\makeatletter |
| 35 |
|
| 36 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. |
| 37 |
\newcommand{\noun}[1]{\textsc{#1}} |
| 38 |
%% Special footnote code from the package 'stblftnt.sty' |
| 39 |
%% Author: Robin Fairbairns -- Last revised Dec 13 1996 |
| 40 |
\let\SF@@footnote\footnote |
| 41 |
\def\footnote{\ifx\protect\@typeset@protect |
| 42 |
\expandafter\SF@@footnote |
| 43 |
\else |
| 44 |
\expandafter\SF@gobble@opt |
| 45 |
\fi |
| 46 |
} |
| 47 |
\expandafter\def\csname SF@gobble@opt \endcsname{\@ifnextchar[%] |
| 48 |
\SF@gobble@twobracket |
| 49 |
\@gobble |
| 50 |
} |
| 51 |
\edef\SF@gobble@opt{\noexpand\protect |
| 52 |
\expandafter\noexpand\csname SF@gobble@opt \endcsname} |
| 53 |
\def\SF@gobble@twobracket[#1]#2{} |
| 54 |
%% Because html converters don't know tabularnewline |
| 55 |
\providecommand{\tabularnewline}{\\} |
| 56 |
|
| 57 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. |
| 58 |
\newenvironment{example}% |
| 59 |
{\begin{center}\ttfamily}{\end{center}} |
| 60 |
|
| 61 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. |
| 62 |
\usepackage[def-file=E:/Documents/LyX_tex/tex/latexercises/diffcoeff5,% |
| 63 |
spaced=-1]{diffcoeff} |
| 64 |
% no sub nudge (a sea of white space) |
| 65 |
\difdef { f, fp } { wsp } |
| 66 |
{ sub-nudge = 0 mu } |
| 67 |
% align op left; no italic nudge |
| 68 |
\difdef { f,fp } { left0 } |
| 69 |
{ |
| 70 |
*op-set-left = true, |
| 71 |
*italic-nudge = 0 mu |
| 72 |
} |
| 73 |
% align op left; italic nudge |
| 74 |
\difdef { f,fp } { left } |
| 75 |
{ *op-set-left = true } |
| 76 |
% partial variant of \diff |
| 77 |
\difdef { f } { p } |
| 78 |
{ |
| 79 |
op-symbol = \partial, |
| 80 |
op-order-nudge = 1 mu |
| 81 |
} |
| 82 |
% partial, 3mu sep of terms |
| 83 |
\difdef { fp, sp } { 3mu } |
| 84 |
{ multi-term-sep = 3 mu } |
| 85 |
% partial, compact, -2 mu subscr. var. adjustment |
| 86 |
\difdef { cp } { 2 } { term-sep-adjust = -2 mu } |
| 87 |
% partial, use \ldots |
| 88 |
\difdef { fp } { ld } { dots = \!\ldots } |
| 89 |
% differential d^n x |
| 90 |
\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 } |
| 91 |
% D jacobian |
| 92 |
\difdef { j } { D } |
| 93 |
{ op-symbol = D } |
| 94 |
% square bracket jabobian |
| 95 |
\difdef { j } { [ } |
| 96 |
{ |
| 97 |
lvwrap-Ldelim = \onemu\mleft [, |
| 98 |
lvwrap-Rdelim = \mright ] |
| 99 |
} |
| 100 |
|
| 101 |
\ifdefined\showcaptionsetup |
| 102 |
% Caption package is used. Advise subfig not to load it again. |
| 103 |
\PassOptionsToPackage{caption=false}{subfig} |
| 104 |
\fi |
| 105 |
\usepackage{subfig} |
| 106 |
\makeatother |
| 107 |
|
| 108 |
\begin{document} |
| 109 |
\title{\texttt{diffcoeff}~\\ |
| 110 |
a \LaTeX{} package to ease\texttt{ }the~\\ |
| 111 |
writing of differential coefficients \\ |
| 112 |
Version 5.6} |
| 113 |
\author{Andrew Parsloe\\ |
| 114 |
{\small ([email protected])}} |
| 115 |
\maketitle |
| 116 |
\begin{abstract} |
| 117 |
\noindent\texttt{diffcoeff} is a \LaTeX{} package to ease the writing |
| 118 |
of ordinary, partial and other derivatives of arbitrary algebraic |
| 119 |
or numeric order. For mixed partial derivatives, the total order of |
| 120 |
differentiation is calculated by the package. Optional arguments allow |
| 121 |
for points of evaluation (ordinary derivatives), or variables held |
| 122 |
constant (partial derivatives), and the placement of the differentiand |
| 123 |
in the numerator or appended. Besides $\diff yx$, forms like $\difs.s.yx$, |
| 124 |
$\difs yx$ and $\difcp yx$ are also available, as well as derivatives |
| 125 |
built from $D$, $\Delta$, $\delta$, and configurable jacobians |
| 126 |
and differentials. Other notations like line elements ($\dl.+.{x,y,z}^{2}$) |
| 127 |
and bra-kets are easily produced. |
| 128 |
\end{abstract} |
| 129 |
\begin{center} |
| 130 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 131 |
\begin{shaded}% |
| 132 |
|
| 133 |
\subsubsection*{Version 5.6} |
| 134 |
|
| 135 |
Version 5.6 resolves a conflict that arises with version 5.5 and packages |
| 136 |
still using \texttt{xtemplate}.\footnote{My thanks to \noun{Jensen Tan} for pointing out the conflict.} |
| 137 |
Otherwise the versions are the same. |
| 138 |
|
| 139 |
\subsubsection*{Version 5.5} |
| 140 |
|
| 141 |
Since 2024/06/01, the functionality of \texttt{xtemplate} has been |
| 142 |
incorporated into the \LaTeX{} kernel. Version 5.5 of \texttt{diffcoeff} |
| 143 |
does not require or load \texttt{xtemplate} unless your \LaTeX{} system |
| 144 |
is earlier than 2024/06/01. In addition to some corrections and additions |
| 145 |
to documentation, new features of version 5.5 are |
| 146 |
\begin{itemize} |
| 147 |
\item the ability to write a generic mixed partial derivative $\difsp.s.<n>F{x_{1},...,x_{n}}$ |
| 148 |
`with dots' in the straightforward way (§\ref{par:Generic-derivatives}); |
| 149 |
\item the ability to write a `split level' inline derivative like $\difs.s.yx$ |
| 150 |
(or the example in the previous item); see §\ref{subsec:variantSplit-level-text-style}; |
| 151 |
\item the ability to write a `doubly compact' derivative like $\difccp F{x:2,y,z:3}$; |
| 152 |
see §\ref{par:Doubly-compact-forms}. |
| 153 |
\end{itemize} |
| 154 |
|
| 155 |
\subsubsection*{{\small For users of version 4}} |
| 156 |
|
| 157 |
{\small Version 5 of }{\small\texttt{diffcoeff}}{\small{} more fully |
| 158 |
embraces the configurability offered by templates than earlier versions, |
| 159 |
at the cost of some incompatibilities with version 4. That version |
| 160 |
is still available with the command }{\small\verb`\usepackage[<options>]{diffcoeff}[=v4]`}{\small . |
| 161 |
In version 5, the }{\small\verb`\diff`}{\small{} and }{\small\verb`\diffp`}{\small{} |
| 162 |
commands of version 4 remain, but lack the `spacing switch' }{\small\verb`!`}{\small{} |
| 163 |
and `slash switch' }{\small\verb`/`}{\small . Slash-fraction |
| 164 |
derivatives are now created with the }{\small\verb`\difs`}{\small{} |
| 165 |
and }{\small\verb`\difsp`}{\small{} commands. New commands }{\small\verb`\difc`}{\small{} |
| 166 |
and }{\small\verb`\difcp`}{\small{} produce derivatives in `compact |
| 167 |
notation' like }{\small $\difc yx$}{\small{} and }{\small $\difcp yx$}{\small . |
| 168 |
The two-argument }{\small\verb`\diffdef`}{\small{} command of |
| 169 |
earlier versions has been replaced by the three-argument command }{\small\verb`\difdef`}{\small , |
| 170 |
the additional argument determining which of the }{\small\verb`f`}{\small , |
| 171 |
}{\small\verb`s`}{\small , }{\small\verb`c`}{\small , |
| 172 |
}{\small\verb`fp`}{\small , }{\small\verb`sp`}{\small{} |
| 173 |
or }{\small\verb`cp`}{\small{} forms the defined variant applies |
| 174 |
to. The differential command }{\small\verb`\dl`}{\small{} has |
| 175 |
been rewritten and is now fully template-configurable (allowing easy |
| 176 |
writing of line elements like $\dl.+.{x,y,z}^{2}$), and the jacobian |
| 177 |
command }{\small\verb`\jacob`}{\small{} is also configurable. }{\small\par} |
| 178 |
|
| 179 |
\subsubsection*{{\small ISO defaults}} |
| 180 |
|
| 181 |
{\small The }{\small\verb`ISO`}{\small{} package option is redundant. |
| 182 |
Version 5 of }\texttt{diffcoeff}{\small{} follows ISO recommendations |
| 183 |
(see the standard ISO 80000-2). In particular, this means upright |
| 184 |
`d's, and subscripted parentheses enclosing a derivative to indicate |
| 185 |
a point of evaluation. This document is written with those defaults. |
| 186 |
But the defaults can be readily changed; see §§\ref{sec:Variant-forms}, |
| 187 |
\ref{sec:ChangingDefaults}.}{\small\par}\end{shaded}% |
| 188 |
\end{minipage} |
| 189 |
\par\end{center} |
| 190 |
|
| 191 |
\tableofcontents{} |
| 192 |
|
| 193 |
\chapter{Introduction} |
| 194 |
|
| 195 |
\subsubsection*{Requirements} |
| 196 |
|
| 197 |
A \TeX{} distribution from or later than February 2020 is assumed. |
| 198 |
\texttt{diffcoeff} uses the \verb`xtemplate` functionality of the |
| 199 |
\LaTeX 3 project. Since June 2024 that has become part of the \LaTeX{} |
| 200 |
base -- see \verb`lttemplates-doc.pdf` which can be found in the |
| 201 |
\verb`doc\latex\base` or \verb`doc/latex/base` folder (depending |
| 202 |
on your operating system) of your \TeX{} distribution. Consequently |
| 203 |
from version 5.5 of \texttt{diffcoeff}, \verb`xtemplate` is a required |
| 204 |
package only if your \TeX{} distribution is earlier than June 2024. |
| 205 |
The package \verb`mleftright` is required (but is loaded by \texttt{diffcoeff}), |
| 206 |
and for some optional features (\verb`style=tfrac` and \verb`style=sfrac`) |
| 207 |
that use the \verb`\tfrac` and \verb`\text` commands of \verb`amsmath`, |
| 208 |
you will need to load that package (which in any case is likely to |
| 209 |
have already been done). |
| 210 |
|
| 211 |
\subsubsection*{Version 4} |
| 212 |
|
| 213 |
Version 5 of \texttt{diffcoeff} marked a significant change from previous |
| 214 |
versions. If you want the behaviour of version 4, add to the \verb`\usepackage` |
| 215 |
command a trailing optional argument like this, |
| 216 |
\begin{verbatim} |
| 217 |
\usepackage[<options>]{diffcoeff}[=v4] |
| 218 |
\end{verbatim} |
| 219 |
(with no space after the `=' sign!). Working with version 4 is described |
| 220 |
in the document \texttt{diffcoeff4.pdf}. |
| 221 |
|
| 222 |
\section{Package options} |
| 223 |
|
| 224 |
\label{sec:Package-options}The package is loaded in the usual way |
| 225 |
by entering |
| 226 |
\begin{verbatim} |
| 227 |
\usepackage[<options>]{diffcoeff} |
| 228 |
\end{verbatim} |
| 229 |
in the preamble of your document.\footnote{Angle brackets indicate possible user input (\emph{without} the angle |
| 230 |
brackets).} |
| 231 |
|
| 232 |
From version 5.5 of \texttt{diffcoeff}, there are five possible package |
| 233 |
options. If none are being used, omit the square-bracket term in the |
| 234 |
\verb`\usepackage` call, otherwise the options are entered in a comma |
| 235 |
list in the square-bracket argument of the \verb`\usepackage` command. |
| 236 |
\begin{enumerate} |
| 237 |
\item The \verb`spaced` option takes one of three values: |
| 238 |
\begin{enumerate} |
| 239 |
\item \verb`spaced=1` inserts a small space before the differentiand; this |
| 240 |
is the default so that entering \verb`spaced` alone is equivalent |
| 241 |
to \verb`spaced=1`; |
| 242 |
\item \verb`spaced=0` inserts no space before the differentiand; \texttt{diffcoeff} |
| 243 |
is initialized to this value so that if the \verb`spaced` option |
| 244 |
is not used \verb`spaced=0` is assumed; |
| 245 |
\item \verb`spaced=-1` inserts no space before the differentiand\emph{ |
| 246 |
}if it is a single token but otherwise inserts a small space; the |
| 247 |
present document uses \verb`spaced=-1`; |
| 248 |
\end{enumerate} |
| 249 |
Space before the differentiand is discussed further in §\ref{subsec:Spacing-before-derivand}, |
| 250 |
where the commands \verb`\spacedone`, \verb`\spacednil` and \verb`\spacedneg` |
| 251 |
are introduced, enabling local (within group) deviations from the |
| 252 |
global setting. |
| 253 |
\item The second package option \verb`def-file` takes as value the \verb`<filename>` |
| 254 |
(which may include the path) of a file containing definitions of variant |
| 255 |
forms of derivative (see §\ref{sec:Variant-forms}). The file has |
| 256 |
extension \verb`.def`, \verb`<filename>.def`; this is discussed |
| 257 |
in §\ref{subsec:The-def-file}. If \verb`<filename>` includes the |
| 258 |
path, any backslashes \verb`\` (as used in windows systems) must |
| 259 |
be changed to forward slashes \verb`/` (as in linux systems) to avoid |
| 260 |
`Undefined control sequence' errors when compiling. (Because of |
| 261 |
the presence of earlier versions of \verb`diffcoeff5.def` on the |
| 262 |
author's computer, the present document includes the path in the package |
| 263 |
option call: \verb`def-file=<path to>/diffcoeff5`.) |
| 264 |
\item The third package option \verb`dif**` (from version 5.5 of \texttt{diffcoeff}) |
| 265 |
takes as value a comma list of identifiers drawn from \verb`f`, \verb`fp`, |
| 266 |
\verb`s`, \verb`sp`, \verb`c`, \verb`cp` (e.g. \verb`dif**={c,cp}`). |
| 267 |
For the corresponding derivative commands (e.g. \verb`\difc`, \verb`\difcp`) |
| 268 |
specified by the identifiers the order of entry of the differentiand |
| 269 |
and differentiation variable(s) arguments is reversed; see §\ref{subsec:Transposing-the-argument}. |
| 270 |
The present document does not use this package option. |
| 271 |
\item By entering \verb`mleftright` (no value required) in the options |
| 272 |
list, the command \verb`\mleftright` is automatically inserted in |
| 273 |
the preamble. The effect is to change all occurrences of \verb`\left`, |
| 274 |
\verb`\right` in the document to \verb`\mleft`, \verb`\mright` |
| 275 |
so that the spacing around scalable delimiters modified by \verb`\left`, |
| 276 |
\verb`\right` is reduced; see §\ref{subsec:mleftright} immediately |
| 277 |
below. The present document does not use this option. |
| 278 |
\item The final package option \verb`DIF` is a comma list of \emph{key=value} |
| 279 |
statements amending the built-in defaults for the `grandparent' |
| 280 |
template \verb`DIF`; see §\ref{subsec:Changing-DIF-defaults}. The |
| 281 |
present document does not use this option. |
| 282 |
\end{enumerate} |
| 283 |
\noindent For the present document, the call is |
| 284 |
\begin{verbatim} |
| 285 |
\usepackage[def-file=<path to>/diffcoeff5,spaced=-1]{diffcoeff} |
| 286 |
\end{verbatim} |
| 287 |
|
| 288 |
\subsection{\texttt{mleftright}} |
| 289 |
|
| 290 |
\label{subsec:mleftright}To see the effect of the \verb`mleftright` |
| 291 |
option, consider the expression |
| 292 |
\begin{example} |
| 293 |
\verb`\[ \ln \left(\frac xy\right),\quad\sin\left(x^2\right). \]` |
| 294 |
$\Longrightarrow$ \[ \ln \left(\frac xy\right),\quad\sin\left(x^2\right). \] |
| 295 |
\end{example} |
| 296 |
|
| 297 |
\noindent in which there is significant whitespace before and after |
| 298 |
the parentheses. The package \verb`mleftright` enables this whitespace |
| 299 |
to be reduced by using \verb`\mleft`, \verb`\mright` in place of |
| 300 |
\verb`\left`, \verb`\right`: |
| 301 |
\begin{example} |
| 302 |
\verb`\[ \ln \mleft(\frac xy\mright),\quad\sin\mleft(x^2\mright). \]` |
| 303 |
$\Longrightarrow$ \[ \ln \mleft(\frac xy\mright),\quad\sin\mleft(x^2\mright). \] |
| 304 |
\end{example} |
| 305 |
|
| 306 |
If you put \verb`\mleftright` in the preamble, which is what the |
| 307 |
\verb`mleftright` package option does, then all occurrences of \verb`\left`, |
| 308 |
\verb`\right` in the document will be affected. \verb`\left`, \verb`\right` |
| 309 |
can be restored to their normal behaviour by the command \verb`\mleftrightrestore`. |
| 310 |
Rather than use \verb`\mleft`, \verb`\mright` explicitly, as in |
| 311 |
the example, the same effect can be obtained by using \verb`\left`, |
| 312 |
\verb`\right` and preceding the expression with the command \verb`\mleftright`: |
| 313 |
\begin{verbatim} |
| 314 |
\mleftright |
| 315 |
\[ \ln \left(\frac xy\right),\quad\sin \left(x^2\right). \] |
| 316 |
\mleftrightrestore |
| 317 |
\end{verbatim} |
| 318 |
$\Longrightarrow$ \mleftright |
| 319 |
\[ \ln \left(\frac xy\right),\quad\sin \left(x^2\right). \] |
| 320 |
\mleftrightrestore |
| 321 |
|
| 322 |
\section{A Rogues' Gallery of derivatives} |
| 323 |
|
| 324 |
\label{sec:Rogues'-gallery}Browsing through some (rather old) calculus |
| 325 |
textbooks, and texts on statistical mechanics, relativity and classical |
| 326 |
mechanics, I find the following choice examples of derivatives `disporting |
| 327 |
every which way'. |
| 328 |
\begin{itemize} |
| 329 |
\item Upright fraction, slash fraction and compact form ordinary and partial |
| 330 |
derivatives, |
| 331 |
\[ |
| 332 |
\diff[2]yx,\quad\difs yx,\quad\difcp yx. |
| 333 |
\] |
| 334 |
\item Multi-character variables of differentiation, un-parenthesized: |
| 335 |
\[ |
| 336 |
\diffp{\frac{\psi}{\Theta}}{\frac{1}{\Theta}},\quad\diffp{E/T}{1/T},\quad\diff{\!\ln f}{\!\ln x_{0}},\quad\diffp\psi{a_{i},\frac{1}{\Theta}},\quad\diffp{\mathcal{\!L}}{\eta^{(r)}_{,i}}. |
| 337 |
\] |
| 338 |
\item Multi-character variables of differentiation parenthesized (or sometimes |
| 339 |
not) in \emph{higher-order} derivatives, where the parentheses do |
| 340 |
not (or sometimes do) include the operator: \[ |
| 341 |
\diffp[2]q{\frac{1}{\Theta}},\quad |
| 342 |
\diffp[2]q{1/\Theta},\quad |
| 343 |
\diffp.dv.[2]\varepsilon{a_{i}},\quad |
| 344 |
\diff.(dv).[2]{\phi^{i}(x^{i})}{x^{i}}. |
| 345 |
\]Should the $\mathrm{d}$ or $\partial$ be included within the parentheses, |
| 346 |
as in the last of these, or not, as in the first two? Logic says `yes'; |
| 347 |
practice suggests (generally) `no'; see §\ref{subsec:Multi-tok-vars-parenth} |
| 348 |
and §\ref{subsec:variantMulti-token-vars-parenth}. |
| 349 |
\item Indicating a point of evaluation is similarly varied (see §\ref{subsec:Point-of-evaluation}, |
| 350 |
§\ref{subsec:variantPt-of-eval}): \[ |
| 351 |
\difdef{f,fp}{x}{outer-Ldelim=\left.,outer-Rdelim=\right|,sub-nudge=0 mu} |
| 352 |
\diffp.x.\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad \diff.x.[2]\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad |
| 353 |
\difdef{fp}{x}{outer-Ldelim=\left[,outer-Rdelim=\right],sub-nudge=0 mu} |
| 354 |
\diffp.x.{b^{\beta}}{a^{\alpha}}[b=0],\quad |
| 355 |
\diff uv[v=0]. |
| 356 |
\difdef{f,fp}{x}{outer-Ldelim=\left(,outer-Rdelim=\right),sub-nudge=-5 mu} |
| 357 |
\]ISO 80000-2 (item 2.11.13) favours the last of these -- parentheses |
| 358 |
-- for ordinary derivatives. Presumably, partial derivatives should |
| 359 |
follow suit, although parentheses are also used to indicate variables |
| 360 |
held constant: |
| 361 |
\[ |
| 362 |
\diffp*{\frac{P}{T}}U[V],\quad\diffp S{N_{2}}[U,V,N_{1}],\quad\difsp ST[V]\,. |
| 363 |
\] |
| 364 |
\item We might want to write a generic mixed partial derivative (see §\ref{par:Generic-derivatives}), |
| 365 |
\[ |
| 366 |
\diffp<n>F{x_{1},x_{2},{...},x_{n}},\quad\diffp.dv.F{x_{1}:k_{1},{...}:\cdots,x_{n}:\nilmu k_{n}}, |
| 367 |
\] |
| 368 |
or use a compact abbreviated notation like $\difcp F{ij}$ for $\difsp F{x_{i},x_{j}}$, |
| 369 |
or $\difccp F{x:3,y,z:2}$ for $\difsp F{x:3,y,z:2}$. |
| 370 |
\item Other symbols besides $\mathrm{d}$ and $\partial$ are used to denote |
| 371 |
derivative-like quantities. From introductory calculus and from classical |
| 372 |
mechanics and thermodynamics come $\delta$ and $\Delta$, from fluid |
| 373 |
mechanics comes $\mathrm{D}$: \[ |
| 374 |
\difdef{f}{x}{op-symbol=\delta} |
| 375 |
\diff.x.yx,\quad \diff.x.{\!\mathcal{L}}{\eta^(r)},\quad |
| 376 |
\difdef{f}{x}{op-symbol=D} |
| 377 |
\diff.x.\rho t,\quad |
| 378 |
\difdef{f,s}{x}{op-symbol=\Delta} |
| 379 |
\diff.x.UT[V],\quad \difs.x.UT . |
| 380 |
\difdef{f,s}{x}{op-symbol=\mathrm{d}} |
| 381 |
\]See §\ref{subsec:variantD-delta-Delta} for these and for the $\difc.bD.{}x$ |
| 382 |
operator used sometimes in the discussion of differential equations: |
| 383 |
\[ |
| 384 |
\difdef{c}{x}{op-symbol=\mathbf{D}} |
| 385 |
\difc.x.[2]yx+2\difc.x. yx -4=0. |
| 386 |
\] |
| 387 |
\item There are those, like the International Organization for Standardization |
| 388 |
(ISO), who stipulate (or prefer) an upright $\mathrm{d}$ for their |
| 389 |
derivatives, and there are those (like the author, through sixty years |
| 390 |
of habit) who prefer a math-italic $d$ (see §\ref{subsec:variantMath-italic-ds}): |
| 391 |
\[ |
| 392 |
\diff yx,\qquad |
| 393 |
\difdef fx{op-symbol=d} |
| 394 |
\diff.x.yx, |
| 395 |
\difdef fx{op-symbol=\mathrm{d}} |
| 396 |
\]and of course also in slash-fraction form $\difs yx$, $\difs.d'.yx$. |
| 397 |
\item When the differentiand is too big or awkward to sit in the numerator |
| 398 |
and is appended to the operator, the $\mathrm{d}$ or $\partial$ |
| 399 |
in the numerator is generally centred -- but not always. In texts |
| 400 |
prior to the age of computerised typesetting one will sometimes find |
| 401 |
the symbol pushed to the \emph{left}: \[ \spacednil |
| 402 |
\diffp.left.*{\diffp{x^{i^*}}{x^{k^*}}}{x^{l^*}},\quad |
| 403 |
\diff.left.*{\left(\frac{m\mathbf{q}_x} |
| 404 |
{\sqrt{1-q^2}}\right)}t. \]The observant will note an italic adjustment with the first expression, |
| 405 |
so that the $\partial$ in the numerator and the $\partial$ in the |
| 406 |
denominator of the first term of the first example line up in a slanting |
| 407 |
column and the upright `d's line up in the second example, rather |
| 408 |
than the operator symbols being centred as seems to be general modern |
| 409 |
practice. |
| 410 |
\item Then there is the case when the operator in the numerator differs |
| 411 |
from that in the denominator. For instance, in tensor calculus acceleration |
| 412 |
is sometimes written \[\spacednil |
| 413 |
\diff.n.{v^{i}}t=\diff{x^{i}}{t:2}+\Gamma^{\hphantom{k}i}_{k\hphantom{i}h}\diff{x^{h}}t\diff{x^{k}}t |
| 414 |
\]where $\nabla v^{i}$ is the `absolute differential' of the velocity |
| 415 |
$v^{i}$; see §\ref{subsec:Examples-of-variants}. (The $x^{i}$ are |
| 416 |
the coordinates.) |
| 417 |
\end{itemize} |
| 418 |
The \texttt{diffcoeff} package has the generative power to cope with |
| 419 |
all these variations -- see §\ref{sec:Variant-forms} -- although |
| 420 |
it is unlikely an author should need to call on this capacity to anything |
| 421 |
like the extent required for this Rogues' Gallery. |
| 422 |
|
| 423 |
\chapter{Syntax and use} |
| 424 |
|
| 425 |
\texttt{diffcoeff} aims to ease the writing of derivatives (sometimes |
| 426 |
also called differential coefficients). There are long-established |
| 427 |
shorthands available in a few cases: $\dot{x}$ and $\ddot{x}$ for |
| 428 |
the time derivatives of a function $x$ of time $t$; $y'$ and $y''$ |
| 429 |
for the derivatives of a function $y$ (usually) of $x$. But mostly |
| 430 |
derivatives are expressed in fraction form and require more keystrokes |
| 431 |
to compose. It is here that \texttt{diffcoeff} is aimed. It uses three |
| 432 |
pairs of commands: \verb`\diff` and \verb`\diffp` to write (upright) |
| 433 |
fraction forms of ordinary and partial derivatives like |
| 434 |
\[ |
| 435 |
\diff yx,\quad\diffp yx, |
| 436 |
\] |
| 437 |
generally intended for display-style environments; \verb`\difs` and |
| 438 |
\verb`\difsp` for slash-fraction forms of ordinary and partial derivatives |
| 439 |
like $\difs yx$, $\difsp yx$, generally intended for text-style |
| 440 |
environments; and \verb`\difc` and \verb`\difcp` to write compact |
| 441 |
forms\cprotect\footnote{Suggested by a question on \TeX{} StackExchange: \url{https://tex.stackexchange.com/questions/652223/write-a-derivative-operator-without-denominator-using-diffcoef/652298\#652298}} |
| 442 |
of ordinary and partial derivatives like $\difc yx$ and $\difcp yx$. |
| 443 |
|
| 444 |
\subsubsection*{Note} |
| 445 |
|
| 446 |
I refer throughout to the quantity or function being differentiated |
| 447 |
as the \emph{differentiand} or \emph{derivand }(in line with \emph{integrand}, |
| 448 |
\emph{operand}, etc.) and shall sometimes use \verb`\difx` (resp. |
| 449 |
\verb`\difxp`) to make general statements about any or all of \verb`\diff`, |
| 450 |
\verb`\difs` or \verb`\difc` (resp.\verb`\diffp`, \verb`\difsp`, |
| 451 |
\verb`\difcp`). |
| 452 |
|
| 453 |
\section{Syntax} |
| 454 |
|
| 455 |
All commands \verb`\difx`, \verb`\difxp`, share the same syntax. |
| 456 |
With all arguments present the syntax is |
| 457 |
\begin{verbatim} |
| 458 |
\difx.name.**[order-spec]<override>{variable(s)} |
| 459 |
{differentiand}[pt of eval] |
| 460 |
\end{verbatim} |
| 461 |
The syntax is identical for \verb`\difxp`. The eight arguments have |
| 462 |
the following meanings: |
| 463 |
\begin{enumerate} |
| 464 |
\item \verb`name` (optional) A dot-delimited name to distinguish a variant |
| 465 |
form (non-default form) of derivative; not discussed further until |
| 466 |
§\ref{chap:Templates-defaults-variants} below, and specifically, |
| 467 |
§\ref{sec:Variant-forms}. |
| 468 |
\item \verb`*` (optional) The presence of a star (asterisk) signals \emph{append |
| 469 |
the differentiand}; its absence means the differentiand appears in |
| 470 |
the numerator of an upright- or slash-fraction form derivative; no |
| 471 |
effect for compact-form derivatives unless (see next) a second \verb`*` |
| 472 |
is present; see §\ref{subsec:Appending-the-differentiand}. |
| 473 |
\item \verb`*` (optional) The presence of a \emph{second} star signals |
| 474 |
that the argument specifying the variable(s) of differentiation comes |
| 475 |
\emph{before} the argument specifying the differentiand; this is sometimes |
| 476 |
convenient when a complicated or lengthy differentiand is appended; |
| 477 |
see §\ref{subsec:Transposing-the-argument}. |
| 478 |
\item \verb`order-spec` (optional) The order of differentiation when differentiating |
| 479 |
in a single variable, or a comma list of orders of differentiation |
| 480 |
for a mixed partial derivative; see §\ref{subsec:Higher-order-derivatives} |
| 481 |
and §\ref{subsec:Mixed-partial-derivatives}. Not necessary if orders |
| 482 |
are specified with the colon notation in the variable list; see §§\ref{subsec:Colon-notation} and \ref{subsec:AlgebraicOrders-ColonNotation}. |
| 483 |
\item \verb`override` (optional) The total order of differentiation when |
| 484 |
it cannot be calculated by \texttt{diffcoeff} or is wanted in a different |
| 485 |
form from that calculated by \texttt{diffcoeff}; see §\ref{subsec:Order-override-command}. |
| 486 |
\item \verb`differentiand/derivand` (mandatory) The function being differentiated. |
| 487 |
\item \verb`variable(s)` (mandatory) The variable of differentiation or |
| 488 |
a comma list of variables of differentiation (for a mixed partial |
| 489 |
derivative); also, with the colon notation (see §§\ref{subsec:Colon-notation}, |
| 490 |
\ref{subsec:AlgebraicOrders-ColonNotation}), provides an alternative |
| 491 |
method of specifying orders of differentiation. |
| 492 |
\item \verb`pt of eval` (optional) Point of evaluation or, for partial |
| 493 |
derivatives, variable or variables held constant; \emph{no space} |
| 494 |
before the left square bracket; see §\ref{subsec:Point-of-evaluation}. |
| 495 |
\end{enumerate} |
| 496 |
Both mandatory arguments may be empty, but require empty brace pairs |
| 497 |
to indicate as much. (Omitting the differentiand makes sense for all |
| 498 |
forms of derivative, \verb`\difx`, \verb`\difxp`, but omitting the |
| 499 |
variable or variables of differentiation is sensible only for the |
| 500 |
compact forms, \verb`\difc`, \verb`\difcp` -- see §\ref{subsec:variantCompact=002013forms}.) |
| 501 |
|
| 502 |
\section{General use} |
| 503 |
|
| 504 |
Writing \verb`\diff{y}{x}` will produce $\diff{y}{x}$ in an inline |
| 505 |
math environment (i.e. placed between \verb`\( \)` or \verb`$ $`) |
| 506 |
or |
| 507 |
\[ |
| 508 |
\diff{y}{x} |
| 509 |
\] |
| 510 |
in display style (placed, for instance, between {\ttfamily\verb`\[ \]`} |
| 511 |
). In fact \verb`\diff yx` (omitting the braces) will produce these |
| 512 |
results, with a saving on keystrokes. The braces are needed only when |
| 513 |
a \LaTeX{} argument -- the variable of differentiation, or the differentiand |
| 514 |
-- is multi-token: |
| 515 |
\begin{example} |
| 516 |
\verb`\[ \diff{f(x)}x \]` $\Longrightarrow$ \[ \diff{f(x)}x\] |
| 517 |
\end{example} |
| 518 |
|
| 519 |
\begin{itemize} |
| 520 |
\item The keen-eyed will note a space before the `d' operator and the |
| 521 |
differentiand in this example. See §\ref{subsec:Spacing-before-derivand} |
| 522 |
immediately below. |
| 523 |
\item Although conforming to the ISO standard (ISO 80000-2) the upright |
| 524 |
`d's are not everyone's preference. If you want math-italic `$\mathrm{d}$'s |
| 525 |
as default, see §\ref{sec:ChangingDefaults} on changing default settings. |
| 526 |
\end{itemize} |
| 527 |
General usage seems to favour \verb`\diff` for display-style use |
| 528 |
and a slash fraction for inline text-style use. Slash fraction derivatives |
| 529 |
are produced with the \verb`\difs` command: \verb`$ \difs yx $` |
| 530 |
$\Longrightarrow$ $ \difs yx $. From version 5.5 of \texttt{diffcoeff} |
| 531 |
(provided the \verb`amsmath` package is loaded) it is also possible |
| 532 |
to produce a split level alternative, $\difs.s.yx$, by employing |
| 533 |
a `variant form' (\verb`\difs.s.yx`; see §\ref{subsec:variantSplit-level-text-style}). |
| 534 |
This scales to the smaller $e^{{\difs.s.yx}}$ when used as a superscript |
| 535 |
and to the author's eye is neater than \verb`$e^{\diff yx}$` $\Longrightarrow$ |
| 536 |
$e^{\diff yx}$. If you want still more compactness, you can use the |
| 537 |
\verb`\difc` (`c' for \emph{compact}) command: \verb`$ \difc yx $` |
| 538 |
$\Longrightarrow$ $ \difc yx $. |
| 539 |
|
| 540 |
\emph{Partial derivatives} follow the same pattern as ordinary derivatives. |
| 541 |
The commands this time are \texttt{\textbackslash}\verb`diffp`, |
| 542 |
\verb`\difsp` and \verb`\difcp` for (upright) fraction, slash fraction |
| 543 |
and compact forms of partial derivative. Thus \verb`\diffp{F}{x}` |
| 544 |
(or \verb`\diffp Fx`) produces $\diffp Fx$ in text style; \verb`\diffp{F(x,y)}{x}` |
| 545 |
produces |
| 546 |
\[ |
| 547 |
\diffp{F(x,y)}{x} |
| 548 |
\] |
| 549 |
in display style. For inline use, \verb`\difsp Fx`, displays as $\difsp Fx$ |
| 550 |
and \verb`\difcp Fx` displays as $\difcp Fx$. Given that \verb`\partial` |
| 551 |
takes 8 keystrokes to type, all forms\emph{ }economise on keystrokes. |
| 552 |
|
| 553 |
\subsection{Spacing before the differentiand\protect\footnote{I thank \noun{Hans Schülein} for first raising this issue with me |
| 554 |
and for subsequent thoughtful comments.}} |
| 555 |
|
| 556 |
\label{subsec:Spacing-before-derivand}There are (at least) two different |
| 557 |
ways in which to think of derivatives. We are all familiar with the |
| 558 |
argument presented in elementary calculus books where a curve is shown, |
| 559 |
and also a point on the curve through which a chord has been drawn. |
| 560 |
The chord is the hypotenuse of a small right-angled triangle, the |
| 561 |
other sides having lengths $\delta x$ and $\delta y$ parallel to |
| 562 |
the coordinate axes. The slope of the chord is $\diff.gd.yx$. By |
| 563 |
drawing shorter and shorter chords through the point, the ratio $\diff.gd.yx$ |
| 564 |
approaches the slope of the tangent to the curve at the point. We |
| 565 |
write |
| 566 |
\[ |
| 567 |
\diff yx |
| 568 |
\] |
| 569 |
for the limit of $\diff.gd.yx$. It is natural following this line |
| 570 |
of argument to think of $\dl y$ and $\dl x$ as tiny lengths, like |
| 571 |
$\delta y$ and $\delta x$, in which case it would be quite wrong |
| 572 |
to insert space between the $\mathrm{d}$ and the $y$. $\dl y$ is |
| 573 |
a single object, called a differential, and we write expressions like |
| 574 |
\[ |
| 575 |
\dl y=\diff yx\dl x |
| 576 |
\] |
| 577 |
and justly call the fraction in this expression a \emph{differential |
| 578 |
coefficient}. |
| 579 |
|
| 580 |
But there is another way of viewing differentiation: as a process |
| 581 |
producing (or \emph{deriving}) one function, $y'(x)$, from another, |
| 582 |
$y(x)$. Here the sense is of applying an operator $\diff{}x$ to |
| 583 |
a quite separate object, the function $y(x)$. Although we include |
| 584 |
$y(x)$ in the numerator it is distinct from the `d' and should |
| 585 |
be separated from it by a small space: |
| 586 |
\[ |
| 587 |
y'(x)=\diff{y(x)}x. |
| 588 |
\] |
| 589 |
Here the fraction on the right is another name for the derived function |
| 590 |
$y'$ and is justly called the \emph{derivative} of $y$. As you can |
| 591 |
see a small space has been inserted between the `d' and the $y$ |
| 592 |
in the numerator. By default the space is \verb`3 mu` with the ability |
| 593 |
to stretch by \verb`1 mu` or shrink by\texttt{ }\verb`2 mu` --\texttt{ |
| 594 |
}\verb`3 mu plus 1 mu minus 2 mu` -- as \TeX{} adjusts lines to fit |
| 595 |
on the page. (A `mu' is a `math unit' and is one eighteenth of |
| 596 |
a quad.) The size of the space inserted by default can be easily changed; |
| 597 |
see §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}. |
| 598 |
\begin{itemize} |
| 599 |
\item You may want all your derivatives to have this space before the derivand. |
| 600 |
The \verb`spaced=1` package option switches this behaviour on. |
| 601 |
\begin{itemize} |
| 602 |
\item Note however that commands like \verb`\sin`, \verb`\cosh`, \verb`\ln` |
| 603 |
and similar, including those defined by the user with \verb`\DeclareMathOperator` |
| 604 |
from the \verb`amsmath` package, come with a preceding space built |
| 605 |
in. You may want to insert a \emph{negative} thin space, \verb`\!`, |
| 606 |
before the command, to avoid \emph{too much} space being inserted |
| 607 |
before the derivand, or use the \verb`\spacednil` command -- see |
| 608 |
§\ref{subsec:Spacing-commands} immediately below: |
| 609 |
\end{itemize} |
| 610 |
\begin{example} |
| 611 |
\verb`\[ \diff{\sin x}x, \quad \diff{\!\sin x}x \]` $\Longrightarrow$ |
| 612 |
\[ \diff{\sin x}x, \quad \diff{\!\sin x}x \] |
| 613 |
\end{example} |
| 614 |
|
| 615 |
\item I have used the \verb`spaced=-1` package option (§\ref{sec:Package-options}) |
| 616 |
for the present document which inserts space only if the derivand |
| 617 |
contains \emph{more than one token}. Thus $y(x)$ will have space |
| 618 |
inserted before it, but $y$ alone will not. This (generally) maintains |
| 619 |
the distinction between a differential coefficient thought of as a |
| 620 |
ratio of tiny lengths and a derivative thought of as an operator applied |
| 621 |
to a function. |
| 622 |
\begin{itemize} |
| 623 |
\item If the derivand is \emph{appended} when \verb`spaced=-1`, $\diff*yx$, |
| 624 |
then indisputably we have an operator operating on a function, and |
| 625 |
the space is inserted. (Note that version 5.4 of \texttt{diffcoeff} |
| 626 |
did not insert the space in this case; that was an error, corrected |
| 627 |
in version 5.5.) |
| 628 |
\item A vector component $x_{i}$, say, of a vector $\mathbf{x}=(x_{1},x_{2},x_{3})$ |
| 629 |
is multi-token but might well be thought of (e.g. by the author) as |
| 630 |
if it were a single-token variable and yet, when \verb`spaced=-1`, |
| 631 |
a space is inserted. \LaTeX{} provides some spacing shorthands like |
| 632 |
\verb`\!` (a negative thin space) to adjust things; \texttt{diffcoeff} |
| 633 |
provides others; see §\ref{subsec:Spacing-commands} below. |
| 634 |
\end{itemize} |
| 635 |
\item If \verb`spaced=0` no space is inserted before the derivand, single |
| 636 |
token or multi-token, under any circumstances. If a space is wanted |
| 637 |
in a particular case, it is up to the user to insert it -- perhaps |
| 638 |
by using \verb`\,` (a thin space) within the braces defining the |
| 639 |
differentiand, e.g. \verb`{\,f(x)}`. As noted, there are a number |
| 640 |
of (short) commands in \LaTeX{} (like \verb`\,`) to do the job and |
| 641 |
\texttt{diffcoeff} provides others; see §\ref{subsec:Spacing-commands} |
| 642 |
immediately below. |
| 643 |
\end{itemize} |
| 644 |
Slash-form derivatives also allow space before the derivand. By default |
| 645 |
this is \verb`2 mu plus 1 mu minus 2 mu`, slightly reduced from the |
| 646 |
fraction-form value to avoid visually detaching the initial `d' |
| 647 |
operator from the derivative as a whole. The value can be changed; |
| 648 |
see §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}. |
| 649 |
\begin{example} |
| 650 |
\verb`$ \difs{s(t)}t, \quad \difs st $` $\Longrightarrow$ $ \difs{s(t)}t, \quad \difs st $. |
| 651 |
\end{example} |
| 652 |
|
| 653 |
For \emph{compact-form} derivatives the space before the derivand |
| 654 |
is \emph{always} inserted when \verb`spaced` is non-zero, since the |
| 655 |
subscript precludes the entire symbol ever being viewed as a differential |
| 656 |
-- it is always an operator operating on a function. The inserted |
| 657 |
space, \verb`1 mu plus 1 mu minus 1 mu` by default, can be changed |
| 658 |
should you wish; see §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}. |
| 659 |
It is less for compact forms since the subscript already provides |
| 660 |
some visual separation. In the example the negative thin space \verb`\!` |
| 661 |
cancels the positive thin space that comes with \verb`\ln`: |
| 662 |
\begin{example} |
| 663 |
\verb`$ \difc{\!\ln\sin x}x, \quad \difc st $` $\Longrightarrow$ |
| 664 |
$ \difc{\!\ln\sin x}x, \quad \difc st $. |
| 665 |
\end{example} |
| 666 |
|
| 667 |
The \verb`spaced` package option has the same effect on partial derivatives |
| 668 |
as ordinary derivatives. Thus with \verb`spaced=1` or \verb`spaced=-1`, |
| 669 |
\verb`3 mu` of space (with some stretch and shrink) is inserted before |
| 670 |
the differentiand \verb`F(x,y)` in the first member of the following |
| 671 |
example, space of \verb`2 mu` (with stretch and shrink) in the second, |
| 672 |
and space of \verb`1 mu` (with stretch and shrink) in the third: |
| 673 |
\begin{example} |
| 674 |
\verb`\[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)}x, \]` |
| 675 |
\end{example} |
| 676 |
|
| 677 |
$\Longrightarrow$ \[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)}x. \] |
| 678 |
|
| 679 |
\noindent But for single-token differentiands in this document (using |
| 680 |
\verb`spaced=-1`) the space is not inserted for upright and slash-form |
| 681 |
derivatives: |
| 682 |
\begin{example} |
| 683 |
\verb`\[ \diffp Fx,\quad \difsp Fx. \]` $\Longrightarrow$ \[ \diffp Fx,\quad \difsp Fx. \] |
| 684 |
\end{example} |
| 685 |
|
| 686 |
|
| 687 |
\subsubsection{Spacing commands} |
| 688 |
|
| 689 |
\label{subsec:Spacing-commands}\LaTeX{} has its own explicit spacing |
| 690 |
commands. In particular \verb`\,` which is \verb`3 mu` (a thin space) |
| 691 |
and \verb`\!` which is \verb`-3 mu` (a negative thin space) are |
| 692 |
convenient in math mode. The \texttt{diffcoeff} package adds four |
| 693 |
simple spacing commands to fill in the gap between these two. These |
| 694 |
are |
| 695 |
\begin{description} |
| 696 |
\item [{\texttt{\textbackslash negmu}}] insert spacing of \verb`-1 mu`; |
| 697 |
\item [{\texttt{\textbackslash nilmu}}] insert spacing of \verb`0 mu` |
| 698 |
(cf. use of an empty brace pair \texttt{\textbf{\{\}}} ); |
| 699 |
\item [{\texttt{\textbackslash onemu}}] insert spacing of \verb`1 mu`; |
| 700 |
\item [{\texttt{\textbackslash twomu}}] insert spacing of \verb`2 mu`. |
| 701 |
\end{description} |
| 702 |
From version 5.5 of \texttt{diffcoeff}, each of these commands can |
| 703 |
be starred to produce a space of opposite sign but the same magnitude. |
| 704 |
Thus \verb`\onemu*` is equivalent to \verb`\negmu` and vice versa. |
| 705 |
The most useful is likely to be \verb`\twomu*` which fills in the |
| 706 |
missing \verb`-2 mu` negative space in the range between \verb`\,` |
| 707 |
(\verb`3 mu`) and \verb`\!` (\verb`-3 mu`). Thus if you do \emph{not} |
| 708 |
want a vector component to be spaced, \verb`$ \difs{\twomu*y_i}t $` |
| 709 |
$\Longrightarrow$ $ \difs{\twomu*y_i}t $, to be compared with the |
| 710 |
spaced version in which the \verb`\twomu*` is omitted, $\difs{y_{i}}t$. |
| 711 |
|
| 712 |
From version 5.5, \texttt{diffcoeff} also supports three commands |
| 713 |
which switch on one of the \verb`spaced` package option values \emph{within |
| 714 |
the current group}. |
| 715 |
\begin{description} |
| 716 |
\item [{\textbackslash\texttt{spacedone}}] is equivalent to \verb`spaced=1` |
| 717 |
within the current group; |
| 718 |
\item [{\texttt{\textbackslash spacednil}}] is equivalent to \verb`spaced=0` |
| 719 |
within the current group; |
| 720 |
\item [{\texttt{\textbackslash spacedneg}}] is equivalent to \verb`spaced=-1` |
| 721 |
within the current group. |
| 722 |
\end{description} |
| 723 |
This document uses the package option \verb`spaced=-1`. That means |
| 724 |
that a multi-token differentiand like $x^{k}$ will be separated from |
| 725 |
the $\partial$ symbol in the numerator of a partial differential |
| 726 |
coefficient by a noticeable whitespace. In the transformation coefficients |
| 727 |
of tensor calculus that is not desirable (in the author's opinion); |
| 728 |
\verb`\spacednil` comes to the rescue -- compare the first instance |
| 729 |
with the second in the following example: |
| 730 |
\begin{verbatim} |
| 731 |
\[ |
| 732 |
\spacednil |
| 733 |
\bar{g}_{ij}=\diffp{x^k}{\bar{x}^i} |
| 734 |
\diffp{x^l}{\bar{x}^j}g_{kl}, |
| 735 |
\] |
| 736 |
\[ |
| 737 |
\bar{g}_{ij}=\diffp{x^k}{\bar{x}^i} |
| 738 |
\diffp{x^l}{\bar{x}^j}g_{kl}. |
| 739 |
\] |
| 740 |
\end{verbatim} |
| 741 |
$\Longrightarrow$ \[\spacednil |
| 742 |
\bar{g}_{ij}=\diffp{x^k}{\bar{x}^i} |
| 743 |
\diffp{x^l}{\bar{x}^j}g_{kl} |
| 744 |
\] |
| 745 |
\[ |
| 746 |
\bar{g}_{ij}=\diffp{x^k}{\bar{x}^i} |
| 747 |
\diffp{x^l}{\bar{x}^j}g_{kl} |
| 748 |
\]The effect of \verb`\spacednil` has been confined to the first expression; |
| 749 |
the package option setting \verb`spaced=-1` has taken effect in the |
| 750 |
second and the multi-token differentiands are noticeably spaced from |
| 751 |
the $\partial$ operator. |
| 752 |
|
| 753 |
It is also worth recalling here the reduced spacing around scalable |
| 754 |
delimiters that results from using \verb`\mleft`, \verb`\mright` |
| 755 |
in place of \verb`\left`, \verb`\right`; see §\ref{sec:Package-options} |
| 756 |
on package options and specifically §\ref{subsec:mleftright}. |
| 757 |
|
| 758 |
\subsection{Higher order derivatives} |
| 759 |
|
| 760 |
\label{subsec:Higher-order-derivatives}An optional argument allows |
| 761 |
the order of differentiation to be specified. The order need not be |
| 762 |
a number; an algebraic order of differentiation is perfectly acceptable |
| 763 |
as is a mix of the two: |
| 764 |
\begin{example} |
| 765 |
\verb`\[ \diff[2]yx, \quad \diff[n+1]yx. \]` $\Longrightarrow$ \[ \diff[2]yx, \quad \diff[n+1]yx. \] |
| 766 |
\end{example} |
| 767 |
|
| 768 |
As mentioned, the braces can be and have been omitted around the $x$ |
| 769 |
and $y$ since they are single tokens. The square brackets around |
| 770 |
the optional order-of-differentiation argument are essential. In slash |
| 771 |
form, |
| 772 |
\begin{example} |
| 773 |
\verb`$ \difs[2]yx, \quad \difs[n+1]yx $` $\Longrightarrow$ $ \difs[2]yx, \quad \difs[n+1]yx, $ |
| 774 |
\end{example} |
| 775 |
|
| 776 |
\noindent the latter of which is a bit of an eyesore. In compact form, |
| 777 |
\begin{example} |
| 778 |
\verb`$ \difc[2]yx,\quad\difc[n+1]yx $` $\Longrightarrow$ $\difc[2]yx,\quad\difc[n+1]yx$. |
| 779 |
\end{example} |
| 780 |
|
| 781 |
\noindent Note that entering \verb`1` as the optional argument has |
| 782 |
no effect: |
| 783 |
\begin{example} |
| 784 |
\verb`$ \diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $` $\Longrightarrow$ |
| 785 |
$\diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $. |
| 786 |
\end{example} |
| 787 |
|
| 788 |
For partial derivatives when differentiating in only one variable |
| 789 |
the pattern is the same, e.g. |
| 790 |
\begin{example} |
| 791 |
\verb`\[ \diffp[2]yx, \quad \difsp[n+1]yx, \quad \difcp[2]yx. \]` |
| 792 |
$\Longrightarrow$ \[ \diffp[2]yx, \quad \difsp[n+1]yx, \quad \difcp[2]yx. \] |
| 793 |
\end{example} |
| 794 |
|
| 795 |
\noindent For partial differentiation in more than one variable -- |
| 796 |
so-called \emph{mixed} partial derivatives -- see §\ref{subsec:Mixed-partial-derivatives}. |
| 797 |
|
| 798 |
\subsubsection{Alternative ( : ) notation\protect\footnote{I thank \noun{Christophe Bal} for this suggestion.}} |
| 799 |
|
| 800 |
\label{subsec:Colon-notation}From version 5.3 of \texttt{diffcoeff} |
| 801 |
it is also possible to specify the order of differentiation by appending |
| 802 |
a colon and the order to the differentiation variable: |
| 803 |
\begin{example} |
| 804 |
\verb`\[ \diff y{x:2},\quad\difsp y{x:n+1},\quad\difcp y{x:2}. \]` |
| 805 |
$\Longrightarrow$ \[ \diff y{x:2}, \quad \difsp y{x:n+1}, \quad \difcp y{x:2}. \] |
| 806 |
\end{example} |
| 807 |
|
| 808 |
\noindent This is more relevant for mixed partial derivatives when |
| 809 |
there is more than one variable, each potentially to a different |
| 810 |
order of differentiation; see §\ref{subsec:AlgebraicOrders-ColonNotation}.\footnote{Note that there was a bug in version 5.4 of \texttt{diffcoeff} -- |
| 811 |
fixed in 5.5 -- with the implementation of this feature when the |
| 812 |
differentiation variable was subscripted, or when the order of differentiation |
| 813 |
was algebraic and subscripted.} |
| 814 |
|
| 815 |
\subsection{Appending the differentiand} |
| 816 |
|
| 817 |
\label{subsec:Appending-the-differentiand}Some differentiands are |
| 818 |
too big or awkward to be placed neatly in the numerator of a derivative |
| 819 |
and it is natural to \emph{append} them to a preceding differential |
| 820 |
operator. One could leave the numerator argument empty in the \verb`\difx` |
| 821 |
or \verb`\difxp` command and follow the command with the differentiand, |
| 822 |
but \texttt{diffcoeff} offers a better way: star the \verb`\difx` |
| 823 |
or \verb`\difxp` command. This tells \texttt{diffcoeff} to append |
| 824 |
the differentiand. Thus suppose the differentiand is a polynomial, |
| 825 |
say $ax^{2}+bx+c$. Add a star (an asterisk) to the \verb`\diff` |
| 826 |
command: |
| 827 |
\begin{example} |
| 828 |
\verb`\[ \diff*{(ax^2+bx+c)}x. \]` $\Longrightarrow$ \[ \diff*{(ax^{2}+bx+c)}x. \] |
| 829 |
\end{example} |
| 830 |
|
| 831 |
\noindent Or, for a partial derivative, one might want to indicate |
| 832 |
in the differentiand all the variables on which it depends: |
| 833 |
\begin{example} |
| 834 |
\verb`\[ \diffp*[2]{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]{\Phi(x,y,z)}x. \] |
| 835 |
\end{example} |
| 836 |
|
| 837 |
A virtue of using an asterisk to append the differentiand is that |
| 838 |
if one isn't sure whether to append or not, it is an easy matter to |
| 839 |
simply insert or delete the asterisk to compare the results. For instance, |
| 840 |
a second derivative is an iterated derivative -- one in which a derivative |
| 841 |
forms the differentiand of another . Thus |
| 842 |
\begin{example} |
| 843 |
\verb`\[ \diff[2]yx = \diff*{\diff yx}x \]` $\Longrightarrow$ \[ \diff[2]yx=\diff*{\diff yx}x .\] |
| 844 |
\end{example} |
| 845 |
|
| 846 |
\noindent This result is more elegant to my eye than what results |
| 847 |
when removing the asterisk, |
| 848 |
\begin{example} |
| 849 |
\noindent\verb`\[ \diff[2]yx = \diff{\diff yx}x \]` $\Longrightarrow$ |
| 850 |
\[ \diff[2]yx=\diff{\diff yx}x ,\] |
| 851 |
\end{example} |
| 852 |
|
| 853 |
\noindent although whether the \emph{meaning} is clearer is moot. |
| 854 |
|
| 855 |
\subsubsection{Operator parenthesizing} |
| 856 |
|
| 857 |
For slash fraction derivatives, when the derivand is appended, the |
| 858 |
operator is parenthesized: |
| 859 |
\begin{example} |
| 860 |
\verb`$ \difs*{(ax^2+bx+c)}x $` $\Longrightarrow$ $\difs*{(ax^2+bx+c)}x $. |
| 861 |
\end{example} |
| 862 |
|
| 863 |
\noindent Similarly, for slash-style partial derivatives, |
| 864 |
\begin{example} |
| 865 |
\verb`$ \difsp*[2]{\Phi(x,y,z)}x $` $\Longrightarrow$ $\difsp*[2]{\Phi(x,y,z)}x $ |
| 866 |
\end{example} |
| 867 |
|
| 868 |
\noindent parentheses are again inserted automatically around the |
| 869 |
differential operator. If you don't want the parentheses, like other |
| 870 |
elements of automatic formatting this behaviour can be changed; see |
| 871 |
§\ref{sec:Variant-forms}, §\ref{sec:ChangingDefaults}. |
| 872 |
|
| 873 |
Since the differentiand is appended \emph{by default} in compact-form |
| 874 |
derivatives, starring has no effect and \verb`\difcp`, \verb`\difcp*` |
| 875 |
produce identical results. |
| 876 |
|
| 877 |
\subsubsection{Transposing the argument order} |
| 878 |
|
| 879 |
\label{subsec:Transposing-the-argument}If a \emph{second} asterisk |
| 880 |
follows the first, the order of the arguments specifying the differentiand |
| 881 |
and variable(s) of differentiation is reversed. Thus it is clearer |
| 882 |
to the eye to write |
| 883 |
\begin{example} |
| 884 |
\verb`\[ \diffp**x{(ax^2+2bxy+cy^2)} \]` $\Longrightarrow$ \[\diffp**x{(ax^2+2bxy+cy^2)}\] |
| 885 |
\end{example} |
| 886 |
|
| 887 |
\noindent than \verb`\[ \diffp*{(ax^2+2bxy+cy^2)}x \]`, where the |
| 888 |
eye has to search for the variable of differentiation. This is especially |
| 889 |
the case if the differentiand contains multiple variables and includes |
| 890 |
commands like \verb`\frac` or \verb`\sqrt` requiring braced arguments. |
| 891 |
Compare \verb`\diffp*{\frac1{\sqrt{x_i^2-x_j^2}}}{x_i}` with |
| 892 |
\begin{verbatim} |
| 893 |
\[ \diffp**{x_i}{\frac1{\sqrt{x_i^2-x_j^2}}}. \] |
| 894 |
\end{verbatim} |
| 895 |
$\Longrightarrow$ \[ \diffp**{x_i}{\frac1{\sqrt{x_i^2-x_j^2}}}. \] |
| 896 |
|
| 897 |
For compact-form derivatives the initial, appending asterisk is always |
| 898 |
implicitly present. However, it must be \emph{explicitly} present |
| 899 |
for the second asterisk to take effect: |
| 900 |
\begin{example} |
| 901 |
\verb`$ \difcp yx,\quad\difcp*yx,\quad\difcp**yx $` $\Longrightarrow$ |
| 902 |
$ \difcp yx,\quad \difcp*yx,\quad \difcp**yx $. |
| 903 |
\end{example} |
| 904 |
|
| 905 |
|
| 906 |
\paragraph{The \texttt{dif{*}{*}} package option} |
| 907 |
|
| 908 |
Since the natural inclination is to read $\difc yx$ as (something |
| 909 |
like) \emph{d sub x y}, and yet the arguments of \verb`\difc yx` |
| 910 |
are presented in the reverse order, you might wish to make the double |
| 911 |
asterisk state the default and \emph{always} present the variable(s) |
| 912 |
of differentiation before the differentiand, at least for compact |
| 913 |
derivatives. This can be done with the package option \verb`dif**`. |
| 914 |
By entering \verb`dif**={c,cp}` in the optional argument of the \verb`\usepackage` |
| 915 |
command when calling \texttt{diffcoeff}, |
| 916 |
\begin{verbatim} |
| 917 |
\usepackage[dif**={c,cp}]{diffcoeff} |
| 918 |
\end{verbatim} |
| 919 |
the reversed order of arguments, first the differentiation variable(s) |
| 920 |
then the differentiand, becomes the default condition for \verb`\difc` |
| 921 |
and \verb`\difcp`. \emph{Now} appending two asterisks to \verb`\difc` |
| 922 |
and \verb`\difcp` means reversing this \emph{new} default, a double |
| 923 |
reversal overall, returning to the original state in which the differentiand |
| 924 |
precedes the variable(s) of differentiation. If you want to extend |
| 925 |
the reversed argument order also to, say, \verb`\difs`, \verb`\difsp`, |
| 926 |
set \verb`dif**={c,cp,s,sp}`, or to extend it to all derivatives |
| 927 |
set \verb`\dif**={c,cp,s,sp,f,fp}`. |
| 928 |
|
| 929 |
\subsection{Point of evaluation/variables held constant} |
| 930 |
|
| 931 |
\label{subsec:Point-of-evaluation}If you want to specify a point |
| 932 |
at which a derivative is evaluated, append a final square-bracketed |
| 933 |
optional argument: |
| 934 |
\begin{example} |
| 935 |
\verb`\[ \diff[2]yx[0] \]` $\Longrightarrow$ \[ \diff[2]yx[0] \] |
| 936 |
\end{example} |
| 937 |
|
| 938 |
\noindent Note that there must be \emph{no space} before the left |
| 939 |
square bracket of the trailing argument, otherwise it will be treated |
| 940 |
as part of the wider mathematical expression of which the derivative |
| 941 |
is part and typeset as such. (But this should not cause a \LaTeX{} |
| 942 |
error.) |
| 943 |
\begin{itemize} |
| 944 |
\item If you prefer to use subscripted \emph{square} brackets |
| 945 |
\[ |
| 946 |
\diffp.].{F(x,y)}x[(0,0)] |
| 947 |
\] |
| 948 |
or a subscripted vertical rule after the derivative |
| 949 |
\[ |
| 950 |
\diffp.|.{F(x,y)}x[(0,0)] |
| 951 |
\] |
| 952 |
to indicate a point of evaluation, then this can easily be done; see |
| 953 |
§\ref{subsec:variantPt-of-eval}. Parentheses are the ISO recommendation; |
| 954 |
see ISO 80000-2. |
| 955 |
\end{itemize} |
| 956 |
Because the slash form spreads the derivative out horizontally, parentheses |
| 957 |
are the natural way in this case to indicate a point of evaluation: |
| 958 |
\begin{example} |
| 959 |
\verb`$ \difs{\!\ln sin x}{sin x}[x=\pi/3] $` $\Longrightarrow$ |
| 960 |
$ \difs{\!\ln\sin x}{\sin x}[x=\pi/3]$. |
| 961 |
\end{example} |
| 962 |
|
| 963 |
\noindent A vertical rule can easily become too remote from the opening |
| 964 |
`d' of the differential coefficient: $\difs.|.{\!\ln\sin x}{\sin x}[x=\pi/3]$. |
| 965 |
Parentheses tie the whole cluster of symbols together. |
| 966 |
|
| 967 |
Parentheses are also used with partial derivatives to indicate variables |
| 968 |
held constant, particularly in thermodynamics. In the following well-known |
| 969 |
relation in the subject, the differentiands are appended and the trailing |
| 970 |
argument is used to indicate the variables held constant: |
| 971 |
\begin{example} |
| 972 |
\verb`\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U] \]` $\Longrightarrow$ |
| 973 |
\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U]. \] |
| 974 |
\end{example} |
| 975 |
|
| 976 |
\noindent This is much easier to write than building the expressions |
| 977 |
`by hand', starting with \verb`\left(` and finishing with \verb`_U`. |
| 978 |
|
| 979 |
\subsubsection{Superscripts} |
| 980 |
|
| 981 |
It is easy to add a superscript to a derivative to indicate evaluation |
| 982 |
at two points and the difference between the values: |
| 983 |
\begin{example} |
| 984 |
\verb`\[ \diff {\!\sin x}x[0]^{\mkern-11mu\pi/2} \]` ${\displaystyle \Longrightarrow}$ |
| 985 |
\[ \diff{\!\sin x}x[0]^{\mkern-11mu\pi/2} \] |
| 986 |
\end{example} |
| 987 |
|
| 988 |
\noindent but to my eye either square brackets or a vertical rule |
| 989 |
are clearer for this purpose (and do not involve nudging the subscript |
| 990 |
or superscript closer to the right delimiter); see §\ref{sec:Variant-forms}. |
| 991 |
|
| 992 |
\subsubsection{Empty trailing argument} |
| 993 |
|
| 994 |
\noindent If the trailing argument is included but left empty it will, |
| 995 |
with the default set-up, wrap the derivative in parentheses but with |
| 996 |
no subscript. This fact can be exploited. Thus, for a particle of |
| 997 |
mass $m$ moving along a line, distant $x$ from the origin at time |
| 998 |
$t$, the kinetic energy is: |
| 999 |
\begin{example} |
| 1000 |
\noindent\verb`$ \tfrac 12 m \difs xt[]^2 $` $\Longrightarrow$ |
| 1001 |
$\tfrac{1}{2}m\difs xt[]^{2}$. |
| 1002 |
\end{example} |
| 1003 |
|
| 1004 |
Or, again exploiting the parentheses resulting from an empty trailing |
| 1005 |
argument, Lagrange's equations of motion in analytic mechanics can |
| 1006 |
be written, |
| 1007 |
\begin{example} |
| 1008 |
\verb`\[ \diffp L{q_k}-\diff**t{ \diffp L{\dot{q}_k}[] } = 0 \]` |
| 1009 |
$\Longrightarrow$\[\diffp L{q_k}-\diff**t{\diffp L{\dot{q}_k}[]} = 0. \] |
| 1010 |
\end{example} |
| 1011 |
|
| 1012 |
\noindent (See §\ref{subsec:Transposing-the-argument} for the double |
| 1013 |
asterisk.) |
| 1014 |
|
| 1015 |
You may feel that there is too much whitespace before the large left |
| 1016 |
parenthesis in this expression. The present document uses the \verb`spaced=-1` |
| 1017 |
package option which inserts a thin space before a multi-token differentiand. |
| 1018 |
The \verb`\spacednil` command (see §\ref{subsec:Spacing-commands}) |
| 1019 |
cancels that, just leaving the built-in spacing of \verb`\left(`: |
| 1020 |
\begin{verbatim} |
| 1021 |
\[ |
| 1022 |
\spacednil |
| 1023 |
\diffp L{q_k}-\diff**t{ \diffp L{\dot{q}_k}[] } = 0. |
| 1024 |
\] |
| 1025 |
\end{verbatim} |
| 1026 |
\noindent$\Longrightarrow$ \[\spacednil \diffp L{q_k}-\diff**t{\diffp L{\dot{q}_k}[]} = 0. \] |
| 1027 |
|
| 1028 |
\subsection{Mixed partial derivatives} |
| 1029 |
|
| 1030 |
\label{subsec:Mixed-partial-derivatives}The new thing with partial |
| 1031 |
derivatives, not present with ordinary derivatives, is the possibility |
| 1032 |
of differentiation in more than one variable, so-called \emph{mixed} |
| 1033 |
partial derivatives. If each variable is differentiated only to the |
| 1034 |
first order, then it is easy to specify the derivative. Suppose $F$ |
| 1035 |
is a function of three variables, $x$, $y$, $z$. Then |
| 1036 |
\begin{example} |
| 1037 |
\verb`\[ \diffp F{x,y,z},\quad \diffp{F(x,y,z)}{x,y,z}. \]` $\Longrightarrow$ |
| 1038 |
\[ \diffp F{x,y,z},\quad \diffp{F(x,y,z)}{x,y,z}. \] |
| 1039 |
\end{example} |
| 1040 |
|
| 1041 |
\noindent The variables of differentiation are listed in order in |
| 1042 |
a comma list -- \verb`{x,y,z}` -- forming the second mandatory |
| 1043 |
argument. The total order of differentiation (3 in the example) was |
| 1044 |
calculated by \texttt{diffcoeff} and was inserted automatically. (The |
| 1045 |
effect of the \verb`spaced=-1` package option can be seen in the |
| 1046 |
second member of this example.) |
| 1047 |
|
| 1048 |
The slash form is |
| 1049 |
\begin{example} |
| 1050 |
\verb`$ \difsp F{x,y,z} $` $\Longrightarrow$ $ \difsp F{x,y,z}$, |
| 1051 |
\end{example} |
| 1052 |
|
| 1053 |
\noindent and the compact form is |
| 1054 |
\begin{example} |
| 1055 |
\verb`$ \difcp F{x,y,z} $` $\Longrightarrow$ $ \difcp F{x,y,z}$. |
| 1056 |
\end{example} |
| 1057 |
|
| 1058 |
\noindent One might wonder about an even more compact notation like |
| 1059 |
$ \difcp.cc.<3>F{x,y,z}$ or $\difccp F{x,y,z}$? These can be readily |
| 1060 |
achieved by means of a variant form; see §\ref{subsec:variantCompact=002013forms}. |
| 1061 |
|
| 1062 |
To differentiate variables to higher order, their orders need to be |
| 1063 |
specified explicitly. To do so use a comma list for the optional argument: |
| 1064 |
\begin{example} |
| 1065 |
\verb`\[ \diffp[2,3]F{x,y,z},\quad \difsp[2,3]F{x,y,z}. \]` $\Longrightarrow$ |
| 1066 |
\[ \diffp[2,3]F{x,y,z},\quad \difsp[2,3]F{x,y,z}. \] |
| 1067 |
\end{example} |
| 1068 |
|
| 1069 |
\noindent The overall order of the derivative -- 6 -- is again automatically |
| 1070 |
calculated and inserted as a superscript on the $\partial$ symbol |
| 1071 |
in the numerator. |
| 1072 |
|
| 1073 |
In these examples, the comma list of orders has only \emph{two} members, |
| 1074 |
although there are \emph{three} variables. It is assumed that the |
| 1075 |
orders given in the comma list apply in sequence to the variables, |
| 1076 |
the first order to the first variable, the second to the second variable, |
| 1077 |
and so on, and that any subsequent orders not listed in the optional |
| 1078 |
argument are 1. Thus we need to specify only 2 and 3 in the example; |
| 1079 |
the order of differentiation of $z$ is 1 by default. But you \emph{cannot} |
| 1080 |
use an order specification like \verb`[,,2]`; instead write {\ttfamily\verb`[1,1,2]`} |
| 1081 |
(which is the natural thing to do in any case).\textbf{ }It is only |
| 1082 |
the \emph{tail} of an order specification which can be omitted. In |
| 1083 |
the other direction, if there are more orders of differentiation specified |
| 1084 |
than there are variables, the list of orders is truncated to match |
| 1085 |
the number of variables. |
| 1086 |
|
| 1087 |
For compact-form derivatives, and using the colon notation to specify |
| 1088 |
the orders of differentiation (available since version 5.3 of \texttt{diffcoeff}), |
| 1089 |
\begin{example} |
| 1090 |
\verb`$ \difcp F{x:2,y:3,z} $` $\Longrightarrow$ $ \difcp F{x:2,y:3,z}$. |
| 1091 |
\end{example} |
| 1092 |
|
| 1093 |
\noindent A `doubly compact' notation is also possible, producing |
| 1094 |
$\difccp F{x:2,y:3,z}$ -- see §\ref{subsec:variantCompact=002013forms}. |
| 1095 |
|
| 1096 |
\subsubsection{Algebraic orders} |
| 1097 |
|
| 1098 |
\label{subsec:AlgebraicOrders-ColonNotation}Orders of differentiation |
| 1099 |
can be algebraic as well as numerical: |
| 1100 |
\begin{example} |
| 1101 |
\verb`\[ \diffp[2m-1,m+1,2]F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2m-1,m+1,2]F{x,y,z}\] |
| 1102 |
\end{example} |
| 1103 |
|
| 1104 |
The total order of differentiation is still calculated by \texttt{diffcoeff}. |
| 1105 |
Or again, |
| 1106 |
\begin{example} |
| 1107 |
\verb`\[ \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$ |
| 1108 |
\[ \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z}. \] |
| 1109 |
\end{example} |
| 1110 |
|
| 1111 |
\noindent Algebraic orders are sorted according to increasing number |
| 1112 |
of characters -- hence $km$ after $m$ and $k$ in the example -- |
| 1113 |
then followed by the total numeric order. |
| 1114 |
|
| 1115 |
When there are two or more variables of differentiation, particularly |
| 1116 |
when subject to different orders of differentiation, the colon notation |
| 1117 |
(see §\ref{subsec:Colon-notation}) is clearer to both writer and |
| 1118 |
reader; it avoids a lot of clutter: |
| 1119 |
\begin{example} |
| 1120 |
\verb`\[ \diffp{F(x,y,z)}{x,y:km+1,z:m+k-1} \]` $\Longrightarrow$ |
| 1121 |
\[ \diffp{F(x,y,z)}{x,y:km+1,z:m+k-1}. \] |
| 1122 |
\end{example} |
| 1123 |
|
| 1124 |
Note that it suffices to write \verb`x` rather than \verb`x:1`. |
| 1125 |
If, in a fit of absent-mindedness, one specifies the orders of differentiation |
| 1126 |
by both methods, it is the colon notation that prevails: |
| 1127 |
\begin{example} |
| 1128 |
\verb`\[ \diffp[1,2,3]{F(x,y,z)}{x:4,y:5,z:6} \]` $\Longrightarrow$ |
| 1129 |
\[ \diffp[1,2,3]{F(x,y,z)}{x:4,y:5,z:6} \] |
| 1130 |
\end{example} |
| 1131 |
|
| 1132 |
|
| 1133 |
\subsubsection{Parentheses} |
| 1134 |
|
| 1135 |
Auto-calculation of the total order can also handle the simple use |
| 1136 |
of parentheses: |
| 1137 |
\begin{example} |
| 1138 |
\verb`\[ \diffp[2m-(k+1),2(k+1)-m]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$ |
| 1139 |
\[ \diffp[2m-(k+1),2(k+1)-m]{F(x,y,z)}{x,y,z} \] |
| 1140 |
\end{example} |
| 1141 |
|
| 1142 |
The left parenthesis in each case is preceded by a \emph{number} or |
| 1143 |
a \emph{sign}. In evaluating the total order \texttt{diffcoeff} multiplies |
| 1144 |
out the expression (or that is the effect). However, an order specification |
| 1145 |
like \verb`[f(n+1),f(n-1)]` is interpreted as the familiar `function |
| 1146 |
of' notation -- in this case a function $f$ evaluated at $n\pm1$. |
| 1147 |
\texttt{diffcoeff} \emph{always} interprets a left parenthesis preceded |
| 1148 |
by something that is \emph{not} a number or a sign in this way. It |
| 1149 |
does not try to multiply out such expressions when calculating the |
| 1150 |
total order. The following example combines both uses: |
| 1151 |
\begin{example} |
| 1152 |
\verb`\[\diffp[2(f(n)-(m-1)),5-(f(n)+m)]F{x,y}\]` $\Longrightarrow$ |
| 1153 |
\[\diffp[2(f(n)-(m-1)),5-(f(n)+m)]F{x,y}\] |
| 1154 |
\end{example} |
| 1155 |
|
| 1156 |
|
| 1157 |
\subsubsection{Order-override option} |
| 1158 |
|
| 1159 |
\label{subsec:Order-override-command}Sometimes the total order of |
| 1160 |
differentiation may not be calculable by \texttt{diffcoeff}. For instance, |
| 1161 |
an order specification like \verb`[m(k-1)+1,m(k+1)-1]` may not be |
| 1162 |
meant in the `function of' sense, but rather that \verb`m` multiplies |
| 1163 |
\verb`k-1` and \verb`k+1`. To cope with such situations, \texttt{diffcoeff} |
| 1164 |
provides the \emph{order-override option}.\footnote{I thank \noun{Christophe Bal} for urging the availability of this |
| 1165 |
argument and the use of angle brackets.} This is an \emph{angle-bracket }delimited (using the `less than' |
| 1166 |
and `greater than' symbols, \verb`< >`) optional argument between |
| 1167 |
the order specification (if it is used) and the differentiand, in |
| 1168 |
which is entered the desired form of the total order of differentiation. |
| 1169 |
Angle brackets provide a necessary distinction from the square-bracket |
| 1170 |
delimited order specification. |
| 1171 |
|
| 1172 |
In an earlier example, the total order of differentiation $m+k+km+1$ |
| 1173 |
factorizes to $(k+1)(m+1)$. \texttt{diffcoeff} is not a computer |
| 1174 |
algebra system and does not do such factorizations but if you would |
| 1175 |
like to express the total order in that form, use the override option: |
| 1176 |
\begin{verbatim} |
| 1177 |
\[ \diffp<(k+1)(m+1)>{F(x,y,z)}{x,y:km+1,z:m+k-1}. \] |
| 1178 |
\end{verbatim} |
| 1179 |
$\Longrightarrow$ \[ \diffp<(k+1)(m+1)>{F(x,y,z)}{x,y:km+1,z:m+k-1}. \] |
| 1180 |
|
| 1181 |
When the override option is used, the algorithm that calculates the |
| 1182 |
total order does not get called at all In this way not only can the |
| 1183 |
total order be presented in whatever manner you wish but essentially |
| 1184 |
arbitrary material can be attached as a superscript to the $\partial$ |
| 1185 |
(or other) symbol in the numerator. |
| 1186 |
|
| 1187 |
(Note that for compact-form derivatives, prior to version 5.5 of \texttt{diffcoeff}, |
| 1188 |
the override option was irrelevant. Version 5.5 introduced a `doubly |
| 1189 |
compact' notation and that is no longer so; see §\ref{subsec:variantCompact=002013forms}.) |
| 1190 |
|
| 1191 |
\paragraph{Order-override command (deprecated):} |
| 1192 |
|
| 1193 |
\noindent As an alternative to the override option, you can use the |
| 1194 |
\verb`\difoverride` command, although\emph{ this is now deprecated}. |
| 1195 |
(It was introduced to avoid cluttered expressions, but that is reduced |
| 1196 |
with the introduction of the colon notation and an angle-bracketed |
| 1197 |
override optional argument.) The command takes one (mandatory) argument, |
| 1198 |
the total order of differentiation, which it stores: |
| 1199 |
\begin{verbatim} |
| 1200 |
\[ |
| 1201 |
\difoverride{(k+1)(m+1)} |
| 1202 |
\diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z} |
| 1203 |
\] |
| 1204 |
\end{verbatim} |
| 1205 |
$\Longrightarrow$ \[ |
| 1206 |
\difoverride{(k+1)(m+1)} |
| 1207 |
\diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z} |
| 1208 |
\] |
| 1209 |
|
| 1210 |
\noindent Note that in the example \verb`\difoverride` has been used |
| 1211 |
\emph{within }the math environment. This is good practice. It prevents |
| 1212 |
the contents of the command erroneously overriding the orders of later |
| 1213 |
derivatives in other math environments, but it does mean that if you |
| 1214 |
want to include a later derivative within \emph{this} mathematical |
| 1215 |
environment then you will need to precede the second derivative with |
| 1216 |
the statement \verb`\difoverride{}`. |
| 1217 |
|
| 1218 |
\subsubsection{Error messages} |
| 1219 |
|
| 1220 |
The order-override option is also needed when calculating the total |
| 1221 |
order is beyond the abilities of \texttt{diffcoeff}. The package is |
| 1222 |
\emph{not} a computer algebra system. It can cope with order specifications |
| 1223 |
where variables are followed by diverse arithmetic operators: \verb`n^2`, |
| 1224 |
\verb`m\times n`, \verb`m/2` and the like cause no problems. But |
| 1225 |
a \emph{number} can be followed \emph{only} by a sign or a variable |
| 1226 |
or a left parenthesis. Anything beyond this will raise an error. For |
| 1227 |
instance |
| 1228 |
\begin{example} |
| 1229 |
\verb`\[ \diffp[2^k]F{x,y} \]` |
| 1230 |
\end{example} |
| 1231 |
|
| 1232 |
\noindent produces a message beginning `\texttt{! Package diffcoeff |
| 1233 |
Error:}' and continuing, |
| 1234 |
\begin{verbatim} |
| 1235 |
number followed by ^ in the order spec. [2^k,1] on |
| 1236 |
line xx. Calculation of the total differentiation |
| 1237 |
order fails in this case. Use the order override |
| 1238 |
option to enter the total order. See the |
| 1239 |
diffcoeff documentation for further information. |
| 1240 |
\end{verbatim} |
| 1241 |
(The \verb`xx` will be replaced by a specific line number in each |
| 1242 |
case. Line breaking may also differ from case to case.) To avoid such |
| 1243 |
errors and enable compilation to proceed, do as the message suggests |
| 1244 |
-- use the override option. |
| 1245 |
|
| 1246 |
There are limitations on what order specifications the \texttt{diffcoeff} |
| 1247 |
package can `digest', but in real life that is unlikely to be significant. |
| 1248 |
Mixed partial derivatives are used far less often than the pure derivatives, |
| 1249 |
and when they \emph{are} used it is nearly always to low numerical |
| 1250 |
orders like 1 or 2. For those rare other cases, the override option |
| 1251 |
is always available. |
| 1252 |
|
| 1253 |
\subsubsection{Generic mixed partial derivatives} |
| 1254 |
|
| 1255 |
\label{par:Generic-derivatives}The question was posed on \TeX{} StackExchange\footnote{\url{https://tex.stackexchange.com/questions/745070/partial-derivatives-with-n- variables-in-diffcoeff}} |
| 1256 |
about how to write a generic mixed partial derivative. In version |
| 1257 |
5.4 of \texttt{diffcoeff}, the answer provided looked like this, \verb`\diffp<n>{y}{x_1,x_2\dots,x_n}`, |
| 1258 |
in which the \verb`\dots` command (from \texttt{amsmath}) has been |
| 1259 |
adjoined to the variable \verb`x_2` in the specification. However, |
| 1260 |
the enquirer's first instinct had been to insert \verb`\dots` between |
| 1261 |
commas in the variable list, as one would with a proper differentiation |
| 1262 |
variable. The problem was that a $\partial$ operator was inserted |
| 1263 |
immediately before the dots. From version 5.5 of \texttt{diffcoeff} |
| 1264 |
one can achieve the desired effect in that `first instinct' way |
| 1265 |
but, rather than inserting \verb`\dots` or \verb`\ldots` or \verb`\cdots`, |
| 1266 |
one enters three dots (periods, full stops). These are converted by |
| 1267 |
\texttt{diffcoeff} into a chosen dots command. By default \texttt{diffcoeff} |
| 1268 |
uses \verb`\cdots` for upright fraction derivatives (\verb`\diffp`), |
| 1269 |
and \verb`\ldots` for slash-fraction (\verb`\difsp`) and compact |
| 1270 |
form (\verb`\difcp`) derivatives. |
| 1271 |
|
| 1272 |
\noindent{}% |
| 1273 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 1274 |
\begin{shaded}% |
| 1275 |
|
| 1276 |
\paragraph{A dissertation on dots} |
| 1277 |
|
| 1278 |
To justify the \texttt{diffcoeff} defaults, the understanding is that |
| 1279 |
one uses \verb`\ldots` in a list-like context, $a,b,\ldots,k$, and |
| 1280 |
\verb`\cdots` between binary relations, $a+b+\cdots+k$. In that |
| 1281 |
sense, the clearest case with relevance for \texttt{diffcoeff} is |
| 1282 |
a product of differentials (see §\ref{sec:Differentials}) of the |
| 1283 |
kind that might occur in a multiple integral: |
| 1284 |
\[ |
| 1285 |
\int\dotsi\int F(x_{1},\ldots,x_{n})\dl{x_{1}\!,...,x_{n}} |
| 1286 |
\] |
| 1287 |
The relevant dots here are those between the differentials. (An explicit |
| 1288 |
\verb`\dotsi` from \texttt{amsmath} has been used between the integral |
| 1289 |
signs and an explicit \verb`\ldots` in the list of arguments of $F$.) |
| 1290 |
Here $\dl{x_{1}\!,...,x_{n}}$ is an element of volume in an $n$-dimensional |
| 1291 |
space, a product of $n$ infinitesimal lengths $\dl{x_{i}}$. Between |
| 1292 |
the $\mathrm{d}{x_{i}}$ is an implicit product sign, a \verb`\cdot` |
| 1293 |
( $\cdot$ ), and so three dots entered in the argument of a \verb`\dl` |
| 1294 |
command are rightly converted to \verb`\cdots`. Also clear to my |
| 1295 |
mind is the compact form partial derivative, $\difcp{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}$, |
| 1296 |
which is not a product but a sequence of operators $\difcp{}{x_{i}}$ |
| 1297 |
applied one after the other. Using \verb`\ldots` in this case seems |
| 1298 |
appropriate. \end{shaded}% |
| 1299 |
\end{minipage} |
| 1300 |
|
| 1301 |
\noindent{}% |
| 1302 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 1303 |
\begin{shaded}% |
| 1304 |
Generic slash- and upright fraction derivatives are also sequences |
| 1305 |
of operations but the construction of the derivatives, distributed |
| 1306 |
over numerator and denominator, disguises the fact. Since the slash |
| 1307 |
in a slash fraction tends to isolate the denominator and so \emph{visually} |
| 1308 |
brings \verb`\difsp` closer to \verb`\difcp`, there seems no reason |
| 1309 |
not to use \verb`\ldots` in this case: $\difsp<n>{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}$. |
| 1310 |
But what to make of |
| 1311 |
\[ |
| 1312 |
\diffp<n>{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}\,? |
| 1313 |
\] |
| 1314 |
In an upright fraction like this, \verb`\cdots` breaks up the whitespace |
| 1315 |
better than \verb`\ldots`, which leaves too much whitespace between |
| 1316 |
the dots near the bottom of the denominator and the total order of |
| 1317 |
differentiation $n$ near the top of the numerator, producing a `hollowed |
| 1318 |
out' symbol: |
| 1319 |
\[ |
| 1320 |
\difdef{fp}{ldots}{dots=\ldots}\diffp.ldots.<n>F{x_{1},...,x_{n}},\quad\diffp<n>F{x_{1},...,x_{n}}. |
| 1321 |
\] |
| 1322 |
Hence \verb`\cdots` is the \texttt{diffcoeff} default. If you prefer |
| 1323 |
different choices, see §\ref{subsec:variantGeneric-cdot-/} on how |
| 1324 |
to make them \emph{your} defaults.\end{shaded}% |
| 1325 |
\end{minipage}\medskip{} |
| 1326 |
In the following examples, note the use of the override option. |
| 1327 |
\begin{verbatim} |
| 1328 |
\[ \diffp<n>F{x_1,x_2,...,x_n},\quad |
| 1329 |
\diffp<n>F{u:a,v:b,...,z:k}. \] |
| 1330 |
\end{verbatim} |
| 1331 |
$\Longrightarrow$ \[ \diffp<n>F{x_1,x_2,...,x_n},\quad |
| 1332 |
\diffp<n>F{u:a,v:b,...,z:k}.\] |
| 1333 |
|
| 1334 |
For slash-fraction and compact form derivatives, |
| 1335 |
\begin{verbatim} |
| 1336 |
\[ \difcp<n>F{x_1,x_2,...,x_n},\quad |
| 1337 |
\difsp<n>F{u:a,v:b,...,z:k}. \] |
| 1338 |
\end{verbatim} |
| 1339 |
$\Longrightarrow$ \[ \difcp<n>F{x_1,x_2,...,x_n},\quad |
| 1340 |
\difsp<n>F{u:a,v:b,...,z:k}.\] |
| 1341 |
|
| 1342 |
It is sometimes possible to omit the override option by assigning |
| 1343 |
an appropriate order to the dots: |
| 1344 |
\begin{verbatim} |
| 1345 |
\[ \diffp[1,1,n-3]F{x_1,x_2,...,x_n}. \] |
| 1346 |
\end{verbatim} |
| 1347 |
$\Longrightarrow$ \[ \diffp[1,1,n-3]F{x_1,x_2,...,x_n},\] |
| 1348 |
|
| 1349 |
\noindent where the order $n-3$ has been assigned to the dots, or |
| 1350 |
even |
| 1351 |
\begin{verbatim} |
| 1352 |
\[ \diffp F{u:a,v:b,...:\cdots,z:k\relax }, \] |
| 1353 |
\end{verbatim} |
| 1354 |
$\Longrightarrow$ \[ \diffp F{u:a,v:b,...:\cdots,z:k\relax },\] |
| 1355 |
|
| 1356 |
\noindent where the dots have been assigned the `order' \verb`\cdots`. |
| 1357 |
\texttt{diffcoeff} stores the algebraic orders of differentiation |
| 1358 |
as \emph{strings} -- sequences of characters. Since they are sorted |
| 1359 |
by number of characters and \verb`\cdots` (including the backslash) |
| 1360 |
has $6$, I have padded \verb`k` with \verb`\relax` which also has |
| 1361 |
$6$ characters and has no visual effect to ensure that $\cdots$ |
| 1362 |
sorts \emph{between} $b$ and $k$; (\verb`\empty` would have served |
| 1363 |
equally well). |
| 1364 |
|
| 1365 |
\subsubsection{Comma list of variables of differentiation} |
| 1366 |
|
| 1367 |
\label{subsec:Comma-list-of-vars}In tensor calculus or analytic mechanics |
| 1368 |
differentiations are almost always in terms of super- or subscripted |
| 1369 |
coordinates. In many other contexts multi-token variables of differentiation |
| 1370 |
are common too -- the reciprocal of the temperature for instance |
| 1371 |
in thermodynamics. This is why a comma list is used in \texttt{diffcoeff} |
| 1372 |
for specifying variables of differentiation for mixed partial derivatives. |
| 1373 |
Although it would be nice to write the minimal \verb`{xy}` rather |
| 1374 |
than \verb`{x,y}` when two variables $x$ and $y$ are involved, |
| 1375 |
the extra writing is trivial and the comma list allows a simpler handling |
| 1376 |
of multi-character variables. Thus in tensor calculus we find expressions |
| 1377 |
like |
| 1378 |
\begin{example} |
| 1379 |
\verb`\[ \diffp{A_i}{x^j,x^k} \]` $\Longrightarrow$ \[ \diffp{A_i}{x^j,x^k}. \] |
| 1380 |
\end{example} |
| 1381 |
|
| 1382 |
\noindent It is easier to write \verb`{x^j,x^k}` here than, say, |
| 1383 |
\verb`{{x^j}{x^k}}` to distinguish the variables. It's also easier |
| 1384 |
to read, particularly if the indices themselves get ornamented and |
| 1385 |
need surrounding braces: |
| 1386 |
\begin{example} |
| 1387 |
\verb`\[ \diffp{A_i}{x^{j'},x^{k'}} \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^{j'},x^{k'} }. \] |
| 1388 |
\end{example} |
| 1389 |
|
| 1390 |
\noindent Compare that variable specification, already requiring some |
| 1391 |
care, with the thicket of braces of \verb`{{x^{j'}}{x^{k'}}}`. Some |
| 1392 |
extra whitespace would help here, but the point stands: the comma |
| 1393 |
list requires fewer nested braces. Of course braces \emph{are} required |
| 1394 |
if a variable of differentiation includes a comma, for then the comma |
| 1395 |
needs to be enclosed in them. |
| 1396 |
|
| 1397 |
\subsubsection{Spacing in the denominator} |
| 1398 |
|
| 1399 |
\label{subsec:Minutiae-of-spacing}In Chapter 18 of the \emph{The |
| 1400 |
\TeX book}, Knuth suggests inserting a thin space, {\ttfamily\verb`\,`} |
| 1401 |
(or {\ttfamily\verb`3 mu`}), between differentials in appropriate |
| 1402 |
contexts, giving as an example $dx\,dy=r\,dr\,d\theta$. To my eye, |
| 1403 |
that degree of extra spacing in the denominator of a derivative seems |
| 1404 |
too great, interfering with seeing the derivative `as a whole', |
| 1405 |
\[ |
| 1406 |
\diffp.3mu.F{x,y,z}, |
| 1407 |
\] |
| 1408 |
especially for the slash-form: $\difsp.3mu.F{x,y,z}$. Some spacing |
| 1409 |
is desirable, but less. By default \texttt{diffcoeff} inserts \verb`2 mu` |
| 1410 |
(with stretch and shrink) between the terms, $\difsp F{x,y,z}$, bringing |
| 1411 |
the extremities into the overall symbol. |
| 1412 |
|
| 1413 |
Should a differentiation occur to higher order and so a variable acquire |
| 1414 |
a superscript, an adjustment is made to the extra spacing because |
| 1415 |
the superscript itself has a spacing effect. By default \verb`1 mu` |
| 1416 |
is subtracted from the default spacing. Thus in |
| 1417 |
\[ |
| 1418 |
\diffp[2]F{x,y,z}, |
| 1419 |
\] |
| 1420 |
spacing of \verb`2 mu` is inserted between the $\partial y$ and |
| 1421 |
$\partial z$, but because the superscript already provides some separation |
| 1422 |
between them, only \verb`1 mu` is inserted between $\partial x^{2}$ |
| 1423 |
and $\partial y$. The values used for the spacing and its adjustment |
| 1424 |
in the presence of a superscript can be changed by the user; see Chapter~\ref{chap:Templates-defaults-variants}. |
| 1425 |
|
| 1426 |
When the variables themselves are superscripted, as happens in tensor |
| 1427 |
calculus, no automatic adjustment is made. Any fine-tuning must be |
| 1428 |
done by the user using explicit spacing commands: |
| 1429 |
\begin{example} |
| 1430 |
\verb`\[ \diffp{A_i}{ x^j\negmu,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j\negmu,x^k }.\] |
| 1431 |
\end{example} |
| 1432 |
|
| 1433 |
\noindent The \verb`\negmu` reduces the space between the terms from |
| 1434 |
the default \verb`2 mu` to \verb`1 mu`. |
| 1435 |
|
| 1436 |
\subsection{Multi-token variables: parenthesizing} |
| 1437 |
|
| 1438 |
\label{subsec:Multi-tok-vars-parenth}Differentiating a function of |
| 1439 |
a function may involve a multi-character differentiation variable |
| 1440 |
-- e.g. to differentiate $\ln\sin x$ in $x$ means forming the product |
| 1441 |
\begin{example} |
| 1442 |
\verb`\[ \diff{\!\ln\sin x}{\twomu*\sin x}\diff{\!\sin x}x \]` $\Longrightarrow$ |
| 1443 |
\[\diff{\!\ln\sin x}{\twomu*\sin x}\diff{\!\sin x}x.\] |
| 1444 |
\end{example} |
| 1445 |
|
| 1446 |
\noindent (I have inserted preceding negative spaces to counteract |
| 1447 |
the thin space built-in to \verb`\sin`.) Forming the \emph{second} |
| 1448 |
derivative of $\ln\sin x$ will now involve forming, among other quantities, |
| 1449 |
\begin{example} |
| 1450 |
\noindent\verb`\[\diff[2]{\!\ln\sin x}{\sin x}\]` $\Longrightarrow$ |
| 1451 |
\[ \diff[2]{\!\ln\sin x}{\sin x} \] |
| 1452 |
\end{example} |
| 1453 |
|
| 1454 |
\noindent Parentheses have been inserted automatically around $\sin x$ |
| 1455 |
in the denominator to avoid any visual hint that we are differentiating |
| 1456 |
in the sine of $x^{2}$: |
| 1457 |
\[ |
| 1458 |
\diff.dv.{\!\ln\sin x}{\twomu*\sin x:\twomu2} |
| 1459 |
\] |
| 1460 |
\emph{That} is the problem with a long (multi-character) variable: |
| 1461 |
the superscript in a higher order derivative may look as if it applies |
| 1462 |
to only part -- the last character -- of a multi-character variable. |
| 1463 |
Hence the parenthesizing; for first-order derivatives the problem |
| 1464 |
does not arise and so there is no automatic parenthesizing -- you |
| 1465 |
need to do it yourself if you want it. In some cases it seems necessary: |
| 1466 |
\begin{example} |
| 1467 |
\verb`\[\diff {f(x)}{x/k}, \quad \diff {f(x)}{(x/k)}.\]` $\Longrightarrow$ |
| 1468 |
\[ \diff {f(x)}{x/k}, \quad\diff {f(x)}{(x/k)}.\] |
| 1469 |
\end{example} |
| 1470 |
|
| 1471 |
You may prefer \texttt{diffcoeff} not to parenthesize by default in |
| 1472 |
higher order derivatives. Changing the default setting is easily accomplished; |
| 1473 |
see §\ref{sec:ChangingDefaults}. |
| 1474 |
|
| 1475 |
But if you do want parentheses, are they in the right place? Logically, |
| 1476 |
they should include the `d': $(\!\dl{\twomu*\sin x})^{2}$ -- it |
| 1477 |
is the differential $\!\dl{\twomu*\sin x}$ that is of the second |
| 1478 |
order. But as the examples in the Rogues' Gallery show the inclination |
| 1479 |
seems to be to do otherwise. This may be because one wants in any |
| 1480 |
case to parenthesize the variable to show that the `d' symbol attaches |
| 1481 |
to the whole variable and not just its \emph{first} character. A second |
| 1482 |
outer pair of parentheses, |
| 1483 |
\[ |
| 1484 |
\diff.(dv).[2]{f(x)}{(x/k)}, |
| 1485 |
\] |
| 1486 |
like this, then seems too fussy and detracts from comprehending the |
| 1487 |
symbol `at a glance'. Customary but illogical notations are familiar |
| 1488 |
in mathematics -- think of the position of the superscripts in an |
| 1489 |
identity like $\sin^{2}\theta+\cos^{2}\theta=1$. |
| 1490 |
|
| 1491 |
The discussion applies equally to partial derivatives. In thermodynamics |
| 1492 |
and statistical mechanics one may want to differentiate in the reciprocal |
| 1493 |
of the temperature, $1/\Theta$ say: |
| 1494 |
\begin{example} |
| 1495 |
\verb`\[ \diffp[2]q{\frac 1\Theta} \]` $\Longrightarrow$ \[ \diffp[2]q{\frac 1\Theta}.\] |
| 1496 |
\end{example} |
| 1497 |
|
| 1498 |
\noindent As noted, when differentiating to first order, parenthesizing |
| 1499 |
is up to the user: |
| 1500 |
\begin{example} |
| 1501 |
\verb`\[ \diffp q{\bigl(\frac 1\Theta\bigr),V} \]` $\Longrightarrow$ |
| 1502 |
\[ \diffp q{\bigl(\frac 1\Theta\bigr),V}. \] |
| 1503 |
\end{example} |
| 1504 |
|
| 1505 |
\noindent In tensor calculus, indices are sometimes attached to variables |
| 1506 |
as superscripts, leading in the default set-up to constructs like |
| 1507 |
\[ |
| 1508 |
\sum^{3}_{i=1}\diffp V{x^{i}:\onemu2}=\diffp V{x^{1}:\onemu2}+\diffp V{x^{2}:\onemu2}+\diffp V{x^{3}:\onemu2}. |
| 1509 |
\] |
| 1510 |
If you prefer no parentheses (see §\ref{subsec:variantMulti-token-vars-parenth}), |
| 1511 |
although the resulting expression is understandable to the experienced |
| 1512 |
eye, it is not elegant and potentially ambiguous ($i^{2}=-1$ anyone?): |
| 1513 |
\[ |
| 1514 |
\sum^{3}_{i=1}\diffp.dv.V{x^{i}:\onemu2}=\diffp.dv.V{x^{1}:\onemu2}+\diffp.dv.V{x^{2}:\onemu2}+\diffp.dv.V{x^{3}:\onemu2}. |
| 1515 |
\] |
| 1516 |
|
| 1517 |
|
| 1518 |
\chapter{Templates, defaults \& variants} |
| 1519 |
|
| 1520 |
\label{chap:Templates-defaults-variants} \texttt{diffcoeff} was built |
| 1521 |
on the facilities offered by the \verb`xtemplate` package (included |
| 1522 |
in the \LaTeX 3 bundle {\ttfamily\verb`l3packages`}). These |
| 1523 |
capabilities have now been absorbed into the \LaTeX{} base (see \texttt{lttemplates-doc.pdf}). |
| 1524 |
For \texttt{diffcoeff} a template is a list of parameter values determining |
| 1525 |
what a derivative looks like in the pdf. The parameters may be broad-brush |
| 1526 |
settings like whether the derivative is built from \verb`\frac` or |
| 1527 |
the slash \verb`/` or in compact form, or whether the operator symbol |
| 1528 |
is \verb`d` or \verb`\partial` (or \verb`\nabla` or \verb`\delta` |
| 1529 |
or \ldots ), or the parameters may be finer-grained, determining minutiae |
| 1530 |
of spacing, easily missed at a casual glance but giving some cumulative |
| 1531 |
overall effect.\emph{ }Access to the parameters is gained through |
| 1532 |
the command \verb`\difdef`\footnote{In version 5; it has \emph{three} arguments and replaces the two-argument |
| 1533 |
command \texttt{\textbackslash diffdef} in version 4 of \texttt{diffcoeff}.}, one argument of which is a \emph{key=value} list\emph{ }of parameter |
| 1534 |
values. Each such list is given a name (the second argument of \verb`\difdef`) |
| 1535 |
and is `turned into a derivative' by placing the name between dots |
| 1536 |
as the first argument of the appropriate \verb`\difx`, \verb`\difxp` |
| 1537 |
command\footnote{And -- see Chapter~\ref{chap:Differentials-and-jacobians} -- of |
| 1538 |
the differential and jacobian commands, \texttt{\textbackslash dl} |
| 1539 |
and \texttt{\textbackslash jacob}.}. All this is discussed in §\ref{sec:Variant-forms} below. |
| 1540 |
|
| 1541 |
\section{Template structure} |
| 1542 |
|
| 1543 |
To write a derivative one doesn't want to have to type a long list |
| 1544 |
of \emph{key=value} statements each time. The \emph{default} values |
| 1545 |
given to keys is crucial. Only some of the defaults appropriate for, |
| 1546 |
say, an upright fraction ordinary derivative are going to be relevant |
| 1547 |
for a slash-fraction partial derivative let alone a compact form partial |
| 1548 |
derivative. This suggests creating a primary template as a `super-repository' |
| 1549 |
of default values and from this creating secondary or child templates |
| 1550 |
in which (only) \emph{some }of the defaults are changed -- and, if |
| 1551 |
necessary, creating from these child templates children of their own |
| 1552 |
(grandchild templates) in which again some further defaults are adjusted. |
| 1553 |
|
| 1554 |
In \texttt{diffcoeff}, the template that is the `primogenitor' of |
| 1555 |
the lines of default inheritance is named \verb`DIF`. It is the repository |
| 1556 |
of all possible keys used in all possible forms of derivative in \texttt{diffcoeff} |
| 1557 |
and so has keys appropriate to upright-fraction, slash-fraction and |
| 1558 |
compact forms of derivative; it has keys appropriate to multi-variable |
| 1559 |
partial derivatives and single-variable ordinary derivatives, but |
| 1560 |
it is not actually used to form derivatives. That is the role of its |
| 1561 |
child templates \verb`DIFF`, \verb`DIFS` and \verb`DIFC` corresponding |
| 1562 |
to derivatives of upright-fraction, slash-fraction and compact forms. |
| 1563 |
These child templates inherit the defaults of \verb`DIF` save for |
| 1564 |
some settings explicitly changed in the child template relevant to |
| 1565 |
the specific forms of each. |
| 1566 |
|
| 1567 |
Apart from the operator symbol, most of the settings in the child |
| 1568 |
templates \verb`DIFF`, \verb`DIFS` and \verb`DIFC` are also appropriate |
| 1569 |
for partial derivatives. From a code design point of view, there is |
| 1570 |
a certain neatness at not multiplying the number of templates in |
| 1571 |
play, but actual use -- for instance, forming the `Rogues' gallery' |
| 1572 |
of §\ref{sec:Rogues'-gallery} -- suggests the further step of creating |
| 1573 |
additional templates specifically for \emph{partial} derivatives\emph{ |
| 1574 |
}in the three fraction forms. Apart from the operator symbol, the |
| 1575 |
templates \verb`DIFFP`, \verb`DIFSP` and \verb`DIFCP` inherit nearly |
| 1576 |
all the defaults of their parents \verb`DIFF`, \verb`DIFS` and \verb`DIFC` |
| 1577 |
respectively. |
| 1578 |
|
| 1579 |
Again, actual use suggests two further templates, both direct children |
| 1580 |
of \verb`DIF`, for the creation of jacobians, template \verb`DIFJ`, |
| 1581 |
and differentials, template \verb`DIFL`, with default values appropriate |
| 1582 |
to each. In all \texttt{diffcoeff} uses nine templates, the arrows |
| 1583 |
in Table~\ref{tab:DIF-defaults} indicating lines of inheritance |
| 1584 |
of default values. Only the child and grandchild templates of \verb`DIF` |
| 1585 |
are used for actual construction of derivatives (and jacobians and |
| 1586 |
differentials). \verb`DIF` itself `sits above the fray'. |
| 1587 |
|
| 1588 |
\begin{table} |
| 1589 |
\centering{}\caption{\label{tab:Template-inheritance}Template inheritance} |
| 1590 |
\begin{tabular}{ccccc} |
| 1591 |
\multicolumn{5}{c}{\texttt{DIF}}\tabularnewline |
| 1592 |
$\hphantom{\mathtt{DIF}}$ $\swarrow$ & $\,\,\,\sswarrow$ & $\downarrow$ & $\ssearrow\,\,\,$ & $\searrow$ $\hphantom{\mathtt{IFL}}$\tabularnewline |
| 1593 |
\texttt{DIFC} & \texttt{DIFS} & \texttt{DIFF} & \texttt{DIFJ} & \texttt{DIFL}\tabularnewline |
| 1594 |
$\downarrow$ & $\downarrow$ & $\downarrow$ & & \tabularnewline |
| 1595 |
\texttt{DIFCP} & \texttt{DIFSP} & \texttt{DIFFP} & & \tabularnewline |
| 1596 |
\end{tabular} |
| 1597 |
\end{table} |
| 1598 |
|
| 1599 |
|
| 1600 |
\section{Default values for template \texttt{DIF}} |
| 1601 |
|
| 1602 |
\label{sec:Default-values-DIF}Table~\ref{tab:DIF-defaults} lists |
| 1603 |
the keys available for forming derivatives and the default values |
| 1604 |
assigned in the `grandparent' template, the primogenitor \verb`DIF`. |
| 1605 |
What values are appropriate will change with the math font used and |
| 1606 |
the font size. The values shown have been chosen for |
| 1607 |
\begin{itemize} |
| 1608 |
\item $10$pt, Computer Modern or Latin Modern fonts. |
| 1609 |
\end{itemize} |
| 1610 |
Other math fonts and sizes will require different defaults. Also, |
| 1611 |
different forms of derivative demand different defaults for some keys. |
| 1612 |
Where a key is relevant for more than one style of derivative the |
| 1613 |
default value is chosen according to the following precedence scheme: |
| 1614 |
\begin{enumerate} |
| 1615 |
\item \emph{ordinary upright}-fraction derivatives in \emph{display}-style |
| 1616 |
environments |
| 1617 |
\item \emph{ordinary slash}-fraction derivatives in \emph{text}-style environments |
| 1618 |
\item \emph{ordinary compact}-form derivatives in \emph{text}-style environments |
| 1619 |
\end{enumerate} |
| 1620 |
\noindent{}% |
| 1621 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 1622 |
\begin{shaded}% |
| 1623 |
\noindent Users of version 4 of \texttt{diffcoeff} will notice similarities |
| 1624 |
with and differences from that earlier version. Some key names remain |
| 1625 |
(\verb`op-symbol`), some names have changed (\verb`multi-term-sep` |
| 1626 |
for \verb`denom-term-sep`), keys beginning with an asterisk, \verb`*`, |
| 1627 |
meaning they apply only when the derivand is appended, lack a following |
| 1628 |
hyphen (\verb`*derivand-sep` rather than \verb`*-derivand-sep`), |
| 1629 |
some keys have vanished (the \verb`/` keys), and there are some new |
| 1630 |
keys (\verb`lvwrap-Ldelim`, \verb`lvwrap-Rdelim`). The redesign |
| 1631 |
of the user interface -- \verb`\difs`, \verb`\difsp` for the \verb`/` |
| 1632 |
switch, the new compact form commands \verb`\difc`, \verb`\difcp`, |
| 1633 |
and bringing the jacobian and differential within the \verb`DIF` |
| 1634 |
template structure -- meant revisiting and rethinking the list of |
| 1635 |
keys. In the end it seemed simpler (less confusing) to treat this |
| 1636 |
as a completely new list rather than an amendment of the earlier one.\end{shaded}% |
| 1637 |
\end{minipage} |
| 1638 |
|
| 1639 |
\medskip{} |
| 1640 |
The first column in table~\ref{tab:DIF-defaults} lists key names, |
| 1641 |
the second column lists default values, and the third column lists |
| 1642 |
the form or forms of derivative for which the key is \emph{relevant |
| 1643 |
--} meaning that assigning a different value to the key can change |
| 1644 |
the appearance of the corresponding derivative in some way. The identifiers |
| 1645 |
have these meanings: |
| 1646 |
\begin{description} |
| 1647 |
\item [{f,~fp}] upright fraction ordinary derivative, partial derivative; |
| 1648 |
\item [{s,~sp}] slash fraction ordinary derivative, partial derivative; |
| 1649 |
\item [{c,~cp}] compact ordinary derivative, partial derivative; |
| 1650 |
\item [{j}] jacobian; |
| 1651 |
\item [{l}] differential. |
| 1652 |
\end{description} |
| 1653 |
In Table~\ref{tab:DIF-defaults} and following tables, all values |
| 1654 |
specifying a space require the unit (\verb`mu`) to be included; a |
| 1655 |
number alone does not suffice. (A `mu' is a `math unit', 1/18 |
| 1656 |
of a quad. A thin space \texttt{\textbackslash ,} is 3 mu.) `Elastic' |
| 1657 |
spaces with stretch and shrink can be written compactly like \verb`3muplus1muminus2mu` |
| 1658 |
or with spaces like \verb`3 mu plus 1 mu minus 2 mu`. |
| 1659 |
|
| 1660 |
Available keys and their defaults are listed in Table~\ref{tab:DIF-defaults}. |
| 1661 |
If you are dissatisfied with various choices they can be changed; |
| 1662 |
see the discussion at §\ref{sec:ChangingDefaults}. |
| 1663 |
|
| 1664 |
\pagebreak{} |
| 1665 |
|
| 1666 |
\begin{table} |
| 1667 |
\centering{}\caption{{\small\texttt{DIF}} {\small defaults}\label{tab:DIF-defaults}} |
| 1668 |
\begin{center} |
| 1669 |
\begin{tabular}{lrl} |
| 1670 |
\toprule |
| 1671 |
{\small key} & {\small default} & {\small relevance}\tabularnewline |
| 1672 |
\midrule |
| 1673 |
{\small style} & {\small\texttt{frac}} & {\small f, fp, s, sp, c, cp, j}\tabularnewline |
| 1674 |
{\small slash-tok} & {\small\texttt{/}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}} |
| 1675 |
j}\tabularnewline |
| 1676 |
{\small slash-sep} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}} |
| 1677 |
j}\tabularnewline |
| 1678 |
{\small sfrac-scaling} & {\small\texttt{0.7}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}} |
| 1679 |
j}\tabularnewline |
| 1680 |
{\small derivand-sep} & {\small\texttt{3 mu plus 1 mu minus 2 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline |
| 1681 |
{\small op-symbol} & {\small\texttt{\textbackslash mathrm\{d\}}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline |
| 1682 |
{\small op-symbol-alt} & {\small\texttt{op-symbol}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j}\tabularnewline |
| 1683 |
{\small op-order-nudge} & {\small\texttt{0 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l }\tabularnewline |
| 1684 |
{\small op-sub-nudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp, s, sp,}} c, cp}\tabularnewline |
| 1685 |
{\small var-sup-nudge} & {\small\texttt{1 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline |
| 1686 |
{\small multi-term-sep} & {\small\texttt{2 mu plus 1 mu minus 1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline |
| 1687 |
{\small term-sep-adjust} & {\small\texttt{-1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline |
| 1688 |
{\small dots} & {\small\texttt{\textbackslash cdots}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline |
| 1689 |
{\small long-var-wrap} & {\small\texttt{d(v)}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline |
| 1690 |
{\small lvwrap-Ldelim} & {\small\texttt{\textbackslash mleft (}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline |
| 1691 |
{\small lvwrap-Rdelim} & {\small\texttt{\textbackslash mright )}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline |
| 1692 |
{\small lvwrap-sup-nudge} & {\small\texttt{-2 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp, j,}} l}\tabularnewline |
| 1693 |
{\small outer-Ldelim} & {\small\texttt{\textbackslash left (}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline |
| 1694 |
{\small outer-Rdelim} & {\small\texttt{\textbackslash right )}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline |
| 1695 |
{\small elbowroom} & {\small\texttt{0 mu}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline |
| 1696 |
{\small sub-nudge} & {\small\texttt{-5 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline |
| 1697 |
{\small difcc-var-ord} & {\small\texttt{\textasciicircum\{\#1\}}} & \hphantom{{\small f, fp, s, sp, }}{\small c, cp}\tabularnewline |
| 1698 |
{\small{*}derivand-sep} & {\small\texttt{derivand-sep}} & {\small f, fp, s, sp, c, cp}\tabularnewline |
| 1699 |
{\small{*}op-set-left} & {\small\texttt{false}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline |
| 1700 |
{\small{*}italic-nudge} & {\small\texttt{0 mu}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline |
| 1701 |
{\small{*}slash-sep} & {\small\texttt{slash-sep}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1702 |
{\small{*}inner-wrap} & {\small\texttt{false}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1703 |
{\small{*}inner-Ldelim} & {\small\texttt{(}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1704 |
{\small{*}inner-Rdelim} & {\small\texttt{)}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1705 |
{\small{*}outer-Ldelim} & {\small\texttt{\textbackslash big {[}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1706 |
{\small{*}outer-Rdelim} & {\small\texttt{\textbackslash big {]}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1707 |
{\small{*}sub-nudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline |
| 1708 |
\bottomrule |
| 1709 |
\end{tabular} |
| 1710 |
\par\end{center} |
| 1711 |
\end{table} |
| 1712 |
|
| 1713 |
\begin{description} |
| 1714 |
\item [{style}] the fraction form of the derivative; |
| 1715 |
\begin{itemize} |
| 1716 |
\item for upright-fraction derivatives, \verb`\diff`, \verb`\diffp`, a |
| 1717 |
choice of \verb`frac`, \verb`tfrac` or \verb`dfrac`: |
| 1718 |
\begin{itemize} |
| 1719 |
\item \verb`frac` results in a fraction formed from \verb`\frac`, scalable |
| 1720 |
\item \verb`tfrac` results in a fraction formed from \verb`\tfrac`, not |
| 1721 |
scalable |
| 1722 |
\item \verb`dfrac` results in a fraction formed from \verb`\dfrac`, not |
| 1723 |
scalable |
| 1724 |
\item default in templates \verb`DIFF`, \verb`DIFFP` = \verb`frac` |
| 1725 |
\end{itemize} |
| 1726 |
\item for slash-fraction derivatives,\verb`\difs`, \verb`\difsp`, a choice |
| 1727 |
of \verb`/`, \verb`sfrac`, \verb`auto`, \verb`big`, \verb`Big`, |
| 1728 |
\verb`bigg` or \verb`Bigg` |
| 1729 |
\begin{itemize} |
| 1730 |
\item \verb`/` forms the slash fraction with \verb`/`, not scalable |
| 1731 |
\item \verb`sfrac` forms a split-level inline fraction like $\difs.s.yx$; |
| 1732 |
scalable |
| 1733 |
\item \verb`auto` forms the slash fraction with \verb`\left. \middle/ \right.`, |
| 1734 |
scalable |
| 1735 |
\item \verb`big`, \verb`Big`, \verb`bigg` and \verb`Bigg` form the slash |
| 1736 |
fraction with \verb`\big/`, \verb`\Big/`, \verb`\bigg/` and \verb`\Bigg/` |
| 1737 |
respectively, not scalable |
| 1738 |
\item default in templates \verb`DIFS`, \verb`DIFSP` = \verb`/` |
| 1739 |
\end{itemize} |
| 1740 |
\item for compact-form derivatives, \verb`\difc`, \verb`\difcp`, and |
| 1741 |
differentials, a choice of \verb`_`, \verb`cc`, \verb`dl` or \verb`d^` |
| 1742 |
\begin{itemize} |
| 1743 |
\item \verb`_` or \verb`d^` form derivatives of compact form like $\difc yx$, |
| 1744 |
$\difcp[1,2]{z}{x,y}$ |
| 1745 |
\item \verb`dl` with no differentiand, forms differentials like $\difc.dl.{}x$ |
| 1746 |
and $\difcp.dl.[2]{}{x,y,z}$ |
| 1747 |
\item \verb`cc` forms derivatives in `doubly compact' form like $\difccp y{x:2,y,z:3}$ |
| 1748 |
\item default in templates \verb`DIFC`, \verb`DIFCP` = \verb`_` |
| 1749 |
\end{itemize} |
| 1750 |
\item overall default in template \verb`DIF` = \verb`frac` |
| 1751 |
\end{itemize} |
| 1752 |
\item [{slash-tok}] token or tokens used for the slash fraction; (see §\ref{subsec:Other-notations} |
| 1753 |
for an assignment different from \verb`/`); default = \verb`/` |
| 1754 |
\item [{slash-sep}] space inserted on either side of the \textbf{slash-tok}; |
| 1755 |
if two values are given (in a comma list), the first is inserted to |
| 1756 |
the left of \textbf{slash-tok}, the second to the right; if only one |
| 1757 |
value is provided, it is inserted on both sides of \textbf{slash-tok}; |
| 1758 |
default = \verb`0 mu` |
| 1759 |
\item [{sfrac-scaling}] used only for the \verb`sfrac` variant of a slash-form |
| 1760 |
derivative to enable scaling. For $10$pt text-style characters, $0.7\times10=7$pt |
| 1761 |
for script-style characters, and $0.7\times7=0.49\approx5$pt for |
| 1762 |
scriptscript-style characters; default = 0.7 |
| 1763 |
\item [{derivand-sep}] horizontal space added before the differentiand |
| 1764 |
if the \verb`spaced` package option is set to \verb`1`, or before |
| 1765 |
a multi-tokened differentiand if the \verb`spaced` package option |
| 1766 |
is set to \verb`-1`; note that compact-form derivatives \emph{always |
| 1767 |
}have this space inserted; default (appropriate for an upright-fraction |
| 1768 |
derivative) = \verb`3mu plus 1mu minus 2mu` |
| 1769 |
\item [{op-symbol}] the operator symbol; for ordinary derivatives generally |
| 1770 |
one of \verb`d` or \verb`\mathrm{d}`, for partial derivatives \verb`\partial`; |
| 1771 |
default = \verb`\mathrm{d}` |
| 1772 |
\item [{op-symbol-alt}] if different from \textbf{op-symbol} then used |
| 1773 |
in the denominator of a fraction-form derivative while \verb`op-symbol` |
| 1774 |
is used in the numerator; e.g. for acceleration $\diff.n.{v^{i}}t$, |
| 1775 |
\verb`op-symbol = \nabla`, \verb`op-symbol-alt = \mathrm{d}`; default |
| 1776 |
= \textbf{op-symbol} |
| 1777 |
\item [{op-order-nudge}] extra horizontal space added between the operator |
| 1778 |
symbol and the superscripted order of differentiation in higher order |
| 1779 |
derivatives; for math-italic forms compare $d^{2}$ (no extra space) |
| 1780 |
with $d^{\mkern1mu 2}$ (\verb`1 mu` of extra space) ; since \textbf{op-symbol |
| 1781 |
}defaults to an upright `d', default = \verb`0 mu` |
| 1782 |
\item [{op-sub-nudge}] horizontal adjustment of the position of the subscript |
| 1783 |
in derivatives of compact form relative to the operator; e.g. if \verb`\nabla` |
| 1784 |
is the operator you might prefer \difdef{c,cp}x{op-symbol=\nabla,op-sub-nudge=-4 mu}$\difcp.x.yx$ |
| 1785 |
(\verb`-4 mu`) to \difdef{c,cp}x{op-symbol=\nabla,op-sub-nudge=0 mu}$\difcp.x.yx$ |
| 1786 |
(\verb`0 mu`); since \verb`\mathrm{d}` is the default operator, |
| 1787 |
default = \verb`0 mu` |
| 1788 |
\item [{var-sup-nudge}] extra horizontal space added between a variable |
| 1789 |
in the denominator of a derivative and the superscripted order of |
| 1790 |
differentiation in higher order derivatives; compare $\dl{T:\negmu2}$ |
| 1791 |
(\verb`0 mu`) with$\dl{T:2}$ (\verb`1 mu`); default = \verb`1 mu` |
| 1792 |
\item [{multi-term-sep}] horizontal spacing inserted between the differentials |
| 1793 |
in, for example, the denominator of a mixed partial derivative to |
| 1794 |
avoid a solid cluster like $\partial x\partial y\partial z$; with |
| 1795 |
the default \verb`2 mu` this is spread a little, $\difcp.dl.{}{x,y,z}$; |
| 1796 |
default = \verb`2 mu plus 1 mu minus 1 mu` |
| 1797 |
\item [{term-sep-adjust}] adjustment (usually a reduction) to \textbf{multi-term-sep} |
| 1798 |
when differentiation in a variable occurs to an order other than 1; |
| 1799 |
e.g. the spacing between $\partial x^{2}$ and $\partial y$ in $\difsp[2]{F}{x,y,z}$ |
| 1800 |
is reduced by\textbf{ term-sep-adjust}, because of the superscript, |
| 1801 |
from the spacing between $\partial y$ and $\partial z$; default |
| 1802 |
= {\ttfamily\verb`-1 mu`} |
| 1803 |
\item [{dots}] dot command (e.g. \verb`\ldots`, \verb`\cdots`, \ldots ) |
| 1804 |
to use in a generic mixed partial derivative ($\difsp<n>F{x_{1},...,x_{n}}$). |
| 1805 |
Because an upright fraction is the default form of derivative, default |
| 1806 |
= \verb`\cdots` |
| 1807 |
\item [{long-var-wrap}] it may aid clarity and avoid ambiguity in higher |
| 1808 |
order derivatives to wrap multi-token variables of differentiation |
| 1809 |
in parentheses; the choices are |
| 1810 |
\begin{description} |
| 1811 |
\item [{\texttt{dv\phantom{()}}}] no wrapping, e.g. $\mathrm{d}x^{\,2}_{i}$ |
| 1812 |
or $\partial\frac{1}{\Theta}^{2}$, |
| 1813 |
\item [{\texttt{d(v)}}] wrap the variable only, e.g. $\mathrm{d}(x_{i})^{2}$ |
| 1814 |
or $\partial(\frac{1}{\Theta})^{2}$, |
| 1815 |
\item [{\texttt{(dv)}}] wrap both op-symbol and variable, e.g. $(\mathrm{d}x_{i})^{2}$ |
| 1816 |
or $(\partial\frac{1}{\Theta})^{2}$; |
| 1817 |
\item [{\texttt{\phantom{(dv)}}}] default = \verb`d(v)` |
| 1818 |
\end{description} |
| 1819 |
\item [{lvwrap-Ldelim}] left delimiter when wrapping a long variable, in |
| 1820 |
a higher order derivative; also applies to the left delimiter used |
| 1821 |
in a jacobian; default = \verb`\mleft (` |
| 1822 |
\item [{lvwrap-Rdelim}] right delimiter when wrapping a long variable, |
| 1823 |
in a higher order derivative; also applies to the right delimiter |
| 1824 |
used in a jacobian; default = \verb`\mright )` |
| 1825 |
\item [{lvwrap-sup-nudge}] horizontal adjustment to the superscript position |
| 1826 |
in the denominator of a higher order derivative when a multi-token |
| 1827 |
variable is wrapped in (e.g.) parentheses; default = \verb`-2 mu` |
| 1828 |
\item [{outer-Ldelim}] the left member of a delimiter pair wrapping the |
| 1829 |
derivative, the right member of which is subscripted to indicate a |
| 1830 |
point of evaluation or variables held constant; ISO recommends parentheses |
| 1831 |
for this purpose, hence default = {\ttfamily\verb`\left (`} |
| 1832 |
\item [{outer-Rdelim}] the right member of a delimiter pair wrapping the |
| 1833 |
derivative and subscripted to indicate a point of evaluation or variables |
| 1834 |
held constant; ISO recommends parentheses for this purpose, hence |
| 1835 |
default = {\ttfamily\verb`\right )`} |
| 1836 |
\item [{elbowroom}] adjustment to the whitespace between the delimiter |
| 1837 |
pair \textbf{outer-Ldelim}, \textbf{outer-Rdelim }and the enclosed |
| 1838 |
derivative; negative values reduce the space; default = {\ttfamily\verb`0 mu`} |
| 1839 |
\item [{sub-nudge}] horizontal adjustment of the subscript's placing relative |
| 1840 |
to the \textbf{outer-Rdelim}iter for a point of evaluation or variable |
| 1841 |
held constant; a negative value compensates for the curving inwards |
| 1842 |
of a large right parenthesis; default = {\ttfamily\verb`-5 mu`} |
| 1843 |
\item [{difcc-var-ord}] how the order of differentiation is indicated in |
| 1844 |
the `doubly compact' form of a compact form derivative (see §\ref{subsec:variantCompact=002013forms}); |
| 1845 |
default = \verb`^{#1}` |
| 1846 |
\item [{{*}derivand-sep}] when the derivand is appended, horizontal space |
| 1847 |
added before the differentiand (derivand) depending on the setting |
| 1848 |
of the \verb`spaced` package option; default = \textbf{derivand-sep} |
| 1849 |
\item [{{*}op-set-left}] a choice of {\ttfamily\verb`true`} |
| 1850 |
or {\ttfamily\verb`false`} indicating whether the op-symbol |
| 1851 |
is left-aligned or not when the differentiand is appended; generally |
| 1852 |
it is centred; applies only to upright-fraction forms of the derivative; |
| 1853 |
default = {\ttfamily\verb`false`} |
| 1854 |
\item [{{*}italic-nudge}] if \textbf{{*}op-set-left} is \verb`true`, makes |
| 1855 |
an italic adjustment in the numerator, so that the op-symbols in numerator |
| 1856 |
and denominator align in the same slanting column; for \verb`d` or |
| 1857 |
\verb`\partial` an appropriate value might be \verb`3 mu`; because |
| 1858 |
of the default \verb`\mathrm{d}`, default = \verb`0 mu` |
| 1859 |
\item [{{*}slash-sep}] when the derivand is appended, space inserted on |
| 1860 |
either side of the \textbf{slash-tok}; if two values are given (in |
| 1861 |
a comma list), the first is inserted to the left of \textbf{slash-tok}, |
| 1862 |
the second to the right; if only one value is provided, it is inserted |
| 1863 |
on both sides of \textbf{slash-tok}; default = \textbf{slash-sep} |
| 1864 |
\item [{{*}inner-wrap}] when the differentiand is appended, a choice of |
| 1865 |
\verb`true` or \verb`false` dictating whether the differential operator |
| 1866 |
is wrapped in parentheses, as here $\difsp*{F(x,y)}x$, or not; for |
| 1867 |
a slash-fraction derivative \verb`true` is an appropriate default, |
| 1868 |
but the overall default, appropriate for an upright-fraction derivative |
| 1869 |
= \verb`false` |
| 1870 |
\item [{{*}inner-Ldelim}] if \textbf{{*}inner-wrap} is \verb`true`, the\textbf{ |
| 1871 |
}left member of a delimiter pair around the differential operator; |
| 1872 |
default = \verb`(` |
| 1873 |
\item [{{*}inner-Rdelim}] if \textbf{{*}inner-wrap} is \verb`true`, the\textbf{ |
| 1874 |
}right member of a delimiter pair around the differential operator |
| 1875 |
; default = \verb`)` |
| 1876 |
\item [{{*}outer-Ldelim}] if \textbf{{*}inner-wrap} is \verb`true`, the |
| 1877 |
left member of a delimiter pair around both the differential operator |
| 1878 |
and appended differentiand, the right member of which may be subscripted |
| 1879 |
to indicate a point of evaluation or variables held constant; to avoid |
| 1880 |
too many parentheses, given the default values of {*}\textbf{inner-Ldelim}, |
| 1881 |
{*}\textbf{inner-Rdelim}, default = \verb`\bigl [` |
| 1882 |
\item [{{*}outer-Rdelim}] if \textbf{{*}inner-wrap} is \verb`true`, the |
| 1883 |
right member of a delimiter pair around the differential operator |
| 1884 |
and appended differentiand; may be subscripted to indicate a point |
| 1885 |
of evaluation or variables held constant; to avoid too many parentheses, |
| 1886 |
given the default values of \textbf{{*}inner-Ldelim}, \textbf{{*}inner-Rdelim}, |
| 1887 |
default = \verb`\bigr ]` |
| 1888 |
\item [{{*}sub-nudge}] if \textbf{{*}inner-wrap} is \verb`true`, horizontal |
| 1889 |
adjustment of the subscript's placing relative to the \textbf{{*}outer-Rdelim}iter |
| 1890 |
for a point of evaluation or variable held constant; a negative value |
| 1891 |
compensates for the curving inwards of a large right parenthesis; |
| 1892 |
since the default \textbf{{*}outer-Rdelim} is a square bracket,\textbf{ |
| 1893 |
}default = \verb`0 mu` |
| 1894 |
\end{description} |
| 1895 |
|
| 1896 |
\subsection{Ordinary upright-fraction derivatives; template \texttt{DIFF}} |
| 1897 |
|
| 1898 |
The defaults assigned in template \verb`DIF` are inherited by template |
| 1899 |
\verb`DIFF` without change. Template \verb`DIFF` is therefore strictly |
| 1900 |
unnecessary but, with templates \verb`DIFS` and \verb`DIFC` in mind, |
| 1901 |
was created for the sake of a consistent naming scheme. |
| 1902 |
|
| 1903 |
The \verb`\diff` command uses the values in the \verb`DIFF` template |
| 1904 |
to form an upright-fraction derivative. Only keys with an `f' in |
| 1905 |
the third column of Table~\ref{tab:DIF-defaults} are used in this |
| 1906 |
process. Keys without an `f' play no part in the process and their |
| 1907 |
default values are ignored. See §\ref{subsec:DIFF-(upright-fraction-derivative)} |
| 1908 |
for the complete list of \emph{relevant} \verb`DIFF` defaults. |
| 1909 |
|
| 1910 |
\begin{table} |
| 1911 |
\caption{Defaults differing from the parent template} |
| 1912 |
|
| 1913 |
\begin{centering} |
| 1914 |
\subfloat[\texttt{DIFS}\label{tab:DIFS-defaults}]{\centering{}% |
| 1915 |
\begin{tabular}{lr} |
| 1916 |
\toprule |
| 1917 |
{\small key} & {\small default}\tabularnewline |
| 1918 |
\midrule |
| 1919 |
{\small style} & {\small\texttt{/}}\tabularnewline |
| 1920 |
{\small derivand-sep} & {\small\texttt{2 mu plus 1 mu minus 2 mu}}\tabularnewline |
| 1921 |
{\small dots} & {\small\texttt{\textbackslash ldots}}\tabularnewline |
| 1922 |
{\small outer-Ldelim} & {\small\texttt{(}}\tabularnewline |
| 1923 |
{\small outer-Rdelim} & {\small\texttt{)}}\tabularnewline |
| 1924 |
{\small sub-nudge} & {\small\texttt{0 mu}}\tabularnewline |
| 1925 |
{\small{*}inner-wrap} & {\small\texttt{true}}\tabularnewline |
| 1926 |
\bottomrule |
| 1927 |
\end{tabular}}\hfil\subfloat[\texttt{DIFC}\label{tab:DIFC-defaults}]{\centering{}% |
| 1928 |
\begin{tabular}{lr} |
| 1929 |
\toprule |
| 1930 |
{\small key} & {\small default}\tabularnewline |
| 1931 |
\midrule |
| 1932 |
{\small style} & {\small\texttt{\_}}\tabularnewline |
| 1933 |
{\small derivand-sep} & {\small\texttt{1 mu plus 1 mu minus 1 mu}}\tabularnewline |
| 1934 |
{\small multi-term-sep} & {\small\texttt{1 mu}}\tabularnewline |
| 1935 |
{\small term-sep-adjust} & {\small\texttt{0 mu}}\tabularnewline |
| 1936 |
{\small outer-Ldelim} & {\small\texttt{\textbackslash bigl (}}\tabularnewline |
| 1937 |
{\small outer-Rdelim} & {\small\texttt{\textbackslash bigr )}}\tabularnewline |
| 1938 |
sub-nudge & {\small\texttt{-2 mu}}\tabularnewline |
| 1939 |
\bottomrule |
| 1940 |
\end{tabular}} |
| 1941 |
\par\end{centering} |
| 1942 |
\centering{}\subfloat[\texttt{DIFFP}\label{tab:DIFFP-defaults}]{\centering{}% |
| 1943 |
\begin{tabular}{lr} |
| 1944 |
\toprule |
| 1945 |
{\small key} & {\small default}\tabularnewline |
| 1946 |
\midrule |
| 1947 |
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline |
| 1948 |
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline |
| 1949 |
{\small{*}italic-nudge} & {\small\texttt{3 mu}}\tabularnewline |
| 1950 |
\bottomrule |
| 1951 |
\end{tabular}}\hfil\subfloat[\texttt{DIFSP\label{tab:DIFSP-defaults}}]{ |
| 1952 |
\centering{}% |
| 1953 |
\begin{tabular}{lr} |
| 1954 |
\toprule |
| 1955 |
{\small key} & {\small default}\tabularnewline |
| 1956 |
\midrule |
| 1957 |
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline |
| 1958 |
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline |
| 1959 |
\bottomrule |
| 1960 |
\end{tabular}} \hfil\subfloat[\texttt{DIFCP}\label{tab:DIFCP-defaults}]{\centering{}% |
| 1961 |
\begin{tabular}{lr} |
| 1962 |
\toprule |
| 1963 |
{\small key} & {\small default}\tabularnewline |
| 1964 |
\midrule |
| 1965 |
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline |
| 1966 |
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline |
| 1967 |
\bottomrule |
| 1968 |
\end{tabular}} |
| 1969 |
\end{table} |
| 1970 |
|
| 1971 |
|
| 1972 |
\subsection{Ordinary slash-fraction derivatives; template \texttt{DIFS}} |
| 1973 |
|
| 1974 |
When you use the command \verb`\difs` to form a slash-fraction derivative |
| 1975 |
it is the keys in template \verb`DIF` with an `s' in the third |
| 1976 |
column of Table~\ref{tab:DIF-defaults} which are used. Table~\ref{tab:DIFS-defaults} |
| 1977 |
records those keys assigned default values \emph{different} from those |
| 1978 |
in \verb`DIF` which are used for this purpose. See §\ref{subsec:DIFS-(slash-fraction-derivative)} |
| 1979 |
for the complete list of \emph{relevant} \verb`DIFS` defaults. |
| 1980 |
|
| 1981 |
\subsection{Ordinary compact-form derivatives; template \texttt{DIFC}} |
| 1982 |
|
| 1983 |
When you use the command \verb`\difc` to form a compact derivative |
| 1984 |
it is the keys in template \verb`DIF` with a `c' in the third column |
| 1985 |
of Table~\ref{tab:DIF-defaults} which are used. Table~\ref{tab:DIFC-defaults} |
| 1986 |
records those keys assigned default values \emph{different} from those |
| 1987 |
in \verb`DIF` which are used for this purpose. See §\ref{subsec:DIFC-(compact-derivative)} |
| 1988 |
for the complete list of \emph{relevant} \verb`DIFC` defaults. |
| 1989 |
|
| 1990 |
\subsection{Partial derivatives; templates \texttt{DIFFP}, \texttt{DIFSP}, \texttt{DIFCP}} |
| 1991 |
|
| 1992 |
The default values given in the tables so far apply to ordinary derivatives. |
| 1993 |
For \emph{partial} derivatives, only a few defaults change. These |
| 1994 |
are listed in Tables~\ref{tab:DIFFP-defaults}, \ref{tab:DIFSP-defaults}, |
| 1995 |
\ref{tab:DIFCP-defaults}. All other keys take the default values |
| 1996 |
of the respective parent templates, \verb`DIFF`, \verb`DIFS` and |
| 1997 |
\verb`DIFC`. |
| 1998 |
|
| 1999 |
\section{Defining variants, changing defaults} |
| 2000 |
|
| 2001 |
\label{sec:Variant-forms}You may well have the need to write an occasional |
| 2002 |
derivative that deviates from the default form -- a \emph{variant} |
| 2003 |
form. That was what I needed to do to write the range of different |
| 2004 |
examples displayed in the Rogues' Gallery (§\ref{sec:Rogues'-gallery}). |
| 2005 |
Alternatively, you may be dissatisfied with the scheme of default |
| 2006 |
values listed in the preceding tables and wish to `Re-mould it nearer |
| 2007 |
to the Heart's Desire'. Both processes -- changing a default, defining |
| 2008 |
and using a variant -- are very similar and make use of a command |
| 2009 |
\verb`\difdef` which has three \emph{mandatory} arguments: |
| 2010 |
\begin{verbatim} |
| 2011 |
\difdef{id-list}{variant-name}{key-value list} |
| 2012 |
\end{verbatim} |
| 2013 |
\begin{enumerate} |
| 2014 |
\item \verb`id-list` A comma-list of identifiers, one or more of \verb`f`, |
| 2015 |
\verb`s`, \verb`c`, \verb`fp`, \verb`sp`, \verb`cp`, \verb`j`, |
| 2016 |
\verb`l` distinguishing the respective templates \verb`DIFF`, \verb`DIFS`, |
| 2017 |
\verb`DIFC`, \verb`DIFFP`, \verb`DIFSP`, \verb`DIFCP`, \verb`DIFJ` |
| 2018 |
and \verb`DIFL` (for the last two see Chapter~\ref{chap:Differentials-and-jacobians}). |
| 2019 |
\item \verb`variant-name` A (preferably brief) name for the variant form; |
| 2020 |
it may include characters other than letters, like numbers, punctuation |
| 2021 |
marks (excluding full stops), mathematical symbols like \verb`+` |
| 2022 |
and \verb`=`, but not control sequences or active characters, nor |
| 2023 |
\verb`\`, \verb`%` , \verb`#` or braces. |
| 2024 |
\begin{enumerate} |
| 2025 |
\item If a name is not provided -- if the \verb`variant-name` braces are |
| 2026 |
left empty -- then the changes signalled in \verb`key-value list`, |
| 2027 |
the third argument, become the new \emph{default values} of the derivatives |
| 2028 |
identified in the first argument, \verb`id-list`. |
| 2029 |
\end{enumerate} |
| 2030 |
\item \verb`key-value list` A \emph{key=value} list of settings differing |
| 2031 |
from the default settings for the relevant template or templates (as |
| 2032 |
determined by the \verb`id-list`). |
| 2033 |
\end{enumerate} |
| 2034 |
The present document comes with a number of variant definitions. These |
| 2035 |
are divided into two groups. One, in the preamble (and reproduced |
| 2036 |
at §\ref{sec:Preamble-definitions}), contains definitions designed |
| 2037 |
to illustrate various effects for this document -- as in the Rogues' |
| 2038 |
Gallery. The other, in the associated file \texttt{diffcoeff5.def,} |
| 2039 |
contains definitions that may be of more general use. (For use of |
| 2040 |
a \verb`.def` file see §\ref{subsec:The-def-file}; \texttt{diffcoeff5.def} |
| 2041 |
is reproduced at §\ref{sec:The-file-diffcoeff5.def}.) |
| 2042 |
|
| 2043 |
\noindent{}% |
| 2044 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 2045 |
\begin{shaded}% |
| 2046 |
The command \verb`\difdef` in version 5 of \texttt{diffcoeff} takes |
| 2047 |
\emph{three} mandatory arguments. Do not confuse with the command |
| 2048 |
\verb`\diffdef` of version 4 and earlier which took \emph{two }mandatory |
| 2049 |
arguments for this purpose. The additional argument is required to |
| 2050 |
identify which one or more of the fraction forms of the commands \verb`\difx`, |
| 2051 |
\verb`\difxp`, the variant applies to. In earlier versions this was |
| 2052 |
not necessary since there was only the one primary derivative command |
| 2053 |
\verb`\diff`.\end{shaded}% |
| 2054 |
\end{minipage} |
| 2055 |
|
| 2056 |
\subsection{Creating and using a variant} |
| 2057 |
|
| 2058 |
To illustrate the process of creating and using a variant consider |
| 2059 |
the definition in the file \texttt{diffcoeff5.def} enabling the writing |
| 2060 |
of the acceleration in tensor calculus. This has \verb`\nabla` in |
| 2061 |
the numerator and \verb`\mathrm{d}` in the denominator: |
| 2062 |
\begin{verbatim} |
| 2063 |
\difdef { f, s } { n } |
| 2064 |
{ |
| 2065 |
op-symbol = \nabla, |
| 2066 |
op-symbol-alt = \mathrm{d}, |
| 2067 |
*slash-sep = { -2mu, 0mu } |
| 2068 |
} |
| 2069 |
\end{verbatim} |
| 2070 |
The second argument shows that this variant has been given the name |
| 2071 |
\verb`n`, obviously from `nabla', and can be used with both upright |
| 2072 |
and slash fraction derivatives -- the \verb`f` and the \verb`s` |
| 2073 |
in the first argument. Using the new variant is as simple as writing |
| 2074 |
\verb`\diff.n.` or \verb`\difs.n.` followed by the usual arguments: |
| 2075 |
\begin{verbatim} |
| 2076 |
\[ \diff.n.{v^{i}}t,\quad \difs.n.{v^{i}}t,\quad |
| 2077 |
\diff.n.*{v^{i}}t,\quad \difs.n.*{v^{i}}t. \] |
| 2078 |
\end{verbatim} |
| 2079 |
$\Longrightarrow$ \[\diff.n.{v^{i}}t,\quad \difs.n.{v^{i}}t,\quad |
| 2080 |
\diff.n.*{v^{i}}t,\quad \difs.n.*{v^{i}}t.\](In the Rogues' Gallery I also included the command \verb`\spacednil` |
| 2081 |
inside the \verb`\[` to cancel the extra space inserted before the |
| 2082 |
differentiand (§\ref{subsec:Spacing-before-derivand}) with the \verb`spaced=-1` |
| 2083 |
package option used for this document.) |
| 2084 |
|
| 2085 |
The fourth of these derivatives makes use of the \verb`*slash-sep` |
| 2086 |
setting which applies only when the differentiand is appended and |
| 2087 |
only to slash-fraction derivatives. Like \verb`slash-sep`, it takes |
| 2088 |
either a single value which is applied to both sides of the slash |
| 2089 |
token or, as here, a comma list (hence between braces) of two values |
| 2090 |
applied respectively to the left and the right side of the slash token. |
| 2091 |
By default it is set to the value of the \verb`slash-sep` setting |
| 2092 |
but for this variant the \verb`-2 mu` avoids the appearance of too |
| 2093 |
much whitespace between the similarly sloping $\nabla$ and $/$ symbols. |
| 2094 |
|
| 2095 |
A second example shows the effect of the key \verb`sub-nudge` which |
| 2096 |
adjusts the positioning of the subscript denoting a point of evaluation. |
| 2097 |
The preamble contains the definition, |
| 2098 |
\begin{verbatim} |
| 2099 |
\difdef { f, fp } { wsp } { sub-nudge = 0 mu } |
| 2100 |
\end{verbatim} |
| 2101 |
the name \verb`wsp` derived from `whitespace'. The definition applies |
| 2102 |
only to upright fraction forms of derivative (the \verb`f, fp` in |
| 2103 |
the first argument). The default value of \verb`sub-nudge` is \verb`-5 mu` |
| 2104 |
which has the effect of moving the point-of-evaluation subscript in |
| 2105 |
towards the in-curling right parenthesis. By giving \verb`sub-nudge` |
| 2106 |
a zero value, the subscript is cast adrift in a sea of whitespace. |
| 2107 |
Compare the two settings, using \verb`\diffp` and \verb`\diffp.wsp.` |
| 2108 |
side-by-side: |
| 2109 |
\begin{verbatim} |
| 2110 |
\[ \diffp Fx[0],\quad \diffp.wsp.Fx[0]. \] |
| 2111 |
\end{verbatim} |
| 2112 |
$\Longrightarrow$ \[ \diffp Fx[0],\quad \diffp.wsp.Fx[0]. \] |
| 2113 |
|
| 2114 |
\subsection{Changing a default} |
| 2115 |
|
| 2116 |
\label{sec:ChangingDefaults}The process of changing a default is |
| 2117 |
even simpler than creating a variant: the second argument of the \verb`\difdef` |
| 2118 |
command is left empty and no dot-delimited name is required for the |
| 2119 |
\verb`\difx`, \verb`\difxp` commands. |
| 2120 |
|
| 2121 |
By default, \texttt{diffcoeff} parenthesizes multi-token variables |
| 2122 |
in the denominators of higher order derivatives -- this sort of thing |
| 2123 |
\[ |
| 2124 |
\diff[2]{\!\ln\sin x}{\sin x} |
| 2125 |
\] |
| 2126 |
in order to avoid this sort of thing\[ \diff.dv.{\!\ln\sin x}{\sin x:2}, \]where |
| 2127 |
the superscript in the denominator looks as if it is attached to $x$ |
| 2128 |
rather than $\sin x$ (or $\mathrm{d}\sin x$). Nonetheless you may |
| 2129 |
still prefer to have \emph{no} parentheses inserted, the superscript |
| 2130 |
in the numerator resolving any ambiguity in the denominator. To make |
| 2131 |
this the default behaviour, all you need is the following definition |
| 2132 |
\begin{verbatim} |
| 2133 |
\difdef { f, fp, s, sp } {} { long-var-wrap = dv } |
| 2134 |
\end{verbatim} |
| 2135 |
placed either in the preamble of your document or your \verb`.def` |
| 2136 |
file (see below). Then when you next form a derivative like \verb`\diff[2]{\!\ln\sin x}{\sin x}` |
| 2137 |
involving a multi-token variable in a higher-order derivative, no |
| 2138 |
parenthesizing will occur; see §\ref{subsec:variantMulti-token-vars-parenth} |
| 2139 |
for more on this. |
| 2140 |
|
| 2141 |
The procedure is general if you wish to change a default: use \verb`\difdef` |
| 2142 |
with an \emph{empty} second argument. |
| 2143 |
|
| 2144 |
\subsection{The \texttt{.def} file} |
| 2145 |
|
| 2146 |
\label{subsec:The-def-file}The problem with the procedures just discussed |
| 2147 |
is that if you want the new definitions of variants or defaults to |
| 2148 |
also apply in other documents, you are faced with either entering |
| 2149 |
them anew or copying and pasting from one preamble to another. |
| 2150 |
|
| 2151 |
It is much easier to use a \verb`.def` file. This is a text file |
| 2152 |
containing a list of definitions of variant derivatives or new defaults |
| 2153 |
after the fashion of the examples above. The reason for placing such |
| 2154 |
variant definitions in a file is that they can be easily transferred |
| 2155 |
from document to document by means of the \verb`def-file` package |
| 2156 |
option. If the name of your \verb`.def` file is \verb`myfile`, then |
| 2157 |
invoking \texttt{diffcoeff} with the call |
| 2158 |
\begin{verbatim} |
| 2159 |
\usepackage[def-file=myfile]{diffcoeff} |
| 2160 |
\end{verbatim} |
| 2161 |
makes the definitions in \verb`myfile.def` available to your current |
| 2162 |
document -- provided \texttt{diffcoeff} can find \verb`myfile.def`. |
| 2163 |
|
| 2164 |
One obvious way is to include the full path in the name. If you are |
| 2165 |
using a windows operating system then the path separator is the backslash |
| 2166 |
\verb`\`, e.g. \verb`E:\MyDocuments\...`. To avoid `Undefined control |
| 2167 |
sequence' errors when compiling, these backslashes must be changed |
| 2168 |
to forward slashes, as on linux systems: \verb`E:/MyDocuments/...`. |
| 2169 |
Including the full path in the filename means the file can be placed |
| 2170 |
anywhere you like. |
| 2171 |
|
| 2172 |
If you don't use the full path in the filename, then the question |
| 2173 |
is where to put the file so that \texttt{diffcoeff} can find it? The |
| 2174 |
directory of the current document is an obvious candidate and for |
| 2175 |
the current document serves well, but it does mean copying the \verb`.def` |
| 2176 |
file from directory to directory to work on \emph{different} documents. |
| 2177 |
To make a definition file available for \emph{all} documents, place |
| 2178 |
it in the \verb`texmf` tree, preferably not the one created by your |
| 2179 |
\TeX{} distribution, but your own \emph{personal} \verb`texmf` tree. |
| 2180 |
Provided your \TeX{} distribution knows about your personal \verb`texmf` |
| 2181 |
tree and the files it contains -- which may mean explicitly refreshing |
| 2182 |
the filename database of your \TeX{} distribution -- then a \verb`.def` |
| 2183 |
file placed within it will be accessible to all documents. |
| 2184 |
\begin{center} |
| 2185 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 2186 |
\begin{shaded}% |
| 2187 |
|
| 2188 |
\subsubsection*{Personal \texttt{texmf} tree?} |
| 2189 |
|
| 2190 |
This is a directory created by you for `waifs and strays' of the \TeX{} |
| 2191 |
system that are not included in standard distributions like MiK\TeX{} |
| 2192 |
or \TeX Live. For instance, it is the place for personal packages |
| 2193 |
designed for your own particular circumstances or preferences, and |
| 2194 |
is structured like the standard \texttt{texmf} hierarchy but placed |
| 2195 |
in another location so that there is no chance of its being overwritten |
| 2196 |
when your \TeX{} distribution is updated. But that distribution needs |
| 2197 |
to be alerted to the existence of your personal \texttt{texmf} tree |
| 2198 |
and any new files added to it. \TeX{} distributions should have information |
| 2199 |
accessible on how to add your personal \verb`texmf` tree to its search |
| 2200 |
path and how to refresh its filename database when you add a file |
| 2201 |
to your \verb`texmf` tree. \end{shaded}% |
| 2202 |
\end{minipage}\medskip{} |
| 2203 |
\par\end{center} |
| 2204 |
|
| 2205 |
Be aware that it is best to place any particular \verb`.def` file |
| 2206 |
in no more than \emph{one} place in the search path -- no copies |
| 2207 |
with the same name in different places. It is too easy to change only |
| 2208 |
one such copy and forget to update the others and then wonder why |
| 2209 |
the change you made is not reflected in your document -- \texttt{diffcoeff} |
| 2210 |
has found a file with the same name, just not the one with the changed |
| 2211 |
definitions. |
| 2212 |
|
| 2213 |
If the\verb`.def` file named in the package option statement cannot |
| 2214 |
be located by \TeX , a message to that effect is sent to the terminal |
| 2215 |
and log file, but \texttt{diffcoeff} continues loading. |
| 2216 |
|
| 2217 |
\noindent{}% |
| 2218 |
\noindent\begin{minipage}[t]{1\columnwidth}% |
| 2219 |
\begin{shaded}% |
| 2220 |
|
| 2221 |
\subsubsection*{\texttt{diffcoeff.def}} |
| 2222 |
|
| 2223 |
In version 4 of \texttt{diffcoeff}, if there was no explicit \verb`def-file=<filename>` |
| 2224 |
package option statement, then a file \texttt{diffcoeff.def} was sought |
| 2225 |
and if found loaded. This is no longer the case. Version 5 of \texttt{diffcoeff} |
| 2226 |
searches for a \verb`.def` \emph{only if it is explicitly named} |
| 2227 |
in a package option statement. (This decision was made at least in |
| 2228 |
part to avoid conflict with a \texttt{diffcoeff.def} file from an |
| 2229 |
earlier version of \texttt{diffcoeff} tucked away in some non-obvious |
| 2230 |
place and producing obscure errors in the current version 5.) \end{shaded}% |
| 2231 |
\end{minipage}\medskip{} |
| 2232 |
|
| 2233 |
The present document uses a \verb`.def` file \texttt{diffcoeff5.def}, |
| 2234 |
reproduced in §\ref{sec:The-file-diffcoeff5.def}. Because the author |
| 2235 |
has a number of files with this name on his computer, the full path |
| 2236 |
to the file was included in the \verb`\usepackage` statement in the |
| 2237 |
preamble. |
| 2238 |
|
| 2239 |
\subsection{Examples of variants} |
| 2240 |
|
| 2241 |
\label{subsec:Examples-of-variants}The dot-delimited name argument |
| 2242 |
must always be the \emph{first} argument of the \verb`\difx` or \verb`\difxp` |
| 2243 |
command, even preceding an asterisk (star) signalling `append the |
| 2244 |
differentiand'. Now for some examples. |
| 2245 |
|
| 2246 |
\subsubsection{Point of evaluation} |
| 2247 |
|
| 2248 |
\label{subsec:variantPt-of-eval}Although ISO recommends subscripting |
| 2249 |
parentheses to indicate a point of evaluation, some (like the author) |
| 2250 |
prefer to use a vertical rule with a subscript and save parentheses |
| 2251 |
for the case of variables held constant in partial derivatives. The |
| 2252 |
file \texttt{diffcoeff5.def} contains the definition |
| 2253 |
\begin{verbatim} |
| 2254 |
\difdef { f, fp, s, sp } { | } |
| 2255 |
{ |
| 2256 |
outer-Ldelim = \left . , |
| 2257 |
outer-Rdelim = \right |, |
| 2258 |
sub-nudge = 0 mu |
| 2259 |
} |
| 2260 |
\end{verbatim} |
| 2261 |
where the `pipe' character is used for the name of the variant: |
| 2262 |
\begin{example} |
| 2263 |
\verb`\[ \diffp.|.{F(x,y)}x[x=1] \]` $\Longrightarrow$ \[ \diffp.|.{F(x,y)}x[x=1] \] |
| 2264 |
\end{example} |
| 2265 |
|
| 2266 |
\noindent By omitting the `pipe' symbol name from the second argument |
| 2267 |
in the \verb`\difdef` command, this variant would become the default |
| 2268 |
(for \verb`\diff`, \verb`\diffp`, \verb`\difs`, \verb`\difsp`) |
| 2269 |
for indicating a point of evaluation. For slash fractions, |
| 2270 |
\begin{example} |
| 2271 |
\verb`$ \difs yx[0],\quad \difs.|.yx[0] $` $\Longrightarrow$ $\difs yx[0],\quad \difs.|.yx[0]$. |
| 2272 |
\end{example} |
| 2273 |
|
| 2274 |
\noindent As a \emph{default}, you might prefer to limit use of the |
| 2275 |
`pipe' to \verb`\diff`, \verb`\diffp` (by omitting the \verb`s, sp` |
| 2276 |
identifiers from the first argument of the \verb`\difdef` command). |
| 2277 |
Parentheses neatly tie the whole expression together. Conversely, |
| 2278 |
it is easy to create expressions that suffer from `parenthesis overload': |
| 2279 |
\begin{example} |
| 2280 |
\verb`$ \difs{F(x)}{(1/x)}[x=1],\quad\difs.|.{F(x)}{(1/x)}[x=1] $` |
| 2281 |
$\Longrightarrow$ $\difs{F(x)}{(1/x)}[x=1],\quad\difs.|.{F(x)}{(1/x)}[x=1]$ |
| 2282 |
\end{example} |
| 2283 |
|
| 2284 |
\noindent The vertical rule is clearer in this case. The solution |
| 2285 |
may be to use \emph{square} brackets. The file \texttt{diffcoeff5.def} |
| 2286 |
contains the definition |
| 2287 |
\begin{verbatim} |
| 2288 |
\difdef { f, fp, s, sp } { ] } |
| 2289 |
{ |
| 2290 |
outer-Ldelim = \left [ , |
| 2291 |
outer-Rdelim = \right ], |
| 2292 |
elbowroom = 1 mu, |
| 2293 |
sub-nudge = 0 mu |
| 2294 |
} |
| 2295 |
\end{verbatim} |
| 2296 |
giving the result |
| 2297 |
\begin{example} |
| 2298 |
\verb`$ \difs.].{F(x)}{(2x)}[x=0] $` $\Longrightarrow$ $ \difs.].{F(x)}{(2x)}[x=0] $, |
| 2299 |
\end{example} |
| 2300 |
|
| 2301 |
\noindent which both avoids `parenthesis overload' and is `tied |
| 2302 |
together' by the square brackets and at least gives a nod in the |
| 2303 |
direction of the ISO standard. If you want more separation between |
| 2304 |
the square brackets and the differential coefficient they enclose, |
| 2305 |
increase the value of the \verb`elbowroom` key -- perhaps to \verb`2 mu`. |
| 2306 |
|
| 2307 |
\subsubsection{Math-italic \textquoteleft d\textquoteright s} |
| 2308 |
|
| 2309 |
\label{subsec:variantMath-italic-ds}If you prefer math-italic `d's |
| 2310 |
rather than the upright ISO recommendation, then the file \texttt{diffcoeff5.def} |
| 2311 |
contains the definition |
| 2312 |
\begin{verbatim} |
| 2313 |
\difdef { f, s, c, l } { d' } |
| 2314 |
{ |
| 2315 |
op-symbol = d , |
| 2316 |
op-order-nudge = 1 mu, |
| 2317 |
*slash-sep = { 0 mu, -1 mu } |
| 2318 |
} |
| 2319 |
\end{verbatim} |
| 2320 |
The list of identifiers includes \verb`l` in the first argument; |
| 2321 |
this refers to the template \verb`DIFL` of the differential -- see |
| 2322 |
§\ref{sec:Differentials}. |
| 2323 |
\begin{verbatim} |
| 2324 |
\[ \diff.d'.yx,\quad \difs.d'.yx,\quad \difc.d'.yx. \] |
| 2325 |
\end{verbatim} |
| 2326 |
$\Longrightarrow$ \[ \diff.d'. yx,\quad \difs.d'.yx,\quad \difc.d'.yx. \]If |
| 2327 |
you want this form of `d' to be the \emph{default} leave the second |
| 2328 |
argument of the \verb`\difdef` command empty. |
| 2329 |
|
| 2330 |
\subsubsection{Generic slash fraction with \texttt{\textbackslash cdots}} |
| 2331 |
|
| 2332 |
\label{subsec:variantGeneric-cdot-/}In §\ref{par:Generic-derivatives} |
| 2333 |
it was remarked that it was not clear whether to use \verb`\ldots` |
| 2334 |
or \verb`\cdots` as default in a generic \emph{slash-fraction} form |
| 2335 |
of mixed partial derivative. In fact \verb`\ldots` has been chosen |
| 2336 |
as the \texttt{diffcoeff} default, $\difsp<n>F{x_{1},...,x_{n}}$, |
| 2337 |
but it is easy to provide a variant that uses \verb`\cdots`: |
| 2338 |
\begin{verbatim} |
| 2339 |
\difdef { sp } { cd } { dots = \cdots } |
| 2340 |
\end{verbatim} |
| 2341 |
Indeed, just this definition can be found in the file \texttt{diffcoeff5.def} |
| 2342 |
so let's try it: |
| 2343 |
\begin{example} |
| 2344 |
\verb`$ \difsp.cd.<n>F{x_{1},...,x_{n}} $` $\Longrightarrow$ $ \difsp.cd.<n>F{x_{1},...,x_{n}} $. |
| 2345 |
\end{example} |
| 2346 |
|
| 2347 |
|
| 2348 |
\subsubsection{Parenthesizing multi-token variables} |
| 2349 |
|
| 2350 |
\label{subsec:variantMulti-token-vars-parenth}To illustrate the different |
| 2351 |
modes of parenthesizing `long' variables in higher order derivatives, |
| 2352 |
I have put these two definitions in \texttt{diffcoeff5.def}: |
| 2353 |
\begin{verbatim} |
| 2354 |
\difdef { f, fp } { (dv) } |
| 2355 |
{ long-var-wrap = (dv) } |
| 2356 |
|
| 2357 |
\difdef { f, fp }{ dv } |
| 2358 |
{ long-var-wrap = dv } |
| 2359 |
\end{verbatim} |
| 2360 |
The three possibilities for wrapping multitoken variables can now |
| 2361 |
be illustrated: |
| 2362 |
\begin{verbatim} |
| 2363 |
\[ \diffp[2]F{1/T},\quad |
| 2364 |
\diffp.dv.[2]F{1/T},\quad |
| 2365 |
\diffp.(dv).[2]F{1/T} \] |
| 2366 |
\end{verbatim} |
| 2367 |
$\Longrightarrow$ \[ \diffp[2]F{1/T},\quad\diffp.dv.[2]F{1/T},\quad\diffp.(dv).[2]F{1/T} \] |
| 2368 |
|
| 2369 |
\noindent The first is the default setting; it takes a moment to decipher |
| 2370 |
$T^{2}$ in the second and the third is unfamiliar. In other cases |
| 2371 |
it is less clear-cut. |
| 2372 |
|
| 2373 |
\paragraph{Subscripted variables} |
| 2374 |
|
| 2375 |
\label{subsec:variantSubscripted-vars}Consider the following example, |
| 2376 |
where the `out of the box' default means multi-token variables, |
| 2377 |
and hence the subscripted variables in the example, are parenthesized: |
| 2378 |
\begin{verbatim} |
| 2379 |
\[ \sum_{i=0}^3 \diffp[2]V{x_i}=\diffp[2]V{x_1} |
| 2380 |
+\diffp[2]V{x_2}+\diffp[2]V{x_3}. \] |
| 2381 |
\end{verbatim} |
| 2382 |
$\Longrightarrow$ \[ \sum_{i=0}^3\diffp[2]V{x_i}=\diffp[2]V{x_1}+\diffp[2]V{x_2}+\diffp[2]V{x_3}. \] |
| 2383 |
|
| 2384 |
\noindent You may well prefer no parenthesizing here -- the \verb`dv` |
| 2385 |
variant: |
| 2386 |
\begin{verbatim} |
| 2387 |
\[ \sum_{i=0}^3 \diffp.dv.[2]V{x_i}=\diffp.dv.[2]V{x_1} |
| 2388 |
+\diffp.dv.[2]V{x_2}+\diffp.dv.[2]V{x_3}. \] |
| 2389 |
\end{verbatim} |
| 2390 |
$\Longrightarrow$ \[ \sum_{i=0}^3\diffp.dv.[2]V{x_i}=\diffp.dv.[2]V{x_1} |
| 2391 |
+\diffp.dv.[2]V{x_2}+\diffp.dv.[2]V{x_3}. \] |
| 2392 |
|
| 2393 |
\noindent But are the superscripts in the denominators too detached |
| 2394 |
now? |
| 2395 |
|
| 2396 |
When there is no parenthesizing, the \verb`var-sup-nudge` setting |
| 2397 |
is used to adjust this spacing. The default value, \verb`1 mu`, is |
| 2398 |
intended for differentiation variables which are \emph{not} subscripted. |
| 2399 |
So let's adjust the setting for variables which \emph{are }subscripted |
| 2400 |
and define a variant with name, \verb`dv_`, say, the name suggesting |
| 2401 |
`not parenthesized and subscripted': |
| 2402 |
\begin{verbatim} |
| 2403 |
\difdef { f, fp, s, sp } {dv_} |
| 2404 |
{ |
| 2405 |
long-var-wrap = dv, |
| 2406 |
var-sup-nudge = -1 mu |
| 2407 |
} |
| 2408 |
\end{verbatim} |
| 2409 |
This definition can be found in the file \texttt{diffcoeff5.def}, |
| 2410 |
giving the result |
| 2411 |
\begin{verbatim} |
| 2412 |
\[ \sum_{i=0}^3 \diffp.dv_.[2]V{x_i}= |
| 2413 |
\diffp.dv_.[2]V{x_1}+\diffp.dv_.[2]V{x_2}+ |
| 2414 |
\diffp.dv_.[2]V{x_3}. \] |
| 2415 |
\end{verbatim} |
| 2416 |
$\Longrightarrow$ \[\sum_{i=0}^3\diffp.dv_.[2]V{x_i}=\diffp.dv_.[2]V{x_1} |
| 2417 |
+\diffp.dv_.[2]V{x_2}+\diffp.dv_.[2]V{x_3}. \]The superscripts are no longer detached from the variables. |
| 2418 |
|
| 2419 |
\paragraph{Superscripted variables} |
| 2420 |
|
| 2421 |
\emph{Super}scripted variables, as you get in tensor calculus, unavoidably |
| 2422 |
give less elegant results. The three possibilities are |
| 2423 |
\begin{verbatim} |
| 2424 |
\[ \diffp[2]f{x^1},\quad |
| 2425 |
\diffp.dv.[2]f{x^1},\quad |
| 2426 |
\diffp.(dv).[2]f{x^1}. \] |
| 2427 |
\end{verbatim} |
| 2428 |
$\Longrightarrow$ \[ \diffp[2]f{x^1},\quad |
| 2429 |
\diffp.dv.[2]f{x^1},\quad |
| 2430 |
\diffp.(dv).[2]f{x^1}. \] |
| 2431 |
|
| 2432 |
\noindent The third of these is unlikely to be favoured. The first |
| 2433 |
(the default) to my eye gives a noticeably better result for the Laplacian |
| 2434 |
than the second: |
| 2435 |
\begin{verbatim} |
| 2436 |
\[ \sum_{i=1}^3\diffp[2]V{x^i}= |
| 2437 |
\diffp V{x^1:2}+\diffp V{x^2:2}+ |
| 2438 |
\diffp V{x^3:2}, \] |
| 2439 |
\[ \sum_{i=1}^3\diffp.dv.[2]V{x^i}= |
| 2440 |
\diffp.dv.V{x^1:2}+\diffp.dv.V{x^2:2}+ |
| 2441 |
\diffp.dv.V{x^3:2}. \] |
| 2442 |
\end{verbatim} |
| 2443 |
$\Longrightarrow$ \[ \sum_{i=1}^3\diffp[2]V{x^i}= |
| 2444 |
\diffp V{x^1:2}+\diffp V{x^2:2}+ |
| 2445 |
\diffp V{x^3:2}, \] |
| 2446 |
\[ \sum_{i=1}^3\diffp.dv.[2]V{x^i}= |
| 2447 |
\diffp.dv.V{x^1:2}+\diffp.dv.V{x^2:2}+ |
| 2448 |
\diffp.dv.V{x^3:2}. \] |
| 2449 |
|
| 2450 |
\subsubsection{Upright text-style derivatives} |
| 2451 |
|
| 2452 |
\texttt{diffcoeff} assumes that derivatives of upright-fraction form |
| 2453 |
will be used mainly in display-style expressions and that the slash |
| 2454 |
form will be used mainly for inline (text-style) use. But if one does |
| 2455 |
want to use the upright form in an inline expression, then \verb`$ \diffp ST $` |
| 2456 |
displaying as $ \diffp ST $ is fine, but adding a trailing optional |
| 2457 |
argument, \verb`$ \diffp ST[V] $`, to indicate (in the present example) |
| 2458 |
a variable held constant is not: $\diffp ST[V]$. Clearly the subscript |
| 2459 |
is too close to the right parenthesis and (to my eye) there is too |
| 2460 |
much `elbowroom' between the derivative and the enclosing parentheses. |
| 2461 |
Hence the file \texttt{diffcoeff5.def} contains the following definition |
| 2462 |
for text-style upright fraction derivatives (note that since the \verb`\tfrac` |
| 2463 |
command is used here, this requires the \verb`amsmath` package to |
| 2464 |
have been loaded): |
| 2465 |
\begin{verbatim} |
| 2466 |
\difdef { f, fp } { t } |
| 2467 |
{ |
| 2468 |
style = tfrac , |
| 2469 |
derivand-sep = 1 mu plus 1 mu minus 1 mu, |
| 2470 |
multi-term-sep = 0 mu , |
| 2471 |
term-sep-adjust = 0 mu , |
| 2472 |
wrap-sup-nudge = 0 mu , |
| 2473 |
outer-Ldelim = \bigl (, |
| 2474 |
outer-Rdelim = \bigr ), |
| 2475 |
elbowroom = -2 mu , |
| 2476 |
sub-nudge = -3 mu |
| 2477 |
} |
| 2478 |
\end{verbatim} |
| 2479 |
Now the variant form \verb`$ \diffp.t.ST[V] $` displays as $\diffp.t.ST[V]$; |
| 2480 |
the subscript is better positioned and there is a better fit between |
| 2481 |
parentheses and derivative. Note that \verb`style=tfrac` in the definition |
| 2482 |
means \verb`\diffp.t.` will not scale. |
| 2483 |
|
| 2484 |
\subsubsection{Split-level text-style derivative} |
| 2485 |
|
| 2486 |
\label{subsec:variantSplit-level-text-style}A `halfway house' between |
| 2487 |
upright and slash-fraction forms for inline derivatives is a split-level |
| 2488 |
slash fraction, available from version 5.5 of \texttt{diffcoef}.\footnote{I have copied and modified code defining the \texttt{\textbackslash sfrac} |
| 2489 |
command from the \texttt{xfrac} package; hence the \texttt{style=sfrac} |
| 2490 |
line in the definition. } (This requires the \verb`amsmath` package to have already been loaded.) |
| 2491 |
Then |
| 2492 |
\begin{verbatim} |
| 2493 |
\difdef { s, sp } { s } |
| 2494 |
{ |
| 2495 |
style = sfrac, |
| 2496 |
slash-sep = { -2 mu, -1 mu }, |
| 2497 |
derivand-sep = 0 mu , |
| 2498 |
multi-term-sep = 0 mu , |
| 2499 |
term-sep-adjust = 0 mu , |
| 2500 |
var-sup-nudge = 0 mu , |
| 2501 |
lvwrap-sup-nudge = 0 mu |
| 2502 |
} |
| 2503 |
\end{verbatim} |
| 2504 |
defines inline derivatives of the form |
| 2505 |
\begin{verbatim} |
| 2506 |
\[ \difs.s.yx,\quad\difs.s.yx[0],\quad |
| 2507 |
\difsp.s.*yx,\quad\difsp.s.*yx[0]. \] |
| 2508 |
\end{verbatim} |
| 2509 |
$\Longrightarrow$ \[ \difs.s.yx,\quad\difs.s.yx[0],\quad\difsp.s.*yx,\quad\difsp.s.*yx[0]. \] |
| 2510 |
|
| 2511 |
\noindent The $y$ in the first two is \verb`\scriptstyle` size but |
| 2512 |
when appended and hence outside the fraction it is normal size. Since |
| 2513 |
it remains within the fraction in all four examples, the $x$ is \verb`\scriptstyle` |
| 2514 |
size. Should you need to write a derivative as an exponent, this split-level |
| 2515 |
slash fraction form gives a neater result than a pure slash fraction |
| 2516 |
or an upright fraction: |
| 2517 |
\begin{verbatim} |
| 2518 |
$ e^{\difs.s.yx},\quad e^{\difs yx},\quad e^{\diff yx} $ |
| 2519 |
\end{verbatim} |
| 2520 |
$\Longrightarrow$ $ e^{\difs.s.yx},\quad e^{\difs yx},\quad e^{\diff yx} $. |
| 2521 |
|
| 2522 |
In \LaTeX{} if your default font size is $10$pt, then script-style |
| 2523 |
size is $7$pt ($=10\times0.7$) and script-script-style size is $5$pt |
| 2524 |
($\approx10\times0.7\times0.7$), which explains the default value |
| 2525 |
$0.7$ of \textbf{sfrac-scaling}. If your default font size is $11$pt |
| 2526 |
or $12$pt then in either case the script-style size is $8$pt and |
| 2527 |
script-script-style size is $6$pt. |
| 2528 |
|
| 2529 |
\paragraph{Editing a variant form} |
| 2530 |
|
| 2531 |
\label{par:variantEditing}If you wish to edit an already defined |
| 2532 |
variant form, you don't need to repeat the full definition. It suffices |
| 2533 |
to change the setting only of the relevant key or keys -- but please |
| 2534 |
ensure your \TeX{} distribution is from 2022-12-17 or later. Earlier |
| 2535 |
versions of \texttt{xtemplate} contained a bug that didn't otherwise |
| 2536 |
affect the workings of \texttt{diffcoeff} but did prevent changes |
| 2537 |
being made to already defined variants. |
| 2538 |
|
| 2539 |
Thus, to the definition just given, in \texttt{diffcoeff5.def} I have |
| 2540 |
made the change |
| 2541 |
\begin{verbatim} |
| 2542 |
\difdef { s } { s } { *slash-sep = { -1 mu, -1 mu } } |
| 2543 |
\end{verbatim} |
| 2544 |
to accommodate the different way the upright $\mathrm{d}$ relates |
| 2545 |
to the slash symbol in the numerator of an appended derivative compared |
| 2546 |
with the math-italic $\partial$: |
| 2547 |
\begin{example} |
| 2548 |
\verb`$ \difs.s.*yx,\quad\difs.s.*yx[0] $` $\Longrightarrow$ $ \difs.s.*yx,\quad\difs.s.*yx[0] $. |
| 2549 |
\end{example} |
| 2550 |
|
| 2551 |
|
| 2552 |
\paragraph{\textbackslash sfrac analogue} |
| 2553 |
|
| 2554 |
\label{par:variant-sfrac-analogue}The \verb`xfrac` package defines |
| 2555 |
a command \verb`\sfrac` that produces split-level fractions. The |
| 2556 |
thought arises that perhaps by omitting the operator symbol in \verb`\difs.s.` |
| 2557 |
we could create an analogue of \verb`\sfrac`. Indeed, from version |
| 2558 |
5.5 of \texttt{diffcoeff}, the file \texttt{diffcoeff5.def} contains |
| 2559 |
the definition |
| 2560 |
\begin{verbatim} |
| 2561 |
\NewDocumentCommand \difsfrac { O{-2mu,-1mu} m m } |
| 2562 |
{{ |
| 2563 |
\difdef { s } { s } { op-symbol= , slash-sep={#1} } |
| 2564 |
\difs.s.{#2}{#3} |
| 2565 |
}} |
| 2566 |
\end{verbatim} |
| 2567 |
The reason for the double braces in the definition is so that the |
| 2568 |
changes to \verb`\difs.s.` do not `leak' beyond \verb`\difsfrac` |
| 2569 |
and affect a later use of \verb`\difs.s.`. Indeed, \verb`$ \difsfrac yx,\ \difs.s.yx $` |
| 2570 |
$\Longrightarrow$ $ \difsfrac yx,\ \difs.s.yx $, so that there is |
| 2571 |
no `leakage'. \verb`\difsfrac` can be used within or without math |
| 2572 |
delimiters, |
| 2573 |
\begin{example} |
| 2574 |
\verb`\difsfrac 34, $\difsfrac 1{16}$` $\Longrightarrow$ \difsfrac 34, $\difsfrac 1{16}$. |
| 2575 |
\end{example} |
| 2576 |
|
| 2577 |
If you want to adjust the spacing of numerator or denominator from |
| 2578 |
the slash, an initial optional argument is available taking two math |
| 2579 |
lengths in mu, separated by a comma. Generally these lengths will |
| 2580 |
be negative to bring numerator and denominator closer to the slash; |
| 2581 |
positive lengths push them away, like this: \verb`\difsfrac[10mu,10mu] 34` |
| 2582 |
$\Longrightarrow$ \difsfrac[10mu,10mu] 34. |
| 2583 |
|
| 2584 |
\subsubsection{Slash-fraction styles} |
| 2585 |
|
| 2586 |
The default slash-fraction form \verb`$ \difs yx $` displaying as |
| 2587 |
$ \difs yx $ does not scale. It is intended for inline use, but sometimes |
| 2588 |
you may want a slash fraction of a different size -- perhaps a fraction |
| 2589 |
is present in the differentiand or in the variable of differentiation. |
| 2590 |
The file \texttt{diffcoeff5.def} contains a definition of a scaling |
| 2591 |
slash fraction (name \verb`0`) and a slightly larger-than-default |
| 2592 |
slash fraction (name \verb`1`): |
| 2593 |
\begin{verbatim} |
| 2594 |
\difdef { s, sp } { 0 } \difdef { s, sp } { 1 } |
| 2595 |
{ { |
| 2596 |
style = auto , style = big , |
| 2597 |
outer-Ldelim = \left [ , outer-Ldelim = \bigl (, |
| 2598 |
outer-Rdelim = \right ] , outer-Rdelim = \bigr ), |
| 2599 |
sub-nudge = 0 mu , sub-nudge = -2 mu, |
| 2600 |
*inner-Ldelim = \mleft ( , *inner-Ldelim = \bigl (, |
| 2601 |
*inner-Rdelim = \mright ), *inner-Rdelim = \bigr ), |
| 2602 |
*outer-Ldelim = \left [ , *outer-Ldelim = \bigl [, |
| 2603 |
*outer-Rdelim = \right ] *outer-Rdelim = \right ] |
| 2604 |
} } |
| 2605 |
\end{verbatim} |
| 2606 |
The names arise from the sequence \verb`\big/`, \verb`\Big/`, \verb`\bigg/`, |
| 2607 |
\verb`\Bigg/`, hence \verb`1`, \verb`2`, \verb`3`, \verb`4`, |
| 2608 |
which leaves \verb`0` for the scaling form \verb`auto` (which is |
| 2609 |
built around \verb`\left.`, \verb`\middle/`, \verb`\right.`). \texttt{diffcoeff5.def} |
| 2610 |
does not contain definitions for the \verb`2`, \verb`3`, \verb`4` |
| 2611 |
variants, only the two shown, because the larger sizes give ridiculous |
| 2612 |
results. For the scaling variant, it is also easy to produce eyesores: |
| 2613 |
\begin{example} |
| 2614 |
\verb`\[ \difsp.0.{\frac1Y}{\frac1X} \]` $\Longrightarrow$ \[ \difsp.0.{\frac1Y}{\frac1X} \] |
| 2615 |
\end{example} |
| 2616 |
|
| 2617 |
But for small size increases, the results can be pleasing. To the |
| 2618 |
author's eye, both \verb`0` and \verb`1` variants (the first two |
| 2619 |
of the following) give better results than the default (the last): |
| 2620 |
\begin{example} |
| 2621 |
\verb`$ \difsp.1.{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $ \difsp.1.{F(x,y)}{\tfrac1x}[x=0] $ |
| 2622 |
|
| 2623 |
\verb`$ \difsp.0.{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $\difsp.0.{F(x,y)}{\tfrac1x}[x=0]\vphantom{\bigg|} $ |
| 2624 |
|
| 2625 |
\verb`$ \difsp{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $ \difsp{F(x,y)}{\tfrac1x}[x=0] $ |
| 2626 |
\end{example} |
| 2627 |
|
| 2628 |
\noindent Subscripted \emph{square} brackets are chosen for the scaling |
| 2629 |
variant so that the setting \verb`sub-nudge=0 mu` is appropriate |
| 2630 |
at all scales. They provide good visual contrast with the parentheses |
| 2631 |
of $F(x,y)$. |
| 2632 |
|
| 2633 |
\subsubsection{Compact--form derivatives} |
| 2634 |
|
| 2635 |
\label{subsec:variantCompact=002013forms}Three styles are available |
| 2636 |
for compact-form derivatives, \verb`style=_`, the default as displayed |
| 2637 |
in $\difc yx$; \verb`style=dl`, a `differential style' as displayed |
| 2638 |
in $\difc.dl.{}{x:2}$ (with no differentiand), and from version 5.5 |
| 2639 |
of \texttt{diffcoeff}, a `doubly compact' style, \verb`style=cc` |
| 2640 |
as displayed in $\difcp.cc.<1>f{x:2,y,z:3}$. (Nominally there is |
| 2641 |
a fourth style, \verb`style=d^`, but that is equivalent to \verb`style=_`.) |
| 2642 |
|
| 2643 |
In the default style (for a partial derivative) the orders of differentiation |
| 2644 |
are applied to the operator symbol: |
| 2645 |
\begin{example} |
| 2646 |
\verb`$ \difcp[3,1,2]f{x,y,z} $` $\Longrightarrow$ $ \difcp[3,1,2]{f}{x,y,z} $. |
| 2647 |
\end{example} |
| 2648 |
|
| 2649 |
\noindent If no differentiation variable is specified, only an empty |
| 2650 |
brace pair,\footnote{This is the behaviour from version 5.2 of \texttt{diffcoeff}; in version |
| 2651 |
5.1, a nested\emph{ }pair of empty braces, \{\{\}\}, was required.} |
| 2652 |
\begin{example} |
| 2653 |
\verb`$ \difc[2]f{} $` $\Longrightarrow$ $ \difc[2]f{} $. |
| 2654 |
\end{example} |
| 2655 |
|
| 2656 |
\noindent (One could also write \verb`$ \difc f{:2} $` to get this |
| 2657 |
result.) If you want to write `differentials of differentials', |
| 2658 |
second order differentials, then this is a possible way of doing so |
| 2659 |
-- but \texttt{diffcoeff} has a dedicated differential command, \verb`\dl`, |
| 2660 |
see §\ref{sec:Differentials}, and in relation to the example, see |
| 2661 |
§\ref{subsec:Variant-differentials}. |
| 2662 |
|
| 2663 |
Suppose now we define a variant form (as is done in \texttt{diffcoeff5.def}), |
| 2664 |
\begin{verbatim} |
| 2665 |
\difdef { cp } { dl } |
| 2666 |
{ |
| 2667 |
style = dl , |
| 2668 |
multi-term-sep = 1 mu, |
| 2669 |
term-sep-adjust = -1 mu |
| 2670 |
} |
| 2671 |
\end{verbatim} |
| 2672 |
and use it to form a similar expression but without the differentiand |
| 2673 |
this time, an empty argument in \emph{its} place: |
| 2674 |
\begin{example} |
| 2675 |
\verb`$ \difcp.dl.[3,2]{}{x,y,z} $` $\Longrightarrow$ $ \difcp.dl.[3,2]{}{x,y,z}$ |
| 2676 |
\end{example} |
| 2677 |
|
| 2678 |
\noindent In this \verb`dl` (or \emph{differential}) style, the orders |
| 2679 |
of differentiation in the displayed output are applied to the \emph{variables}. |
| 2680 |
This allows discussion of, for example, the denominator of a mixed |
| 2681 |
partial derivative -- perhaps a remark about minutiae of spacing. |
| 2682 |
(But see §\ref{sec:Differentials}, on differentials, which more conveniently |
| 2683 |
allows the writing of, for example, $\!\dl[3]x$.) |
| 2684 |
|
| 2685 |
\paragraph{Doubly compact forms} |
| 2686 |
|
| 2687 |
\label{par:Doubly-compact-forms}In the search for ever more concision, |
| 2688 |
one might wonder if a form like $ \difcp[3,1,2]{f}{x,y,z} $ can be |
| 2689 |
compressed further to use only one operator symbol. This is the purpose |
| 2690 |
of \verb`style=cc`. The file \texttt{diffcoeff5.def} contains the |
| 2691 |
definition |
| 2692 |
\begin{verbatim} |
| 2693 |
\difdef { cp } { cc } |
| 2694 |
{ |
| 2695 |
style = cc , |
| 2696 |
multi-term-sep = 0 mu, |
| 2697 |
term-sep-adjust = -1 mu, |
| 2698 |
var-sup-nudge = 0 mu |
| 2699 |
} |
| 2700 |
\end{verbatim} |
| 2701 |
Now one can write \verb`$\difcp.cc.f{x:3,y,z:2}$` $\Longrightarrow$ |
| 2702 |
$\difcp.cc.f{x:3,y,z:2} $. Is the total order -- the $6$ -- really |
| 2703 |
necessary? We can use the order-override option to suppress it: \verb`$\difcp.cc.<1>f{x:3,y,z:2}$` |
| 2704 |
$\Longrightarrow$ $\difcp.cc.<1>f{x:3,y,z:2}$, which to my eye is |
| 2705 |
cleaner. You can make this your \emph{default} compact derivative |
| 2706 |
by omitting the \verb`cc` from the second argument of \verb`\difdef`, |
| 2707 |
leaving it empty; then it would suffice to write \verb`$\difcp<1>f{x:3,y,z:2}$` |
| 2708 |
to obtain the last result. |
| 2709 |
|
| 2710 |
But do you want always to be writing \verb`<1>` to suppress the superfluous |
| 2711 |
total order of differentiation? Obviously not. For that reason, \texttt{diffcoeff5.def} |
| 2712 |
contains the lines |
| 2713 |
\begin{verbatim} |
| 2714 |
\NewDocumentCommand \difccp { s s O{1} } |
| 2715 |
{ |
| 2716 |
\IfBooleanTF #1 |
| 2717 |
{ \difcp.cc.**[#3]<1> } { \difcp.cc.[#3]<1> } |
| 2718 |
} |
| 2719 |
\end{verbatim} |
| 2720 |
which now means you can write \verb`$\difccp f{x:3,y,z:2}$` $\Longrightarrow$ |
| 2721 |
$\difccp f{x:3,y,z:2}$ or \verb`$\difccp[3,1,2]f{x,y,z}[(x,y,z)=\mathbf0]$` |
| 2722 |
$\Longrightarrow$ $\difccp[3,1,2]f{x,y,z}[(x,y,z)=\mathbf0]$. |
| 2723 |
|
| 2724 |
\verb`\difccp` can be double starred to reverse the order of its |
| 2725 |
arguments, variables of differentiation before differentiand. (In |
| 2726 |
fact a single star has the same effect here: present the arguments |
| 2727 |
to \verb`\difccp` in reverse order.) Thus, doubly starred, \verb`$\difccp**{x,y}f[y=1]$` |
| 2728 |
$\Longrightarrow$ $\difccp**{x,y}f[y=1]$ (although a single star |
| 2729 |
would have sufficed). However, \verb`\difccp` does not accept a dot |
| 2730 |
delimited first argument with which to define a variant. |
| 2731 |
|
| 2732 |
There is one key in template \verb`DIF` solely relevant to doubly |
| 2733 |
compact derivatives: \verb`difcc-var-ord` specifies how the orders |
| 2734 |
of differentiation are displayed between the variables of differentiation. |
| 2735 |
It's default value is \verb`^{#1}` meaning that the orders are presented |
| 2736 |
as superscripts -- as shown in the examples. If you do not want superscripting |
| 2737 |
but, say, only the order then edit the above variant in this way: |
| 2738 |
either add the line \verb`difcc-var-ord = ##1` (a double \verb`#` |
| 2739 |
must be used within the \verb`\difdef` command) to the \emph{key-value} |
| 2740 |
list defining the \verb`\difcp.cc.` variant above (ensuring all lines |
| 2741 |
except possibly the last end in commas), or \emph{after} the definition |
| 2742 |
above add a definition to your \verb`.def` file that edits it: |
| 2743 |
\begin{verbatim} |
| 2744 |
\difdef { cp } { cc } { difcc-var-ord = ##1 } |
| 2745 |
\end{verbatim} |
| 2746 |
If you prefer the form $\partial_{x:3yz:2}$ replace \verb`##1` here |
| 2747 |
with \verb`:##1`; if you prefer $\partial_{x\boldsymbol{3}yz\boldsymbol{2}}$ |
| 2748 |
replace \verb`##1` with \verb`\mathbf{##1}`. |
| 2749 |
|
| 2750 |
\emph{Subscripts} (actually sub-subscripts) to my eye give a poor |
| 2751 |
result: $\partial_{x_{3}yz_{2}}$, but if this is what you want, then |
| 2752 |
a complication emerges. Placed in the \emph{preamble} of your document, |
| 2753 |
\begin{verbatim} |
| 2754 |
\difdef { cp } { cc } { difcc-var-ord = _{##1} } |
| 2755 |
\end{verbatim} |
| 2756 |
will achieve the desired effect; placed in your \verb`.def` file, |
| 2757 |
it will not. There you will need to write |
| 2758 |
\begin{verbatim} |
| 2759 |
\difdef { cp } { cc } |
| 2760 |
{ difcc-var-ord = \c_math_subscript_token {##1} } |
| 2761 |
\end{verbatim} |
| 2762 |
|
| 2763 |
\subsubsection{D, \textbackslash delta, \textbackslash Delta derivatives} |
| 2764 |
|
| 2765 |
\label{subsec:variantD-delta-Delta}In introductory calculus texts |
| 2766 |
a derivative-like symbol is created with the lowercase Greek delta, |
| 2767 |
$\delta$ . An uppercase Greek delta, $\Delta$, is often used in |
| 2768 |
a derivative-like symbol for an average. In fluid dynamics the \emph{material} |
| 2769 |
(also \emph{substantive} or \emph{total}~) derivative uses an uppercase |
| 2770 |
$\mathrm{D}$ in place of $\mathrm{d}$. Texts on differential equations |
| 2771 |
often use a $\mathrm{D}$ operator. The file \texttt{diffcoeff5.def} |
| 2772 |
contains the definitions |
| 2773 |
\begin{verbatim} |
| 2774 |
\difdef { f, s } { gd } |
| 2775 |
{ op-symbol = \delta } |
| 2776 |
\difdef { f, s } { gD } |
| 2777 |
{ op-symbol = \Delta } |
| 2778 |
\difdef { f, s } { D } |
| 2779 |
{ op-symbol = \mathrm{D} } |
| 2780 |
\difdef { c } { bD } |
| 2781 |
{ |
| 2782 |
op-symbol = \mathbf{D}, |
| 2783 |
op-sub-nudge = -2mu |
| 2784 |
} |
| 2785 |
\end{verbatim} |
| 2786 |
(where the `g' in the first two suggests `greek'), meaning one |
| 2787 |
can write expressions like \verb`$ \difs.gd.yx $` $\Longrightarrow$ |
| 2788 |
$ \difs.gd.yx $, or \verb`$ \difs.gD.yx $` $\Longrightarrow$ $ \difs.gD.st$ |
| 2789 |
(for the average speed), or |
| 2790 |
\begin{example} |
| 2791 |
\verb`\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]`$\Longrightarrow$ |
| 2792 |
\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \] |
| 2793 |
\end{example} |
| 2794 |
|
| 2795 |
\noindent for the total derivative of $\rho$ (perhaps in fluid dynamics), |
| 2796 |
or, in a course on solving differential equations, |
| 2797 |
\begin{example} |
| 2798 |
\noindent\verb`$ \difc.bD.[2]y{x\,}+2\difc.bD.y{x\,}-4=0 $` $\Longrightarrow$ |
| 2799 |
$ \difc.bD.[2]y{x\,}+2\difc.bD.y{x\,}-4=0 $ |
| 2800 |
\end{example} |
| 2801 |
|
| 2802 |
|
| 2803 |
\subsection{Changing defaults in \texttt{DIF}} |
| 2804 |
|
| 2805 |
\label{subsec:Changing-DIF-defaults}Leaving the second argument of |
| 2806 |
the \verb`\difdef` command empty changes default values in the templates |
| 2807 |
specified in the first argument. But the grandparent template \verb`DIF` |
| 2808 |
is unaffected. Intuitively, one might expect that leaving the first |
| 2809 |
argument of the \verb`\difdef` command empty would change a \verb`DIF` |
| 2810 |
default, but that is not the case. To change a default in \verb`DIF` |
| 2811 |
so that it `infects' -- is inherited by -- all other templates |
| 2812 |
can be done only at load time. |
| 2813 |
|
| 2814 |
There are two ways of doing this. The first is to create a text file |
| 2815 |
with the specific name \texttt{diffcoeff.DIF} with the desired settings. |
| 2816 |
For example, if we want math-italic `d's and a subscripted vertical |
| 2817 |
rule for points of evaluation, then the file might look like |
| 2818 |
\begin{verbatim} |
| 2819 |
op-symbol = d, |
| 2820 |
op-order-nudge = 1 mu, |
| 2821 |
outer-Ldelim = \left . , |
| 2822 |
outer-Rdelim = \right |, |
| 2823 |
sub-nudge = 0 mu |
| 2824 |
\end{verbatim} |
| 2825 |
By locating the file in a place where your \TeX{} distribution can |
| 2826 |
find it -- either in the directory of the current document or in |
| 2827 |
your personal \verb`texmf` tree (see the earlier discussion at §\ref{subsec:The-def-file}, |
| 2828 |
and in particular the need to alert your \TeX{} distro to the presence |
| 2829 |
of the file) -- \texttt{diffcoeff.DIF} will be read at load time |
| 2830 |
and the new defaults not only incorporated into template \verb`DIF` |
| 2831 |
but inherited by all child and grandchild templates unless explicitly |
| 2832 |
countermanded (for example by \verb`op-symbol = \partial` and similar |
| 2833 |
statements in the definitions of those templates). |
| 2834 |
|
| 2835 |
Note that placing \texttt{diffcoeff.DIF} in your current document |
| 2836 |
directory means that only for documents sharing that directory will |
| 2837 |
it be found. If you want \texttt{diffcoeff.DIF} to be found whatever |
| 2838 |
the location of the document you are working on, then place \texttt{diffcoeff.DIF} |
| 2839 |
in your personal \verb`texmf` tree and alert your \TeX{} distro to |
| 2840 |
its presence (`refresh the filename database'). |
| 2841 |
|
| 2842 |
The second method of changing defaults in the grandparent template |
| 2843 |
\verb`DIF` is to use the \emph{package option} \verb`DIF`. For instance |
| 2844 |
loading \texttt{diffcoeff} with the call |
| 2845 |
\begin{verbatim} |
| 2846 |
\usepackage |
| 2847 |
[ DIF = |
| 2848 |
{ |
| 2849 |
op-symbol = d, |
| 2850 |
op-order-nudge = 1 mu, |
| 2851 |
outer-Ldelim = \left . , |
| 2852 |
outer-Rdelim = \right |, |
| 2853 |
sub-nudge = 0 mu |
| 2854 |
} |
| 2855 |
]{diffcoeff} |
| 2856 |
\end{verbatim} |
| 2857 |
will overwrite the built-in defaults with these new values, which |
| 2858 |
will be inherited by child (and grandchild) templates unless explicitly |
| 2859 |
countermanded. Notice that since \verb`DIF` is a comma list it requires |
| 2860 |
braces around the list of \emph{key=value} statements\emph{.} If using |
| 2861 |
the package option \verb`DIF` and employing commands within the \emph{key=value} |
| 2862 |
list from the \texttt{mleftright} package, you will need to explicitly |
| 2863 |
load that package before the call to \texttt{diffcoeff}. (This issue |
| 2864 |
does not affect use of the file \texttt{diffcoeff.DIF}.) |
| 2865 |
|
| 2866 |
If both methods of changing the template \verb`DIF` are employed, |
| 2867 |
the order of use is, first, read and act on the file \texttt{diffcoeff.DIF}, |
| 2868 |
then read and act on the package option \verb`DIF`. (In other words, |
| 2869 |
to avoid complicating the preamble, preferably use the file \texttt{diffcoeff.DIF}; |
| 2870 |
use the package option \verb`DIF` only for fine-tuning -- perhaps |
| 2871 |
a setting specific to that particular document.) |
| 2872 |
|
| 2873 |
\subsection{Other notations} |
| 2874 |
|
| 2875 |
\label{subsec:Other-notations}The \texttt{diffcoeff} package is about |
| 2876 |
defining \emph{derivatives} but it is worth observing that other notations |
| 2877 |
can be built from the \texttt{diffcoeff} constituents, in particular |
| 2878 |
from the slash fraction forms. For example, some other token than |
| 2879 |
\verb`/`, or indeed series of tokens, can be used to link numerator |
| 2880 |
and denominator. It could be \verb`\vert` or \verb`\Vert`, displaying |
| 2881 |
as $\vert$ and $\Vert$ respectively, or \verb`\otimes` (requiring |
| 2882 |
for example \verb`\usepackage{stmaryrd}` in the preamble), displaying |
| 2883 |
as $\otimes$, or the sequence of tokens \verb`\otimes\cdots\otimes` |
| 2884 |
displaying as $\otimes\cdots\otimes$. The critical key is \verb`slash-tok`, |
| 2885 |
with possible extra spacing on either side through the key \verb`slash-sep`. |
| 2886 |
Or, one may want to void the \verb`op-symbol` key by giving it an |
| 2887 |
empty value or do something like \verb`op-symbol=\mathbf`, or give |
| 2888 |
\verb`outer-Ldelim`, \verb`outer-Rdelim` special values, e.g.,\verb`\langle`, |
| 2889 |
\verb`\rvert`. |
| 2890 |
|
| 2891 |
In the file \texttt{diffcoeff5.def} I have included the following |
| 2892 |
definition, in order to mimic the \verb`\Braket` command of the \verb`braket` |
| 2893 |
package, |
| 2894 |
\begin{verbatim} |
| 2895 |
\difdef{ s }{ bk } |
| 2896 |
{ |
| 2897 |
slash-tok = , |
| 2898 |
op-symbol = , |
| 2899 |
multi-term-sep = 3mu\middle|\mskip3mu , |
| 2900 |
outer-Ldelim = \left\langle , |
| 2901 |
outer-Rdelim = \right\rangle |
| 2902 |
} |
| 2903 |
\end{verbatim} |
| 2904 |
and supplemented it with the definition: |
| 2905 |
\begin{verbatim} |
| 2906 |
\NewDocumentCommand \Braket { m } |
| 2907 |
{ \difs.bk.<\negmu>{}{#1}[] } |
| 2908 |
\end{verbatim} |
| 2909 |
Testing the new command, \verb`\Braket`, gives this display: |
| 2910 |
\begin{example} |
| 2911 |
\verb`\[ \Braket{\phi,\diffp[2]{}t,\psi} \]` $\Longrightarrow$ \[\Braket{\phi,\diffp[2]{}t,\psi} \] |
| 2912 |
\end{example} |
| 2913 |
|
| 2914 |
Comparison with the \verb`\Braket` command of the \verb`braket` |
| 2915 |
package, which uses \verb`|` as the separator in the argument rather |
| 2916 |
than commas, shows the displayed results to be the same (as far as |
| 2917 |
I can judge). |
| 2918 |
|
| 2919 |
\chapter{Differentials and jacobians} |
| 2920 |
|
| 2921 |
\label{chap:Differentials-and-jacobians}In addition to the six derivative |
| 2922 |
commands, \verb`\difx` and \verb`\difxp`, the \texttt{diffcoeff} |
| 2923 |
package has two further commands, \verb`\dl` (also \verb`\difl`) |
| 2924 |
and \verb`\jacob` (also \verb`\difj`), for writing differentials |
| 2925 |
and jabobian determinants respectively. These commands use the settings |
| 2926 |
of the templates \verb`DIFL` and \verb`DIFJ`, and both are correspondingly |
| 2927 |
configurable by means of the \verb`\difdef` command. |
| 2928 |
|
| 2929 |
\section{Differentials} |
| 2930 |
|
| 2931 |
\label{sec:Differentials}Forms like $\dl x$ occur not only as components |
| 2932 |
of derivatives but also in other contexts like the expression for |
| 2933 |
a total differential, |
| 2934 |
\[ |
| 2935 |
\dl P=\diffp Px\dl x+\diffp Py\dl y+\diffp Pz\dl z, |
| 2936 |
\] |
| 2937 |
or in integrals, like $\int\sin x\dl x$, or multi-variable integrals |
| 2938 |
like |
| 2939 |
\[ |
| 2940 |
\iiintop^{\infty}_{-\infty}V(x,y,z)\dl{x,y,z}, |
| 2941 |
\] |
| 2942 |
or, with subscripted variables, rendered more cryptically as |
| 2943 |
\[ |
| 2944 |
\iiintop^{\infty}_{-\infty}V(x_{1},x_{2},x_{3})\dl[3]x,\text{ or }\iiintop^{\infty}_{-\infty}V(x_{1},x_{2},x_{3})\dl.dn.[3]x. |
| 2945 |
\] |
| 2946 |
They also occur in differential geometry and elsewhere in the form |
| 2947 |
of line elements like |
| 2948 |
\begin{example} |
| 2949 |
$\dl.+.{x,y,z}^2$ \quad{}and\quad{} $c^2\dl.-.{t,x,y,z}^2$. |
| 2950 |
\end{example} |
| 2951 |
|
| 2952 |
Surely we want the `d's in these expressions to correspond to their |
| 2953 |
form (upright or math italic) in derivatives? |
| 2954 |
|
| 2955 |
To this end, \texttt{diffcoeff} provides a command \verb`\dl` to |
| 2956 |
write the `d' in a differential in a manner consistent with the |
| 2957 |
default form used in derivatives. In the present document, the default |
| 2958 |
form is upright and so |
| 2959 |
\begin{example} |
| 2960 |
\verb`$ \dl x $` $\Longrightarrow$ $ \dl x. $ |
| 2961 |
\end{example} |
| 2962 |
|
| 2963 |
\noindent (From version 5.4 of \texttt{diffcoeff}, following the pattern |
| 2964 |
of \verb`\diff`, \verb`\difs` and \verb`\difc`, the command \verb`\difl` |
| 2965 |
is also available: \verb`$ \difl x $` $\Longrightarrow$ $ \difl x $.) |
| 2966 |
To use the command before a multi-token variable of differentiation, |
| 2967 |
put the variable in braces: |
| 2968 |
\begin{example} |
| 2969 |
\verb`$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $` $\Longrightarrow$ |
| 2970 |
$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $. |
| 2971 |
\end{example} |
| 2972 |
|
| 2973 |
For the first triple integral above, writing the differentials required |
| 2974 |
not three but just the \emph{one} command: |
| 2975 |
\begin{example} |
| 2976 |
\verb`$ \dl{x,y,z} $` $\Longrightarrow$ $ \dl{x,y,z} $. |
| 2977 |
\end{example} |
| 2978 |
|
| 2979 |
For the second triple integral, $\dl[3]x$ was just \verb`\dl[3]x`, |
| 2980 |
and for the third I used a dot-delimited argument producing a variant |
| 2981 |
form of the differential \verb`\dl.dn.[3]x` (which could be compacted |
| 2982 |
further into a macro if it were to be used often; see §\ref{subsec:Variant-differentials} |
| 2983 |
below). |
| 2984 |
|
| 2985 |
To write the line elements I again made use of a variant form of the |
| 2986 |
differential (again see §\ref{subsec:Line-elements}): |
| 2987 |
\begin{example} |
| 2988 |
\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $, |
| 2989 |
|
| 2990 |
\verb`$ c^2\dl.-.{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl.-.{t,x,y,z}^2 $. |
| 2991 |
\end{example} |
| 2992 |
|
| 2993 |
|
| 2994 |
\subsection{Template \texttt{DIFL}} |
| 2995 |
|
| 2996 |
\begin{wraptable}{o}{0.5\columnwidth}% |
| 2997 |
|
| 2998 |
\centering{}\caption{\texttt{DIFL} defaults\label{tab:DIFL-defaults}} |
| 2999 |
\begin{center} |
| 3000 |
\begin{tabular}{lr} |
| 3001 |
\toprule |
| 3002 |
{\small key} & {\small default}\tabularnewline |
| 3003 |
\midrule |
| 3004 |
{\small style} & {\small\texttt{dl}}\tabularnewline |
| 3005 |
{\small outer-Ldelim} & {\small\texttt{\textbackslash ,}}\tabularnewline |
| 3006 |
{\small outer-Rdelim} & \tabularnewline |
| 3007 |
\bottomrule |
| 3008 |
\end{tabular} |
| 3009 |
\par\end{center}\end{wraptable}% |
| 3010 |
The differential command \verb`\dl` gives access to a template \verb`DIFL` |
| 3011 |
which inherits the default values of the fundamental template \verb`DIF` |
| 3012 |
with the (few) changes shown in Table~\ref{tab:DIFL-defaults}. In |
| 3013 |
prior versions of \texttt{diffcoeff} the \verb`style` key was fixed |
| 3014 |
at the value \verb`dl`; from version 5.4 it can also take the value |
| 3015 |
\verb`d^`. With the default style \verb`dl`, \verb`$\dl[2]x$` $\Longrightarrow$ |
| 3016 |
$\dl[2]x$; with style \verb`d^` the superscript attaches to the |
| 3017 |
`d', $\dl.dn.[3]x$. This form is sometimes used when abbreviating |
| 3018 |
the product of differentials in a multiple integral. The \verb`outer-Ldelim` |
| 3019 |
key inserts a thin space before the differential; the \verb`outer-Rdelim` |
| 3020 |
key does nothing. For the differential, both \verb`outer-Ldelim` |
| 3021 |
and \verb`outer-Rdelim` are \emph{always inserted}. This differs |
| 3022 |
from the derivative for which \verb`outer-Ldelim` and \verb`outer-Rdelim` |
| 3023 |
are inserted only if there is a trailing optional argument. It is |
| 3024 |
as if the differential command \verb`\dl` had a built-in empty trailing |
| 3025 |
optional argument. |
| 3026 |
|
| 3027 |
That so few of the \verb`DIF` defaults are changed in \verb`DIFL` |
| 3028 |
indicates that much of the machinery of derivative formation is irrelevant |
| 3029 |
for forming a differential. A list of \emph{relevant} keys for the |
| 3030 |
creation of differentials -- those that have some effect on the appearance |
| 3031 |
of the thing -- can be found at §\ref{subsec:DIFL-(differential)}. |
| 3032 |
|
| 3033 |
\subsection{Syntax and options} |
| 3034 |
|
| 3035 |
\label{subsec:DifferentialsSyntaxOptions}If all arguments are present |
| 3036 |
the differential command has the syntax |
| 3037 |
\begin{verbatim} |
| 3038 |
\dl.name.[order-spec]{variable(s)}^{exponent} |
| 3039 |
\end{verbatim} |
| 3040 |
where the arguments have the following significance: |
| 3041 |
\begin{enumerate} |
| 3042 |
\item \verb`name` (optional) A dot-delimited name to distinguish a variant |
| 3043 |
form (non-default form) of differential; see §\ref{subsec:Variant-differentials} |
| 3044 |
below. |
| 3045 |
\item \verb`order-spec` (optional) The power or comma-list of powers to |
| 3046 |
which the differential or differentials will be raised. If all powers |
| 3047 |
are \verb`1` then no specification is needed; indeed, if fewer powers |
| 3048 |
are specified than there are variables, all `missing' powers are |
| 3049 |
assumed to be \verb`1`; see the discussion for mixed partial derivatives, |
| 3050 |
§\ref{subsec:Mixed-partial-derivatives}. |
| 3051 |
\item \verb`variable(s)` (mandatory) The variable or comma-list of variables |
| 3052 |
the differential operator applies to. \verb`\dl x`, \verb`\dl{\vec{x}}`, |
| 3053 |
\verb`\dl{x,y,z}`, are all valid variable specifications, displaying |
| 3054 |
as $\dl x$, $\dl{\vec{x}}$ and $\dl{x,y,z}$ respectively. |
| 3055 |
\item \verb`exponent` (optional) An exponent to which all differentials |
| 3056 |
will be raised; overrides the \verb`order-spec`; see §\ref{subsec:Line-elements} |
| 3057 |
for examples of use. |
| 3058 |
\end{enumerate} |
| 3059 |
Only the third argument is mandatory, although it may be empty. As |
| 3060 |
with derivatives, the square-bracket delimited order spec. can be |
| 3061 |
replaced by colon-modified arguments in the variable specification: |
| 3062 |
\begin{example} |
| 3063 |
\verb`$ \dl[3]x,\quad \dl{x:3} $` $\Longrightarrow$ $ \dl[3]x,\quad \dl{x:3} $. |
| 3064 |
\end{example} |
| 3065 |
|
| 3066 |
|
| 3067 |
\subsection{Variant forms of differential} |
| 3068 |
|
| 3069 |
\label{subsec:Variant-differentials}The first argument of the differential |
| 3070 |
command \verb`\dl` is the optional \verb`name` which is used like |
| 3071 |
the corresponding argument in the derivative commands to define \emph{variant |
| 3072 |
forms}. |
| 3073 |
|
| 3074 |
To create such variant forms, the \verb`\defdif` command is again |
| 3075 |
used, but with \verb`l` (lowercase \verb`L`) used as the identifier |
| 3076 |
in the first argument. For example, you may want a `partial' differential, |
| 3077 |
using \verb`\partial` in place of \verb`d`. It seems natural to |
| 3078 |
give this the name \verb`p`: |
| 3079 |
\begin{verbatim} |
| 3080 |
\difdef { l } { p } |
| 3081 |
{ op-symbol = \partial } |
| 3082 |
\end{verbatim} |
| 3083 |
In fact just this definition can be found in the file \texttt{diffcoeff5.def}, |
| 3084 |
so that |
| 3085 |
\begin{example} |
| 3086 |
\verb`$ \dl.p.x $` $\Longrightarrow$ $\dl.p.x$ |
| 3087 |
\end{example} |
| 3088 |
|
| 3089 |
\noindent which is seven keystrokes in all versus ten (space included) |
| 3090 |
for \verb`\partial x`. Defining \verb`\dlp` by writing |
| 3091 |
\begin{example} |
| 3092 |
\verb`\NewDocumentCommand \dlp {} { \dl.p. }`. |
| 3093 |
\end{example} |
| 3094 |
|
| 3095 |
\noindent saves another keystroke. This command can be found in the |
| 3096 |
file \texttt{diffcoeff5.def}. The command eases the writing of expressions |
| 3097 |
like $\!\dlp{x:3,y:2,z}$ -- perhaps in a document like the present |
| 3098 |
one to discuss the minutiae of spacing in the denominators of mixed |
| 3099 |
partial derivatives. |
| 3100 |
\begin{example} |
| 3101 |
\verb`$\dlp[3,2]{x,y,z},\quad \dlp{x:3,y:2,z}$` $\Longrightarrow$ |
| 3102 |
$\dlp[3,2]{x,y,z},\quad \dlp{x:3,y:2,z}$ |
| 3103 |
\end{example} |
| 3104 |
|
| 3105 |
\noindent As you can see from the example, just as for mixed partial |
| 3106 |
derivatives, if more than one variable is specified but the \verb`order-spec` |
| 3107 |
contains fewer than that number of entries, \texttt{diffcoeff} assumes |
| 3108 |
the missing entries on the right of the \verb`order-spec` are \verb`1`. |
| 3109 |
|
| 3110 |
A second example of a variant form of differential is provided by |
| 3111 |
the definition |
| 3112 |
\begin{verbatim} |
| 3113 |
\difdef { l } { b } |
| 3114 |
{ op-symbol = \mathrm{d}\mathbf } |
| 3115 |
\end{verbatim} |
| 3116 |
which can be found in the file \texttt{diffcoeff5.def}. If you distinguish |
| 3117 |
vectors by boldface type then you can avoid the repetitive writing |
| 3118 |
of \verb`\mathbf` for differentials of vectors by using the variant |
| 3119 |
form \verb`\dl.b.`: |
| 3120 |
\begin{example} |
| 3121 |
\verb`$ \dl.b.x,\quad \dl.b.{x,y,z} $` $\Longrightarrow$ $ \dl.b.x ,\quad \dl.b.{x,y,z} $. |
| 3122 |
\end{example} |
| 3123 |
|
| 3124 |
A third example is of a differential raised to a power in which the |
| 3125 |
superscript is attached to the \verb`d`, as provided by the definition |
| 3126 |
\begin{verbatim} |
| 3127 |
\difdef { l } { dn } { style = d^ } |
| 3128 |
\end{verbatim} |
| 3129 |
I have added this definition to the file \texttt{diffcoeff5.def}. |
| 3130 |
With this definition |
| 3131 |
\begin{verbatim} |
| 3132 |
\[ \iiintop_{-\infty}^{\infty} |
| 3133 |
V(x_{1},x_{2},x_{3})\dl.dn.[3]x. \] |
| 3134 |
\end{verbatim} |
| 3135 |
$\Longrightarrow$ \[ \iiintop_{-\infty}^{\infty} |
| 3136 |
V(x_{1},x_{2},x_{3})\dl.dn.[3]x. \]If you are going to need this form of differential often, you could |
| 3137 |
save some keystrokes with a macro definition like |
| 3138 |
\begin{example} |
| 3139 |
\verb`\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 }` |
| 3140 |
\end{example} |
| 3141 |
|
| 3142 |
\noindent which I have added to the preamble of the current document. |
| 3143 |
Then to obtain $\dn2x$ one writes \verb`\dn2x`. (But note that to |
| 3144 |
obtain $\!\dn1x$ with no superscript means reverting to \verb`\dl x` |
| 3145 |
or remembering the \verb`1` when writing \verb`\dn1x`.) |
| 3146 |
|
| 3147 |
\subsubsection{Line elements} |
| 3148 |
|
| 3149 |
\label{subsec:Line-elements}Variant forms can be used to write line |
| 3150 |
elements of Pythagorean or Minkowskian form. The definition |
| 3151 |
\begin{verbatim} |
| 3152 |
\difdef { l } { + } |
| 3153 |
{ |
| 3154 |
multi-term-sep = 0 mu +, |
| 3155 |
term-sep-adjust = 0 mu , |
| 3156 |
outer-Ldelim = |
| 3157 |
} |
| 3158 |
\end{verbatim} |
| 3159 |
which can be found in the file \texttt{diffcoeff5.def}, inserts a |
| 3160 |
\verb`+` sign between terms in the variable specification. Note that |
| 3161 |
the value of the \verb`multi-term-sep` key begins with \verb`0 mu`. |
| 3162 |
A dimension here \emph{initially} is essential. The intriguing feature |
| 3163 |
of the definition is what follows the \verb`0 mu`: a \verb`+` sign. |
| 3164 |
Also note that the thin space inserted by default before a differential |
| 3165 |
by means of the \verb`outer-Ldelim` setting is now removed. Applying |
| 3166 |
this variant to \verb`{x,y,z}` the result is $ \dl.+.{x,y,z} $, |
| 3167 |
which may be mildly interesting but definitely becomes so when we |
| 3168 |
add an exponent to the variable spec.: |
| 3169 |
\begin{example} |
| 3170 |
\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $. |
| 3171 |
\end{example} |
| 3172 |
|
| 3173 |
\noindent The exponent acts as if an order specification \verb`[2,2,2]` |
| 3174 |
had been included. If an order specification \emph{is }included, whatever |
| 3175 |
the values listed, the trailing exponent overrides it. |
| 3176 |
|
| 3177 |
Similarly, the file \texttt{diffcoeff5.def} contains a definition |
| 3178 |
where the plus sign is replaced by a minus. This enables the writing |
| 3179 |
of a Minkowski metric: |
| 3180 |
\begin{example} |
| 3181 |
\verb`$ c^2\dl.-.{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl.-.{t,x,y,z}^2 $. |
| 3182 |
\end{example} |
| 3183 |
|
| 3184 |
|
| 3185 |
\subsection{Changing defaults} |
| 3186 |
|
| 3187 |
To change the \emph{default} values of the \verb`DIFL` template use |
| 3188 |
the \verb`\difdef` command but, as with derivatives, leave its second |
| 3189 |
argument empty. For instance if you want slightly less space by default |
| 3190 |
before a differential than the thin space (\verb`\,` or \verb`3 mu`) |
| 3191 |
specified in the \verb`DIFL` template -- say you want \verb`2 mu` |
| 3192 |
-- then write |
| 3193 |
\begin{verbatim} |
| 3194 |
\difdef { l } {} { outer-Ldelim = \twomu } |
| 3195 |
\end{verbatim} |
| 3196 |
and ensure that this is in your \verb`.def` file or in the preamble |
| 3197 |
of your document. If you want a rubber length, say \verb`3 mu plus 1 mu minus 2 mu` |
| 3198 |
(which can also be written more compactly as \verb`3muplus1muminus2mu`), |
| 3199 |
then write (notice the \verb`\mskip`) |
| 3200 |
\begin{verbatim} |
| 3201 |
\difdef { l } {} |
| 3202 |
{ outer-Ldelim = \mskip 3muplus1muminus2mu } |
| 3203 |
\end{verbatim} |
| 3204 |
The crucial point is to leave the second argument of \verb`\difdef`, |
| 3205 |
the variant \verb`name`, empty. That changes the \emph{default} values |
| 3206 |
in \verb`DIFL` of the keys listed in the third argument of \verb`\difdef`. |
| 3207 |
|
| 3208 |
\subsection{Rationale} |
| 3209 |
|
| 3210 |
But why bother with the differential command at all? It only seems |
| 3211 |
to complicate the simple typing of \verb`d` followed by \verb`x`. |
| 3212 |
Admittely typing \verb`\dl x` requires fewer keystrokes than typing |
| 3213 |
\verb`\mathrm{d}x` (or even \verb`\mathrm dx`), but there are other, |
| 3214 |
more substantive, reasons why one might prefer an explicit command. |
| 3215 |
\begin{enumerate} |
| 3216 |
\item \emph{Consistency} with the derivative. |
| 3217 |
\item \emph{Spacing} is inserted automatically before the differential, |
| 3218 |
and between differentials in (e.g.) multiple integrals. |
| 3219 |
\item \emph{Parsing integrals} for some other package or program is much |
| 3220 |
easier to do when looking for a concluding differential command \verb`\dl` |
| 3221 |
than when looking for \verb`d` or \verb`\mathrm{d}` or \verb`\mathnormal{d}` |
| 3222 |
(or whatever) followed by an arbitrary variable name. |
| 3223 |
\item \emph{Configurability}. There are values other than the defaults that |
| 3224 |
can be given to keys to give novel effects for variant forms of differential |
| 3225 |
-- see the examples \verb`\dl.b.`, \verb`\dl.+.` and \verb`\dl.-.` |
| 3226 |
above. |
| 3227 |
\end{enumerate} |
| 3228 |
|
| 3229 |
\section{Jacobians} |
| 3230 |
|
| 3231 |
\label{subsec:Jacobians}\texttt{diffcoeff} provides a command {\ttfamily\verb`\jacob`} |
| 3232 |
for writing jacobians -- not the determinant as such but the symbol |
| 3233 |
conventionally used to denote the determinant. (From version 5.4 of |
| 3234 |
\texttt{diffcoeff}, the equivalent command \verb`\difj` is also available |
| 3235 |
for this purpose.) For example |
| 3236 |
\begin{example} |
| 3237 |
\verb`\[ \jacob{u,v}{x,y},\quad \jacob{u,v,w}{x,y,z}. \]` $\Longrightarrow$ |
| 3238 |
\[ \jacob{u,v}{x,y},\quad \jacob{u,v,w}{x,y,z}. \] |
| 3239 |
\end{example} |
| 3240 |
|
| 3241 |
\begin{wraptable}{o}{0.4\columnwidth}% |
| 3242 |
\centering{}\caption{\texttt{DIFJ} defaults\label{tab:DIFJ-defaults}} |
| 3243 |
\begin{center} |
| 3244 |
\begin{tabular}{lr} |
| 3245 |
\toprule |
| 3246 |
{\small key} & {\small default}\tabularnewline |
| 3247 |
\midrule |
| 3248 |
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline |
| 3249 |
{\small outer-Ldelim} & \tabularnewline |
| 3250 |
{\small outer-Rdelim} & \tabularnewline |
| 3251 |
\bottomrule |
| 3252 |
\end{tabular} |
| 3253 |
\par\end{center}\end{wraptable}% |
| 3254 |
The comma lists can contain any number of variables, even one or none, |
| 3255 |
nor need the number of variables in numerator and denominator be equal. |
| 3256 |
\verb`\jacob` does \emph{not} check such things. (It may be possible |
| 3257 |
to exploit this fact when defining variant forms of jacobian.) The |
| 3258 |
content of the variable lists in both numerator and denominator of |
| 3259 |
a jacobian are used exactly as entered by you. That means that if |
| 3260 |
you wish to include dots in the variable lists then you need to include |
| 3261 |
(e.g.) \verb`\ldots` explicitly yourself -- entering three dots |
| 3262 |
as in other \texttt{diffcoeff} commands will simply give you three |
| 3263 |
dots in the output. It is fair to say that -- as of version 5.6 -- |
| 3264 |
the jacobian is not \emph{fully} integrated into the \texttt{diffcoeff} |
| 3265 |
scheme, although it is still (partly) configurable. |
| 3266 |
|
| 3267 |
\subsection{Template \texttt{DIFJ}} |
| 3268 |
|
| 3269 |
The command \verb`\jacob` (also \verb`\difj`) gives access to a |
| 3270 |
template, in this case \verb`DIFJ`, which is a child of the fundamental |
| 3271 |
template \verb`DIF` and inherits most of its default values with |
| 3272 |
only a few changes as shown in Table~\ref{tab:DIFJ-defaults}. Note |
| 3273 |
that the keys \verb`outer-Ldelim` and \verb`outer-Rdelim` are both |
| 3274 |
empty and, as with the differential, are \emph{always inserted} -- |
| 3275 |
which is why they are empty by default. |
| 3276 |
|
| 3277 |
The lack of entries in Table~\ref{tab:DIFJ-defaults} is because |
| 3278 |
many keys are irrelevant for forming jacobians -- it doesn't matter |
| 3279 |
what their values are. For a list of \emph{relevant} keys -- ones |
| 3280 |
that have some effect on the appearance of a jacobian -- see §\ref{subsec:DIFJ-(jacobian)}. |
| 3281 |
|
| 3282 |
\subsection{Syntax and variant forms} |
| 3283 |
|
| 3284 |
The \verb`\jacob` command has only three arguments. The syntax is |
| 3285 |
simple: |
| 3286 |
\begin{verbatim} |
| 3287 |
\jacob.name. {numer} {denom} |
| 3288 |
\end{verbatim} |
| 3289 |
The arguments have the following significance: |
| 3290 |
\begin{enumerate} |
| 3291 |
\item \verb`name` (optional) The dot-delimited name of a variant form of |
| 3292 |
jacobian. |
| 3293 |
\item \verb`numer` (mandatory) A comma list of variables forming the numerator |
| 3294 |
of the jacobian. |
| 3295 |
\item \verb`denom` (mandatory) A comma list of variables forming the denominator |
| 3296 |
of the jacobian. |
| 3297 |
\end{enumerate} |
| 3298 |
The default form of jacobian is an upright fraction with \verb`\partial` |
| 3299 |
operators and parentheses around the variable lists in both numerator |
| 3300 |
and denominator. |
| 3301 |
|
| 3302 |
If you want a jacobian in, say, slash-fraction form then once again |
| 3303 |
the \verb`\difdef` command is used. The file \texttt{diffcoeff5.def} |
| 3304 |
contains the definition |
| 3305 |
\begin{verbatim} |
| 3306 |
\difdef { j } { / } { style = / } |
| 3307 |
\end{verbatim} |
| 3308 |
To access this style, use the name -- which is at your discretion |
| 3309 |
but here I have chosen \verb`/` -- between dots after the \verb`\jacob` |
| 3310 |
command: |
| 3311 |
\begin{example} |
| 3312 |
\verb`$ \jacob./.{u,v,w}{x,y,z} $` $\Longrightarrow$ $ \jacob./.{u,v,w}{x,y,z}. $ |
| 3313 |
\end{example} |
| 3314 |
|
| 3315 |
\noindent Or you might want an inline split-level jacobian, available |
| 3316 |
from version 5.5 of \texttt{diffcoeff}, with the definition |
| 3317 |
\begin{verbatim} |
| 3318 |
\difdef { j } { s } { style = sfrac } |
| 3319 |
\end{verbatim} |
| 3320 |
(to be found in \texttt{diffcoeff5.def}). With this definition |
| 3321 |
\begin{example} |
| 3322 |
\verb`$ \jacob.s.{u,v,w}{x,y,z} $` $\Longrightarrow$ $ \jacob.s.{u,v,w}{x,y,z} $. |
| 3323 |
\end{example} |
| 3324 |
|
| 3325 |
If you want to change the operator symbol from \verb`\partial` to |
| 3326 |
math-italic \verb`D`, as I have seen used, then the definition is: |
| 3327 |
\begin{verbatim} |
| 3328 |
\difdef { j } { D } { op-symbol = D } |
| 3329 |
\end{verbatim} |
| 3330 |
(Again the name is at your discretion but \verb`D` seems obvious.) |
| 3331 |
I have added this to the preamble of the present document, so that |
| 3332 |
\begin{example} |
| 3333 |
\verb`\[ \jacob.D.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.D.{u,v,w}{x,y,z}.\] |
| 3334 |
\end{example} |
| 3335 |
|
| 3336 |
If you want square brackets rather than parentheses around the variable |
| 3337 |
lists, then \verb`lvwrap-Ldelim` and \verb`lvwrap-Rdelim` (perhaps |
| 3338 |
not intuitively) are the keys to change: |
| 3339 |
\begin{verbatim} |
| 3340 |
\difdef { j } { [ } |
| 3341 |
{ |
| 3342 |
lvwrap-Ldelim = \onemu\mleft [, |
| 3343 |
lvwrap-Rdelim = \mright ] |
| 3344 |
} |
| 3345 |
\end{verbatim} |
| 3346 |
the \verb`\onemu` giving, to my eye, better spacing between the \verb`\partial` |
| 3347 |
symbols and the left brackets. This definition, too, has been added |
| 3348 |
to the preamble so that |
| 3349 |
\begin{example} |
| 3350 |
\verb`\[ \jacob.[.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.[.{u,v,w}{x,y,z}. \] |
| 3351 |
\end{example} |
| 3352 |
|
| 3353 |
|
| 3354 |
\subsection{Changing defaults} |
| 3355 |
|
| 3356 |
To change \emph{default} values of the \verb`DIFJ` template leave |
| 3357 |
the second argument of the \verb`\difdef` command -- the variant |
| 3358 |
\verb`name` -- empty. For instance, if you want split-level to be |
| 3359 |
your default setting, the \verb`\difdef` command would be |
| 3360 |
\begin{verbatim} |
| 3361 |
\difdef { j } {} { style = sfrac } |
| 3362 |
\end{verbatim} |
| 3363 |
The only difference from the definition shown earlier is the absence |
| 3364 |
of the name from the now empty second argument. If this definition |
| 3365 |
were added to the preamble or to the \verb`.def` file of your current |
| 3366 |
document then writing \verb`\jacob{u,v,w}{x,y,z}` would give the |
| 3367 |
same result as obtained above with the variant \verb`\jacob.s.{u,v,w}{x,y,z}`. |
| 3368 |
|
| 3369 |
\chapter{Reference} |
| 3370 |
|
| 3371 |
\label{chap:Reference}For convenience I list here the commands of |
| 3372 |
\texttt{diffcoeff}, the template defaults, and the files and preamble |
| 3373 |
definitions associated with this document. |
| 3374 |
|
| 3375 |
\section{Commands} |
| 3376 |
|
| 3377 |
\subsection{Derivatives} |
| 3378 |
|
| 3379 |
\verb`\diff`, \verb`\diffp`, \verb`\difs`, \verb`\difsp`, \verb`\difc`, |
| 3380 |
\verb`\difcp` (sometimes summarised as \verb`\difx` and \verb`\difxp`), |
| 3381 |
ordinary and partial derivatives of upright-fraction, slash-fraction |
| 3382 |
and compact forms respectively. With all arguments present the syntax |
| 3383 |
is |
| 3384 |
\begin{verbatim} |
| 3385 |
\difx.name.**[order-spec]<override>{variable(s)} |
| 3386 |
{differentiand}[pt of eval] |
| 3387 |
\end{verbatim} |
| 3388 |
The syntax is identical for \verb`\difxp`. The eight arguments have |
| 3389 |
the following meanings: |
| 3390 |
\begin{enumerate} |
| 3391 |
\item \verb`name` (optional) A dot-delimited name to distinguish a variant |
| 3392 |
form (non-default form) of derivative; see §\ref{chap:Templates-defaults-variants} |
| 3393 |
and specifically §\ref{sec:Variant-forms}. |
| 3394 |
\item \verb`*` (optional) The presence of a star (asterisk) signals: \emph{append} |
| 3395 |
the differentiand; its absence means the differentiand appears in |
| 3396 |
the numerator of an upright- or slash-fraction form derivative; no |
| 3397 |
effect for compact-form derivatives unless (see next) a second \verb`*` |
| 3398 |
is present; see §\ref{subsec:Appending-the-differentiand}. |
| 3399 |
\item \verb`*` (optional) The presence of a \emph{second} star signals |
| 3400 |
that the argument specifying the variable(s) of differentiation comes |
| 3401 |
\emph{before} the argument specifying the differentiand; this is sometimes |
| 3402 |
convenient when a complicated or lengthy differentiand is appended; |
| 3403 |
see §\ref{subsec:Transposing-the-argument}. |
| 3404 |
\item \verb`order-spec` (optional) The order of differentiation when differentiating |
| 3405 |
in a single variable, or a comma list of orders of differentiation |
| 3406 |
for a mixed partial derivative; see §\ref{subsec:Higher-order-derivatives} |
| 3407 |
and §\ref{subsec:Mixed-partial-derivatives}. Not necessary if orders |
| 3408 |
are specified with the colon notation in the variable list, §§\ref{subsec:Colon-notation} and \ref{subsec:AlgebraicOrders-ColonNotation}. |
| 3409 |
\item \verb`override` (optional) Specifies the total order of differentiation |
| 3410 |
when it cannot be calculated by \texttt{diffcoeff}, or is wanted in |
| 3411 |
a different form from the calculated value; see §\ref{subsec:Order-override-command}. |
| 3412 |
\item \verb`differentiand/derivand` (mandatory) The function or expression |
| 3413 |
being differentiated. |
| 3414 |
\item \verb`variable(s)` (mandatory) The variable of differentiation or |
| 3415 |
a comma list of variables of differentiation (for a mixed partial |
| 3416 |
derivative); also, with the colon notation (see §§\ref{subsec:Colon-notation}, |
| 3417 |
\ref{subsec:AlgebraicOrders-ColonNotation}), provides an alternative |
| 3418 |
method of specifying orders of differentiation. |
| 3419 |
\item \verb`pt of eval` (optional) Point of evaluation or, for partial |
| 3420 |
derivatives, variable or variables held constant; \emph{no space} |
| 3421 |
before the left square bracket; see §\ref{subsec:Point-of-evaluation}. |
| 3422 |
\end{enumerate} |
| 3423 |
Both mandatory arguments may be empty, but require empty brace pairs |
| 3424 |
to indicate as much. (Omitting the differentiand makes sense for all |
| 3425 |
forms of derivative, \verb`\difx`, \verb`\difxp`, but omitting the |
| 3426 |
variable or variables of differentiation is sensible only for the |
| 3427 |
compact forms, \verb`\difc`, \verb`\difcp` -- see §\ref{subsec:variantCompact=002013forms}.) |
| 3428 |
|
| 3429 |
\subsection{Differential} |
| 3430 |
\begin{description} |
| 3431 |
\item [{\texttt{\textbackslash dl}}] (also \verb`\difl`) differential. |
| 3432 |
If all arguments are present the differential command has the syntax |
| 3433 |
\end{description} |
| 3434 |
\begin{verbatim} |
| 3435 |
\dl.name.[order-spec]{variable(s)}^{exponent} |
| 3436 |
\end{verbatim} |
| 3437 |
where the arguments have the following significance: |
| 3438 |
\begin{enumerate} |
| 3439 |
\item \verb`name` (optional) A dot-delimited name to distinguish a variant |
| 3440 |
form of differential; see §\ref{subsec:Variant-differentials}. |
| 3441 |
\item \verb`order-spec` (optional) The power or comma-list of powers to |
| 3442 |
which the differential or differentials will be raised. If all powers |
| 3443 |
are \verb`1` then no specification is needed; indeed, if fewer powers |
| 3444 |
are specified than there are variables, all `missing' powers are |
| 3445 |
assumed to be \verb`1`; see the discussion for mixed partial derivatives, |
| 3446 |
§\ref{subsec:Mixed-partial-derivatives}. Or, the alternative colon |
| 3447 |
notation can be used instead. |
| 3448 |
\item \verb`variable(s)` (mandatory) The variable or comma-list of variables |
| 3449 |
the differential operator applies to. \verb`\dl x`, \verb`\dl{\vec{x}}`, |
| 3450 |
\verb`\dl{x,y,z}`, are all valid variable specifications, displaying |
| 3451 |
as $\dl x$, $\dl{\vec{x}}$ and $\dl{x,y,z}$ respectively. |
| 3452 |
\item \verb`exponent` (optional) An exponent to which all differentials |
| 3453 |
will be raised; overrides the \verb`order-spec`; see §\ref{subsec:Line-elements} |
| 3454 |
for examples of use. |
| 3455 |
\end{enumerate} |
| 3456 |
|
| 3457 |
\subsection{Jacobian} |
| 3458 |
\begin{description} |
| 3459 |
\item [{\texttt{\textbackslash jacob}}] (also \verb`\difj`) jacobian |
| 3460 |
with syntax |
| 3461 |
\end{description} |
| 3462 |
\begin{verbatim} |
| 3463 |
\jacob.name. {numer} {denom} |
| 3464 |
\end{verbatim} |
| 3465 |
where the arguments have the following significance: |
| 3466 |
\begin{enumerate} |
| 3467 |
\item \verb`name` (optional) The dot-delimited name of a variant form of |
| 3468 |
jacobian. |
| 3469 |
\item \verb`numer` (mandatory) A comma list of variables forming the numerator |
| 3470 |
of the jacobian. |
| 3471 |
\item \verb`denom` (mandatory) A comma list of variables forming the denominator |
| 3472 |
of the jacobian. |
| 3473 |
\end{enumerate} |
| 3474 |
|
| 3475 |
\subsection{Supporting commands} |
| 3476 |
\begin{description} |
| 3477 |
\item [{\texttt{\textbackslash difdef}}] Means of defining variant forms |
| 3478 |
of derivatives, differentials and jacobians, with syntax |
| 3479 |
\end{description} |
| 3480 |
\begin{verbatim} |
| 3481 |
\difdef { id(s) } { name } { settings } |
| 3482 |
\end{verbatim} |
| 3483 |
The arguments are all mandatory and have the following significance |
| 3484 |
\begin{enumerate} |
| 3485 |
\item \verb`id(s)` Non-empty comma list of one, some or all of the identifiers |
| 3486 |
\verb`f`, \verb`s`, \verb`c`, \verb`fp`, \verb`sp`, \verb`cp`, |
| 3487 |
\verb`j`, \verb`l` identifying upright fraction, slash fraction |
| 3488 |
and compact ordinary derivatives; upright fraction, slash fraction |
| 3489 |
and compact partial derivatives, and jacobians and differentials; |
| 3490 |
\item \verb`name` Name for a variant form of derivative; as well as letters |
| 3491 |
may include numbers and other keyboard characters, but not braces, |
| 3492 |
\verb`%` or \verb`#`; may be empty, in which case the \verb`{settings}` |
| 3493 |
determine (new) default values for the template(s) identified in \verb`{id(s)}`. |
| 3494 |
\item \verb`settings` Comma list of changed \emph{key=value} settings. |
| 3495 |
\end{enumerate} |
| 3496 |
\begin{description} |
| 3497 |
\item [{\texttt{\textbackslash difoverride}}] (see §\ref{subsec:Order-override-command}) |
| 3498 |
order-override command (now deprecated in favour of the order-override |
| 3499 |
option) with syntax |
| 3500 |
\end{description} |
| 3501 |
\begin{verbatim} |
| 3502 |
\difoverride { total order } |
| 3503 |
\end{verbatim} |
| 3504 |
where the one mandatory argument has the significance |
| 3505 |
\begin{enumerate} |
| 3506 |
\item \verb`total order` desired value of total order of differentiation; |
| 3507 |
may be (and generally is) empty. |
| 3508 |
\end{enumerate} |
| 3509 |
|
| 3510 |
\subsubsection{Spacing commands} |
| 3511 |
\begin{description} |
| 3512 |
\item [{\texttt{\textbackslash negmu}}] insert a $-1$ mu space |
| 3513 |
\item [{\texttt{\textbackslash nilmu}}] insert a $0$ mu space |
| 3514 |
\item [{\texttt{\textbackslash onemu}}] insert a $1$ mu space |
| 3515 |
\item [{\texttt{\textbackslash twomu}}] insert a $2$ mu space |
| 3516 |
\end{description} |
| 3517 |
From version 5.5 of \texttt{diffcoeff}, each of these commands can |
| 3518 |
be starred to produce a space of opposite sign but the same magnitude, |
| 3519 |
e.g. \verb`\twomu*` gives a space of \verb`-2 mu`. |
| 3520 |
|
| 3521 |
From version 5.5, \texttt{diffcoeff} also supports three commands |
| 3522 |
which switch on one of the \verb`spaced` package option values \emph{within |
| 3523 |
the current group}. |
| 3524 |
\begin{description} |
| 3525 |
\item [{\textbackslash\texttt{spacedone}}] is equivalent to \verb`spaced=1` |
| 3526 |
within the current group; |
| 3527 |
\item [{\texttt{\textbackslash spacednil}}] is equivalent to \verb`spaced=0` |
| 3528 |
within the current group; |
| 3529 |
\item [{\texttt{\textbackslash spacedneg}}] is equivalent to \verb`spaced=-1` |
| 3530 |
within the current group. |
| 3531 |
\end{description} |
| 3532 |
|
| 3533 |
\subsection{Variant-form-derived commands} |
| 3534 |
|
| 3535 |
Definitions in terms of variant forms of derivative: |
| 3536 |
\begin{description} |
| 3537 |
\item [{\texttt{\textbackslash difsfrac}}] split-level inline fraction, |
| 3538 |
§\ref{par:variant-sfrac-analogue}, |
| 3539 |
\item [{\texttt{\textbackslash difccp}}] doubly compact derivative, §\ref{par:Doubly-compact-forms}, |
| 3540 |
\item [{\texttt{\textbackslash Braket}}] bra-ket command (as used in quantum |
| 3541 |
mechanics), §\ref{subsec:Other-notations}, |
| 3542 |
\item [{\texttt{\textbackslash dlp}}] partial derivative differential, |
| 3543 |
§\ref{subsec:Variant-differentials}, |
| 3544 |
\item [{\texttt{\textbackslash dn}}] superscripted-`d' differential, |
| 3545 |
§\ref{subsec:Variant-differentials}. |
| 3546 |
\end{description} |
| 3547 |
All save the last can be found in the file \texttt{diffcoeff5.def}, |
| 3548 |
§\ref{sec:The-file-diffcoeff5.def}. |
| 3549 |
|
| 3550 |
\section{Templates} |
| 3551 |
|
| 3552 |
The following lists record the default values of the templates used |
| 3553 |
by \texttt{diffcoeff}. For templates other than \verb`DIF`, only |
| 3554 |
\emph{relevant }keys have been listed -- those which affect the appearance |
| 3555 |
of the derivative (or jacobian or differential). |
| 3556 |
|
| 3557 |
\subsection{\texttt{DIF} (primogenitor)} |
| 3558 |
\begin{verbatim} |
| 3559 |
style = frac, |
| 3560 |
slash-tok = /, |
| 3561 |
slash-sep = 0 mu, |
| 3562 |
sfrac-scaling = 0.7, |
| 3563 |
derivand-sep = 3 mu plus 1 mu minus 2 mu, |
| 3564 |
op-symbol = \mathrm{d}, |
| 3565 |
op-symbol-alt = \KeyValue{ op-symbol }, |
| 3566 |
op-order-nudge = 0 mu, |
| 3567 |
op-sub-nudge = 0 mu, |
| 3568 |
var-sup-nudge = 1 mu, |
| 3569 |
multi-term-sep = 2 mu plus 1 mu minus 1 mu, |
| 3570 |
term-sep-adjust = -1 mu, |
| 3571 |
dots = \cdots, |
| 3572 |
long-var-wrap = d(v), |
| 3573 |
lvwrap-Ldelim = \mleft (, |
| 3574 |
lvwrap-Rdelim = \mright ), |
| 3575 |
lvwrap-sup-nudge = -2 mu, |
| 3576 |
outer-Ldelim = \left (, |
| 3577 |
outer-Rdelim = \right ), |
| 3578 |
elbowroom = 0 mu, |
| 3579 |
sub-nudge = -5 mu, |
| 3580 |
difcc-var-ord = ^{#1}, |
| 3581 |
*derivand-sep = \KeyValue{ derivand-sep }, |
| 3582 |
*op-set-left = false, |
| 3583 |
*italic-nudge = 0 mu, |
| 3584 |
*inner-wrap = false, |
| 3585 |
*inner-Ldelim = (, |
| 3586 |
*inner-Rdelim = ), |
| 3587 |
*outer-Ldelim = \big [, |
| 3588 |
*outer-Rdelim = \big ], |
| 3589 |
*sub-nudge = 0 mu |
| 3590 |
\end{verbatim} |
| 3591 |
|
| 3592 |
\subsection{\texttt{DIFF} (upright-fraction derivative)} |
| 3593 |
|
| 3594 |
\label{subsec:DIFF-(upright-fraction-derivative)}Relevant keys and |
| 3595 |
default values for template \verb`DIFF` (all values correspond to |
| 3596 |
the defaults in \verb`DIF`): |
| 3597 |
\begin{verbatim} |
| 3598 |
style = frac, |
| 3599 |
derivand-sep = 3 mu plus 1 mu minus 2 mu, |
| 3600 |
op-symbol = \mathrm{d}, |
| 3601 |
op-symbol-alt = \KeyValue { op-symbol }, |
| 3602 |
op-order-nudge = 0 mu, |
| 3603 |
var-sup-nudge = 1 mu, |
| 3604 |
multi-term-sep = 2 mu plus 1 mu minus 1 mu, |
| 3605 |
term-sep-adjust = -1 mu, |
| 3606 |
dots = \cdots, |
| 3607 |
long-var-wrap = d(v), |
| 3608 |
lvwrap-Ldelim = \mleft (, |
| 3609 |
lvwrap-Rdelim = \mright ), |
| 3610 |
lvwrap-sup-nudge = -2 mu, |
| 3611 |
outer-Ldelim = \left (, |
| 3612 |
outer-Rdelim = \right ), |
| 3613 |
elbowroom = 0 mu, |
| 3614 |
sub-nudge = -5 mu, |
| 3615 |
*derivand-sep = \KeyValue { derivand-sep }, |
| 3616 |
*op-set-left = false, |
| 3617 |
*italic-nudge = 0 mu |
| 3618 |
\end{verbatim} |
| 3619 |
|
| 3620 |
\subsubsection{\texttt{DIFFP}} |
| 3621 |
|
| 3622 |
\verb`DIFF` defaults as above with the following changes (a marginal |
| 3623 |
\verb`>>` indicates where a setting differs from that in \verb`DIFF`): |
| 3624 |
\begin{verbatim} |
| 3625 |
>> op-symbol = \partial, |
| 3626 |
>> op-order-nudge = 1 mu, |
| 3627 |
>> *italic-nudge = 3 mu |
| 3628 |
\end{verbatim} |
| 3629 |
|
| 3630 |
\subsection{\texttt{DIFS} (slash-fraction derivative)} |
| 3631 |
|
| 3632 |
\label{subsec:DIFS-(slash-fraction-derivative)}Relevant keys and |
| 3633 |
default values for template \verb`DIFS` (a marginal \verb`>` indicates |
| 3634 |
where a setting differs from that in \verb`DIF`): |
| 3635 |
\begin{verbatim} |
| 3636 |
> style = /, |
| 3637 |
slash-tok = /, |
| 3638 |
slash-sep = 0 mu, |
| 3639 |
sfrac-scaling = 0.7, |
| 3640 |
> derivand-sep = 2 mu plus 1 mu minus 1 mu, |
| 3641 |
op-symbol = \mathrm{d}, |
| 3642 |
op-symbol-alt = \KeyValue { op-symbol }, |
| 3643 |
op-order-nudge = 0 mu, |
| 3644 |
var-sup-nudge = 1 mu, |
| 3645 |
multi-term-sep = 2 mu plus 1 mu minus 1 mu, |
| 3646 |
term-sep-adjust = -1 mu, |
| 3647 |
> dots = \ldots, |
| 3648 |
long-var-wrap = d(v), |
| 3649 |
lvwrap-Ldelim = \mleft (, |
| 3650 |
lvwrap-Rdelim = \mright ), |
| 3651 |
lvwrap-sup-nudge = -2 mu, |
| 3652 |
> outer-Ldelim = (, |
| 3653 |
> outer-Rdelim = ), |
| 3654 |
elbowroom = 0 mu, |
| 3655 |
> sub-nudge = 0 mu, |
| 3656 |
*derivand-sep = \KeyValue { derivand-sep }, |
| 3657 |
> *inner-wrap = true, |
| 3658 |
*inner-Ldelim = (, |
| 3659 |
*inner-Rdelim = ), |
| 3660 |
*outer-Ldelim = \big [, |
| 3661 |
*outer-Rdelim = \big ], |
| 3662 |
*sub-nudge = 0 mu |
| 3663 |
\end{verbatim} |
| 3664 |
|
| 3665 |
\subsubsection{\texttt{DIFSP}} |
| 3666 |
|
| 3667 |
\verb`DIFS` defaults as above with the following changes (a marginal |
| 3668 |
\verb`>>` indicates where a setting differs from that in \verb`DIFS`): |
| 3669 |
\begin{verbatim} |
| 3670 |
>> op-symbol = \partial, |
| 3671 |
>> op-order-nudge = 1 mu |
| 3672 |
\end{verbatim} |
| 3673 |
|
| 3674 |
\subsection{\texttt{DIFC} (compact derivative)} |
| 3675 |
|
| 3676 |
\label{subsec:DIFC-(compact-derivative)}Relevant keys and default |
| 3677 |
values for template \verb`DIFC` (a marginal \verb`>` indicates where |
| 3678 |
a setting differs from that in \verb`DIF`): |
| 3679 |
\begin{verbatim} |
| 3680 |
> style = _ , |
| 3681 |
> derivand-sep = 1 mu plus 1 mu minus 1 mu, |
| 3682 |
op-symbol = \mathrm{d}, |
| 3683 |
op-order-nudge = 0 mu, |
| 3684 |
op-sub-nudge = 0 mu, |
| 3685 |
> multi-term-sep = 1 mu, |
| 3686 |
> term-sep-adjust = 0 mu, |
| 3687 |
> dots = \ldots, |
| 3688 |
> outer-Ldelim = \bigl (, |
| 3689 |
> outer-Rdelim = \bigr ), |
| 3690 |
elbowroom = 0 mu, |
| 3691 |
> sub-nudge = -2 mu, |
| 3692 |
*derivand-sep = \KeyValue { derivand-sep } |
| 3693 |
\end{verbatim} |
| 3694 |
|
| 3695 |
\subsubsection{\texttt{DIFCP}} |
| 3696 |
|
| 3697 |
\verb`DIFC` defaults as above with these changes (a marginal \verb`>>` |
| 3698 |
indicates where a setting differs from that in \verb`DIFC`): |
| 3699 |
\begin{verbatim} |
| 3700 |
>> op-symbol = \partial, |
| 3701 |
>> op-order-nudge = 1 mu |
| 3702 |
\end{verbatim} |
| 3703 |
|
| 3704 |
\subsection{\texttt{DIFL} (differential)} |
| 3705 |
|
| 3706 |
\label{subsec:DIFL-(differential)}Relevant keys and default values |
| 3707 |
for template \verb`DIFL` (a marginal \verb`>` indicates where a |
| 3708 |
setting differs from that in \verb`DIF`): |
| 3709 |
\begin{verbatim} |
| 3710 |
op-symbol = \mathrm{d}, |
| 3711 |
op-order-nudge = 0 mu, |
| 3712 |
var-sup-nudge = 1 mu, |
| 3713 |
multi-term-sep = 2 mu plus 1 mu minus 1 mu, |
| 3714 |
term-sep-adjust = -1 mu, |
| 3715 |
> long-var-wrap = dv, |
| 3716 |
lvwrap-Ldelim = \mleft (, |
| 3717 |
lvwrap-Rdelim = \mright ), |
| 3718 |
lvwrap-sup-nudge = -2 mu, |
| 3719 |
> outer-Ldelim = \, , |
| 3720 |
> outer-Rdelim = , |
| 3721 |
elbowroom = 0 mu |
| 3722 |
\end{verbatim} |
| 3723 |
|
| 3724 |
\subsection{\texttt{DIFJ} (jacobian)} |
| 3725 |
|
| 3726 |
\label{subsec:DIFJ-(jacobian)}Relevant keys and default values for |
| 3727 |
template \verb`DIFJ` (a marginal \verb`>` indicates where a setting |
| 3728 |
differs from that in \verb`DIF`): |
| 3729 |
\begin{verbatim} |
| 3730 |
style = frac, |
| 3731 |
slash-tok = /, |
| 3732 |
slash-sep = 0 mu, |
| 3733 |
sfrac-scaling = 0.7, |
| 3734 |
> op-symbol = \partial, |
| 3735 |
op-symbol-alt = \KeyValue{ op-symbol }, |
| 3736 |
lvwrap-Ldelim = \mleft (, |
| 3737 |
lvwrap-Rdelim = \mright ), |
| 3738 |
> outer-Ldelim = , |
| 3739 |
> outer-Rdelim = , |
| 3740 |
elbowroom = 0 mu , |
| 3741 |
*op-set-left = false, |
| 3742 |
*italic-nudge = 0 mu |
| 3743 |
\end{verbatim} |
| 3744 |
|
| 3745 |
\section{The file \texttt{diffcoeff5.def}} |
| 3746 |
|
| 3747 |
\label{sec:The-file-diffcoeff5.def} |
| 3748 |
\begin{verbatim} |
| 3749 |
% file `diffcoeff5.def' |
| 3750 |
% definitions for variant forms |
| 3751 |
% 2025/10/01 |
| 3752 |
% Andrew Parsloe [email protected] |
| 3753 |
% |
| 3754 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3755 |
% material derivative |
| 3756 |
\difdef { f, s } { D } |
| 3757 |
{ op-symbol = \mathrm{D} } |
| 3758 |
% math italic |
| 3759 |
\difdef { f, s, c } { d' } |
| 3760 |
{ |
| 3761 |
op-symbol = d, |
| 3762 |
op-order-nudge = 1 mu, |
| 3763 |
*slash-sep = { 0 mu, -1 mu } |
| 3764 |
} |
| 3765 |
\difdef { f, s, c } { D' } |
| 3766 |
{ |
| 3767 |
op-symbol = D, |
| 3768 |
op-order-nudge = 1 mu, |
| 3769 |
*slash-sep = -1 mu |
| 3770 |
} |
| 3771 |
% Greek |
| 3772 |
\difdef { f, s } { gd } |
| 3773 |
{ op-symbol = \delta } |
| 3774 |
\difdef { f, s } { gD } |
| 3775 |
{ op-symbol = \Delta } |
| 3776 |
% nabla, tensor calc. acceleration |
| 3777 |
\difdef { f, s } { n } |
| 3778 |
{ |
| 3779 |
op-symbol = \nabla, |
| 3780 |
op-symbol-alt = \mathrm{d}, |
| 3781 |
*slash-sep = { -2mu, 0mu } |
| 3782 |
} |
| 3783 |
% tfrac, nonscalable |
| 3784 |
\difdef { f, fp } { t } |
| 3785 |
{ |
| 3786 |
style = tfrac , |
| 3787 |
derivand-sep = 1 mu plus 1 mu minus 1 mu, |
| 3788 |
multi-term-sep = 0 mu , |
| 3789 |
term-sep-adjust = 0 mu , |
| 3790 |
lvwrap-sup-nudge = 0 mu , |
| 3791 |
outer-Ldelim = \bigl (, |
| 3792 |
outer-Rdelim = \bigr ), |
| 3793 |
elbowroom = -2 mu , |
| 3794 |
sub-nudge = -3 mu |
| 3795 |
} |
| 3796 |
% pt of eval., sq. bracket |
| 3797 |
\difdef { f, fp, s, sp } { ] } |
| 3798 |
{ |
| 3799 |
outer-Ldelim = \left [ , |
| 3800 |
outer-Rdelim = \right ], |
| 3801 |
elbowroom = 1 mu, |
| 3802 |
sub-nudge = 0 mu |
| 3803 |
} |
| 3804 |
% long var wrap |
| 3805 |
\difdef { f, fp } { (dv) } |
| 3806 |
{ long-var-wrap = (dv) } |
| 3807 |
\difdef { f, fp } { dv } |
| 3808 |
{ long-var-wrap = dv } |
| 3809 |
\difdef { f, fp } { dv_ } |
| 3810 |
{ |
| 3811 |
long-var-wrap = dv, |
| 3812 |
var-sup-nudge = -2 mu |
| 3813 |
} |
| 3814 |
%%%%%%%%%% slash fraction %%%%%%%%%% |
| 3815 |
% sfrac split-level |
| 3816 |
\difdef { s, sp } { s } |
| 3817 |
{ |
| 3818 |
style = sfrac, |
| 3819 |
slash-sep = { -2 mu, -1 mu }, |
| 3820 |
derivand-sep = 0 mu , |
| 3821 |
multi-term-sep = 0 mu , |
| 3822 |
term-sep-adjust = 0 mu , |
| 3823 |
var-sup-nudge = 0 mu , |
| 3824 |
lvwrap-sup-nudge = 0 mu |
| 3825 |
} |
| 3826 |
\difdef { s } { s } { *slash-sep = { -1 mu, -1 mu } } |
| 3827 |
% sfrac, no op symbols |
| 3828 |
\NewDocumentCommand \difsfrac { O{-2mu,-1mu} m m } |
| 3829 |
{{ |
| 3830 |
\difdef { s } { s } { op-symbol=, slash-sep={#1} } |
| 3831 |
\difs.s.{#2}{#3} |
| 3832 |
}} |
| 3833 |
% \NewDocumentCommand \difsfrac { D[,{-2} D-]{1} m m } |
| 3834 |
% {{ |
| 3835 |
% \difdef{s}{s}{op-symbol=,slash-sep={#1mu,-#2mu} } |
| 3836 |
% \difs.s.{#3}{#4} |
| 3837 |
% }} |
| 3838 |
% slash frac: 0=scalable, 1=big, |
| 3839 |
% % 2=Big, 3=bigg, 4=Bigg but > 1 |
| 3840 |
% generally gives eyesores |
| 3841 |
\difdef { s, sp } { 0 } |
| 3842 |
{ |
| 3843 |
style = auto , |
| 3844 |
outer-Ldelim = \left [ , |
| 3845 |
outer-Rdelim = \right ] , |
| 3846 |
sub-nudge = 0 mu , |
| 3847 |
*inner-Ldelim = \mleft ( , |
| 3848 |
*inner-Rdelim = \mright ), |
| 3849 |
*outer-Ldelim = \left [ , |
| 3850 |
*outer-Rdelim = \right ] |
| 3851 |
} |
| 3852 |
\difdef { s, sp } { 1 } |
| 3853 |
{ |
| 3854 |
style = big , |
| 3855 |
outer-Ldelim = \bigl (, |
| 3856 |
outer-Rdelim = \bigr ), |
| 3857 |
sub-nudge = -2 mu , |
| 3858 |
*inner-wrap = true , |
| 3859 |
*inner-Ldelim = \bigl (, |
| 3860 |
*inner-Rdelim = \bigr ), |
| 3861 |
*outer-Ldelim = \bigl [, |
| 3862 |
*outer-Rdelim = \bigr ] |
| 3863 |
} |
| 3864 |
% \cdots generic slash fraction |
| 3865 |
\difdef { s, sp } { cd } { dots = \cdots } |
| 3866 |
% pt of eval -- pipe |
| 3867 |
\difdef { f, fp, s, sp } { | } |
| 3868 |
{ |
| 3869 |
outer-Ldelim = \left . , |
| 3870 |
outer-Rdelim = \right |, |
| 3871 |
sub-nudge = 0 mu |
| 3872 |
} |
| 3873 |
%%%%%%%%%% compact %%%%%%%%%% |
| 3874 |
% D operator |
| 3875 |
\difdef { c } { D } |
| 3876 |
{ |
| 3877 |
op-symbol = \mathrm{D}, |
| 3878 |
op-sub-nudge = -2 mu |
| 3879 |
} |
| 3880 |
\difdef { c } { D' } |
| 3881 |
{ |
| 3882 |
op-symbol = D, |
| 3883 |
op-sub-nudge = -2 mu |
| 3884 |
} |
| 3885 |
% bold |
| 3886 |
\difdef { c } { bD } |
| 3887 |
{ |
| 3888 |
op-symbol = \mathbf{D}, |
| 3889 |
op-sub-nudge = -2 mu |
| 3890 |
} |
| 3891 |
% differential style |
| 3892 |
\difdef { c, cp } { dl } |
| 3893 |
{ |
| 3894 |
style = dl, |
| 3895 |
multi-term-sep = 1 mu, |
| 3896 |
term-sep-adjust = -1 mu |
| 3897 |
} |
| 3898 |
% attach superscript to the d |
| 3899 |
\difdef { c, cp } { d^ } |
| 3900 |
{ |
| 3901 |
style = d^, |
| 3902 |
multi-term-sep = 1 mu, |
| 3903 |
term-sep-adjust = -1 mu |
| 3904 |
} |
| 3905 |
% doubly compact |
| 3906 |
\difdef { cp } { cc } |
| 3907 |
{ |
| 3908 |
style = cc , |
| 3909 |
op-order-nudge = 1 mu, |
| 3910 |
multi-term-sep = 0 mu, |
| 3911 |
term-sep-adjust = -1 mu, |
| 3912 |
var-sup-nudge = 0 mu |
| 3913 |
} |
| 3914 |
% \difdef { cp } { cc } { difcc-var-ord = ##1 } |
| 3915 |
% \difdef { cp } { cc } { difcc-var-ord = :##1 } |
| 3916 |
% \difdef { cp } { cc } { difcc-var-ord = \mathbf{##1} } |
| 3917 |
\NewDocumentCommand \difccp { s s O{1}} |
| 3918 |
{ |
| 3919 |
\IfBooleanTF #1 |
| 3920 |
{ \difcp.cc.**[#3]<1> } |
| 3921 |
{ \difcp.cc.[#3]<1> } |
| 3922 |
} |
| 3923 |
%%%%%%%%%% differentials %%%%%%%%%% |
| 3924 |
% partial |
| 3925 |
\difdef { l } { p } { op-symbol = \partial } |
| 3926 |
\NewDocumentCommand \dlp {} { \dl.p. } |
| 3927 |
% bold variable |
| 3928 |
\difdef { l } { b } |
| 3929 |
{ op-symbol = \mathrm{d}\mathbf } |
| 3930 |
% d^n x |
| 3931 |
\difdef { l } { dn }{ style = d^ } |
| 3932 |
% line element: Pythagoras |
| 3933 |
\difdef { l } { + } |
| 3934 |
{ |
| 3935 |
multi-term-sep = 0 mu +, |
| 3936 |
term-sep-adjust = 0 mu , |
| 3937 |
outer-Ldelim = |
| 3938 |
} |
| 3939 |
% line element: Minkowski |
| 3940 |
\difdef { l } { - } |
| 3941 |
{ |
| 3942 |
multi-term-sep = 0 mu -, |
| 3943 |
term-sep-adjust = 0 mu , |
| 3944 |
outer-Ldelim = |
| 3945 |
} |
| 3946 |
%%%%%%%%%% jacobian %%%%%%%%%% |
| 3947 |
% slash fraction |
| 3948 |
\difdef { j } { / } { style = / } |
| 3949 |
% split level |
| 3950 |
\difdef { j } { s } { style = sfrac } |
| 3951 |
%%%%%%%%%% \Braket %%%%%%%%%% |
| 3952 |
\difdef{ s }{ bk } |
| 3953 |
{ |
| 3954 |
slash-tok = , |
| 3955 |
op-symbol = , |
| 3956 |
multi-term-sep = 3mu\middle|\mskip3mu , |
| 3957 |
outer-Ldelim=\left\langle , |
| 3958 |
outer-Rdelim=\right\rangle |
| 3959 |
} |
| 3960 |
\NewDocumentCommand \Braket { m } |
| 3961 |
{ \difs.bk.<\negmu>{}{#1}[] } |
| 3962 |
\end{verbatim} |
| 3963 |
|
| 3964 |
\section{Preamble definitions} |
| 3965 |
|
| 3966 |
\label{sec:Preamble-definitions}The preamble to the present document |
| 3967 |
contains the command |
| 3968 |
\begin{verbatim} |
| 3969 |
\usepackage[def-file=<path to>/diffcoeff5,% |
| 3970 |
spaced=-1]{diffcoeff} |
| 3971 |
\end{verbatim} |
| 3972 |
where \verb`<path to>` is the path on my computer (beginning \verb`E:/`), |
| 3973 |
and definitions: |
| 3974 |
\begin{verbatim} |
| 3975 |
% no sub nudge (a sea of white space) |
| 3976 |
\difdef { f, fp } { wsp } |
| 3977 |
{ sub-nudge = 0 mu } |
| 3978 |
% align op left; no italic nudge |
| 3979 |
\difdef { f,fp } { left0 } |
| 3980 |
{ |
| 3981 |
*op-set-left = true, |
| 3982 |
*italic-nudge = 0 mu |
| 3983 |
} |
| 3984 |
% align op left; italic nudge |
| 3985 |
\difdef { f,fp } { left } |
| 3986 |
{ *op-set-left = true } |
| 3987 |
% partial variant of \diff |
| 3988 |
\difdef { f } { p } |
| 3989 |
{ |
| 3990 |
op-symbol = \partial, |
| 3991 |
op-order-nudge = 1 mu |
| 3992 |
} |
| 3993 |
% partial, 3mu sep of terms |
| 3994 |
\difdef { fp, sp } { 3mu } |
| 3995 |
{ multi-term-sep = 3 mu } |
| 3996 |
% partial, compact, -2 mu subscr. var. adjustment |
| 3997 |
\difdef { cp } { 2 } { term-sep-adjust = -2 mu } |
| 3998 |
% partial, use \ldots |
| 3999 |
\difdef { fp } { ld } { dots = \!\ldots } |
| 4000 |
% differential d^n x |
| 4001 |
\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 } |
| 4002 |
% D jacobian |
| 4003 |
\difdef { j } { D } |
| 4004 |
{ op-symbol = D } |
| 4005 |
% square bracket jabobian |
| 4006 |
\difdef { j } { [ } |
| 4007 |
{ |
| 4008 |
lvwrap-Ldelim = \onemu\mleft [, |
| 4009 |
lvwrap-Rdelim = \mright ] |
| 4010 |
} |
| 4011 |
\end{verbatim} |
| 4012 |
|
| 4013 |
\section{Version history} |
| 4014 |
|
| 4015 |
Version 5 was conceived as a new package (under the name \verb`diffcoefx`) |
| 4016 |
and only at the end, after discussion with CTAN maintainers, changed |
| 4017 |
to version 5.0 of \texttt{diffcoeff}. |
| 4018 |
\begin{enumerate} |
| 4019 |
\item Version 5.0 (2023-01-02) of \texttt{diffcoeff} |
| 4020 |
\begin{enumerate} |
| 4021 |
\item splits the \verb`\diff` command of version 4 into three pairs of |
| 4022 |
commands: \verb`\diff` and \verb`\diffp` for upright-fraction derivatives; |
| 4023 |
\verb`\difs` and \verb`difsp` for slash-fraction derivatives, and |
| 4024 |
\verb`\difc` and \verb`\difcp` for `compact form' derivatives; |
| 4025 |
\item replaces the order-override option by a new command \verb`\difoverride` |
| 4026 |
(to avoid cluttering formulas with a second square-bracket delimited |
| 4027 |
optional argument before the differentiand); |
| 4028 |
\item adds a second star option to reverse the order of differentiand and |
| 4029 |
variable(s) of differentiation when the differentiand is appended; |
| 4030 |
\item replaces the two-argument \verb`\diffdef` command of earlier versions |
| 4031 |
with the three-argument command \verb`\difdef` command, the additional |
| 4032 |
argument determining which one or more of the \verb`f`, \verb`s`, |
| 4033 |
\verb`c`, \verb`fp`, \verb`sp` or \verb`cp` forms the defined |
| 4034 |
variant applies to; |
| 4035 |
\item rewrites the differential command \verb`\dl` which is now template-configurable |
| 4036 |
(e.g. allowing easy writing of line elements like $\dl.+.{x,y,z}^{2}$); |
| 4037 |
\item rewrites the jacobian command \verb`\jacob` which is now template-configurable; |
| 4038 |
\item uses ISO defaults; |
| 4039 |
\item includes version conflict messages. |
| 4040 |
\end{enumerate} |
| 4041 |
\item Version 5.1 (2023-01-16) |
| 4042 |
\begin{enumerate} |
| 4043 |
\item adds a now-redundant \verb`ISO` package option and related version |
| 4044 |
conflict message; |
| 4045 |
\item makes some corresponding tweaks to documentation (including this version |
| 4046 |
5 history). |
| 4047 |
\end{enumerate} |
| 4048 |
\item Version 5.2 (2023-01-24) |
| 4049 |
\begin{enumerate} |
| 4050 |
\item Simplifies the treatment of the empty argument of an absent differentiation |
| 4051 |
variable; |
| 4052 |
\item initializes (clears) two sequence variables that otherwise caused |
| 4053 |
error when \verb`scrbook` class was used; |
| 4054 |
\item amends documentation. |
| 4055 |
\end{enumerate} |
| 4056 |
\item Version 5.3 (2023-04-10) |
| 4057 |
\begin{enumerate} |
| 4058 |
\item Fixes a bug when \verb`\dl` was used in a particular way in \texttt{beamer} |
| 4059 |
(e.g. \verb`\[\alert{\dl x}\]`). |
| 4060 |
\item Provides an alternative method of specifying orders of differentiation |
| 4061 |
by means of colon separators in the variable argument. |
| 4062 |
\item Reinstates (from v.4) the order-override option as an alternative |
| 4063 |
to \verb`\difoverride` but now angle-bracket delimited. |
| 4064 |
\end{enumerate} |
| 4065 |
\item Version 5.4 (2023-11-08) |
| 4066 |
\begin{enumerate} |
| 4067 |
\item Adjusts both code and documentation about the differential to enable |
| 4068 |
forms like $\!\dn3x$ (sometimes used in multiple integrals). |
| 4069 |
\end{enumerate} |
| 4070 |
\item Version 5.5 (2025-10-01) |
| 4071 |
\begin{enumerate} |
| 4072 |
\item Adds the ability to write a generic mixed partial derivative (e.g. |
| 4073 |
$\difsp<n>y{x_{1},...,x_{n}}$) in $n$ variables in a natural way |
| 4074 |
by entering 3 dots between commas in the variable list; adds an associated |
| 4075 |
key \verb`dots`. |
| 4076 |
\item Adds the option of a split-level slash-fraction form derivative (like |
| 4077 |
\verb`\sfrac` of the \verb`xfrac` package), an associated key \verb`sfrac-scaling`, |
| 4078 |
and an adjustment to the key \verb`slash-sep`. |
| 4079 |
\item Adds the option of a `doubly compact' form of compact derivative |
| 4080 |
and an associated key \verb`difcc-var-ord`. |
| 4081 |
\item Adds the key \verb`op-sub-nudge` to adjust the position of the subscript |
| 4082 |
in a compact form derivative (e.g. for an operator like \verb`\nabla`). |
| 4083 |
\item Adds a package option \verb`dif**` making permanent the double star |
| 4084 |
option (reversing the order of the derivand and differentiation variable(s) |
| 4085 |
arguments) for specified derivatives (like \verb`\difc`, \verb`\difcp`). |
| 4086 |
\item Fixes a bug when using colon notation to indicate an order of differentiation |
| 4087 |
when either the variable or the order is multi-character. |
| 4088 |
\item Adds to the documentation and corrects a few typos. |
| 4089 |
\end{enumerate} |
| 4090 |
\item Version 5.6 (2025-12-10) |
| 4091 |
\begin{enumerate} |
| 4092 |
\item Resolves an error arising if version 5.5 is used at the same time |
| 4093 |
as a package still using \texttt{xtemplate}. |
| 4094 |
\end{enumerate} |
| 4095 |
\end{enumerate} |
| 4096 |
|
| 4097 |
\end{document} |