I would invision two commands \deriv and \Deriv. The \deriv would be a
partial and the \Deriv would be the full derivative (d/dt). Arguments
would be based like the \frac command in that there would always be
two, one for the numerator and one for the denominator. But within the
denomenator I would like the capacity for any number of independent
variables. The number and order of the independent variables would
then dictate the order of the full or partial derivative. For example,
\deriv{u}{{x}{t}} => \frac{\partial^2 u}{\partial x\partial t}
\deriv{u}{{x}{t}} => \frac{\partial^2 u}{\partial x\partial t}
\Deriv{x}{{y^2}{z}} => \frac{d^3 x}{dy^2dz}
\deriv{x}{z} => \frac{\partial x}{\partial z}
Is this possible?
--
Steve...
ALTER, STEPHEN J S.J....@LaRC.NASA.GOV
Mail Stop 408A LOCKHEED MARTIN ENGINEERING & SCIENCES
16 Victory Street Assigned to Gas Dynamics Division
NASA Langley Research Center Building 1251, Room 221D
Hampton, VA 23681-0001 Phone +1 (757) 864-7771
WWW URL -> http://abweb.larc.nasa.gov:8080/~salter/ Fax +1 (757) 864-8670
This is what I use for derivatives.
% derivatives
\newcommand{\deriv}[2]{\frac{\mbox{d}#1}{\mbox{d}#2}}
\newcommand{\parderiv}[2]{\frac{\partial#1}{\partial#2}}
\newcommand{\nderiv}[3]{\frac{\mbox{d}^{#3}#1}{\mbox{d}#2^{#3}}}
\newcommand{\nparderiv}[3]{\frac{\partial^{#3}\!#1}{\partial#2^{#3}}}
Stephen J. Alter wrote:
--
Alwin Wiederhold
Nuclear Analyses, Eskom
alwin.wi...@eskom.co.za
"Have no fear for Atomic Energy" - Bob Marley
\newcommand{\de}{\mathrm{d}}
% Makro fuer Differentiale
%
% #1 ordnung (optional)
% #2 funktion die differenziert wird
% #3 variable nach der differenziert wird
\newcommand*\diff[3][{}]{\frac{\de{}^{#1} #2}{\de #3^{#1}}}
\newcommand*\pdiff[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
h.f.s.
--
Hans Friedrich Steffani
Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz
mailto:hans.s...@e-technik.tu-chemnitz.de
http://www.tu-chemnitz.de/~hfst/
No, because of the line I've quoted.
(Yeah yeah, you could hack into superscripting to handle this
simple case, but not in general.)
(That notation of "y^2" is very misleading/wrong: it suggests
d/d(y^2), i.e., (1/2y) d/dy .)
Donald Arseneau as...@triumf.ca
Here are some macros I use. "Fd" is full derivative, "Pd" partial derivative.
\newcommand{\Fd}[3][]{\frac{d^{#1} #2}{d {#3}^{#1}}}
\newcommand{\fd}[3][]{d^{#1} #2/d {#3}^{#1}}
\newcommand{\Pd}[3][]{\frac{\partial^{#1} #2}{\partial {#3}^{#1}}}
\newcommand{\Pdt}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}}
\newcommand{\pd}[3][]{\partial^{#1} #2/\partial {#3}^{#1}}
\newcommand{\pdt}[3]{\partial^2 #1/\partial #2\partial #3}
It doesn't quite cover everything you asked for, but should give you a
starting point.
Andrew
--
Andrew Swann A.F....@maths.bath.ac.uk
Department of Mathematical Sciences Dept. Office +44 1225 826989
University of Bath, Claverton Down, Fax +44 1225 826492
Bath BA2 7AY, England http://www.bath.ac.uk/~masafs/home.html
i agree, but all my partial differential equations books use it.
are you suggesting that we start a new convention?
--
bil <mailto:w.l....@larc.nasa.gov>
> In article <374048AB...@larc.nasa.gov>, "Stephen J. Alter" <s.j....@larc.nasa.gov> writes...
> >\Deriv{x}{{y^2}{z}} => \frac{d^3 x}{dy^2dz}
> >
> >Is this possible?
>
> No, because of the line I've quoted.
>
> (Yeah yeah, you could hack into superscripting to handle this
> simple case, but not in general.)
>
> (That notation of "y^2" is very misleading/wrong: it suggests
> d/d(y^2), i.e., (1/2y) d/dy .)
>
> Donald Arseneau as...@triumf.ca
I understand the confusion, but this is the standard notation for
partial and full derivatives AFAIK. All text books that I have used,
have this notation for derivatives. I think the culprit for confusion
stems from laziness. In reality, the derivative should probably be
written as
d u^3
--------
(dx)^2 dy
however with the shorthand convention (dx)^2 is written simply
as dx^2 -- note this shorthand is only seen in the denominator.
> In article <374048AB...@larc.nasa.gov>, "Stephen J. Alter" <s.j....@larc.nasa.gov> writes...
> >\Deriv{x}{{y^2}{z}} => \frac{d^3 x}{dy^2dz}
> >
> >Is this possible?
>
> No, because of the line I've quoted.
>
> (Yeah yeah, you could hack into superscripting to handle this
> simple case, but not in general.)
>
> (That notation of "y^2" is very misleading/wrong: it suggests
> d/d(y^2), i.e., (1/2y) d/dy .)
>
> Donald Arseneau as...@triumf.ca
Let me rephrase and simplify my question. I'd like help designing
a command such as \pderiv which accepted arguments for the numerator and
denominator of a partial derivative, e.g.,
\pderiv{u}{{x^2}{y}}
produces
\frac{\partial^3 u}{\partial x^2\partial y}
i.e., it sums the exponents in the denominator and uses
the result in the numerator. can anyone point me to some
similar code that I might adapt? From this I would like to
make \fderiv which would apply to full derivatives.
> Let me rephrase and simplify my question. I'd like help designing
> a command such as \pderiv which accepted arguments for the numerator and
> denominator of a partial derivative, e.g.,
>
> \pderiv{u}{{x^2}{y}}
>
> produces
>
> \frac{\partial^3 u}{\partial x^2\partial y}
>
> i.e., it sums the exponents in the denominator and uses
> the result in the numerator. can anyone point me to some
> similar code that I might adapt? From this I would like to
> make \fderiv which would apply to full derivatives.
>
This does the full derivatives:
\def\Deriv #1#2{\begingroup
\toks0={}\count0=0
\degree #2\degree
\frac {d\ifnum\count0>1^{\the\count0 }\fi#1}{\the\toks0}%
\endgroup }
\def\degree #1{\ifx #1\degree \expandafter\stopd
\else \expandafter\addd \fi #1^1$#1\addd}
\def\stopd #1\addd{}
\def\addd #1^#2#3$#4\addd{\advance\count0 #2
\toks0=\expandafter{\the\toks0 {d#4}}\degree}
\documentclass{article}
\begin{document}
$$\Deriv {x}{{y}{z^2}{x^4}}$$
\end{document}
---
Peter Schmitt Peter....@ap.univie.ac.at
Institute of Mathematics Strudlhofgasse 4
Universit"at Wien A-1200 Wien, Austria
I'm not complaining about dy^2 (which means (d y)^2) but the
input format \deriv{z}{y^2}. I guess the notation dy^2 is an
argument for writing an italic d, to join it to the y better.
No big deal.
Donald Arseneau as...@triumf.ca
For my use, I wrote this macro a few days ago:
\makeatletter
\def\diff{\@ifstar{\diffstar}{\diffnostar}}
\def\diffstar{\@ifnextchar[{\@diffstar}{\@@diffstar}}
\def\@diffstar[#1]#2#3#4{\displaystyle{\left(\frac{\mathrm{d}^{#1}#2}{\mathrm{d}#3^{#1}}\right)_{\mkern-7mu#4}}}
\def\@@diffstar#1#2#3{\displaystyle\left({\frac{\mathrm{d}#1}{\mathrm{d}#2}}\right)_{\mkern-7mu#3}}
\def\diffnostar{\@ifnextchar[{\@diffnostar}{\@@diffnostar}}
\def\@diffnostar[#1]#2#3{\displaystyle{\frac{\mathrm{d}^{#1}#2}{\mathrm{d}#3^{#1}}}}
\def\@@diffnostar#1#2{\displaystyle{\frac{\mathrm{d}#1}{\mathrm{d}#2}}}
%*************Dérivée partielle***************
\def\diffp{\@ifstar{\diffpstar}{\diffpnostar}}
\def\diffpstar{\@ifnextchar[{\@diffpstar}{\@@diffpstar}}
\def\@diffpstar[#1]#2#3#4{\displaystyle{\left(\frac{\partial^{#1}#2}{\partial#3^{#1}}\right)_{\mkern-7mu#4}}}
\def\@@diffpstar#1#2#3{\displaystyle\left({\frac{\partial#1}{\partial#2}}\right)_{\mkern-7mu#3}}
\def\diffpnostar{\@ifnextchar[{\@diffpnostar}{\@@diffpnostar}}
\def\@diffpnostar[#1]#2#3{\displaystyle{\frac{\partial^{#1}#2}{\partial#3^{#1}}}}
\def\@@diffpnostar#1#2{\displaystyle{\frac{\partial#1}{\partial#2}}}
\makeatother
So \diff{f}{x} gives df/dx in displaymath style, \diff[n]{f}{x} gives
the nth derivative d^nf/dx^n, and the stared version allows me to
specify the point where the derivatives is calculated:
\diff*{f}{x}{a} gives (df/dx)_{x_0}, dans \diff*[n]{f}{x}{a} gives...
Also \diffp and \diffp*, with the same syntax, for the partial
derivative.
I don't use frequently partial derivatives according to different
variables.
PS : the \!\! to precise the position of the subscript is not "elegant",
I will change it using em units.
Of course, the "d" is in roman font...
Bye
*********************************************
* Envoyez vos zimels à *
* mailto:eddie.s...@wanadoo.fr *
* *
* Ma page maison : *
* http://perso.wanadoo.fr/eddie.saudrais *
*********************************************
[snip some great magic]
> PS : the \!\! to precise the position of the subscript is not "elegant",
Well, it sure serves me fine :-)
> Of course, the "d" is in roman font...
But, of course!
Eddie, I must thank you for sending out these macros, they're great and
precisely what I've missed for a long time now.
/Johann Gerell