Functions and Variables for Differentiation
===========================================

 -- Function: antid (EXPR, X, U(X))

     Returns a two-element list, such that an antiderivative of EXPR with respect to X can be constructed from the list.  The expression EXPR may contain an unknown function U and its derivatives.

     Let L, a list of two elements, be the return value of antid. Then L[1] + 'integrate (L[2], X) is an antiderivative of EXPR with respect to X.

     When antid succeeds entirely, the second element of the return value is zero. Otherwise, the second element is nonzero, and the first element is nonzero or zero. If antid cannot make any progress, the first element is zero and the second nonzero.

     load ("antid") loads this function.  The antid package also defines the functions nonzeroandfreeof and linear.

     antid is related to antidiff as follows. Let L, a list of two elements, be the return value of antid. Then the return value of antidiff is equal to L[1] + 'integrate (L[2], X) where X is the variable of integration.

     Examples:

          (%i1) load ("antid")$
          (%i2) expr: exp (z(x)) * diff (z(x), x) * y(x);
                                      z(x)  d
          (%o2)                y(x) %e     (-- (z(x)))
                                            dx
          (%i3) a1: antid (expr, x, z(x));
                                 z(x)      z(x)  d
          (%o3)          [y(x) %e    , - %e     (-- (y(x)))]
                                                 dx
          (%i4) a2: antidiff (expr, x, z(x));
                                      /
                               z(x)   [   z(x)  d
          (%o4)         y(x) %e     - I %e     (-- (y(x))) dx
                                      ]         dx
                                      /
          (%i5) a2 - (first (a1) + 'integrate (second (a1), x));
          (%o5)                           0
          (%i6) antid (expr, x, y(x));
                                       z(x)  d
          (%o6)             [0, y(x) %e     (-- (z(x)))]
                                             dx
          (%i7) antidiff (expr, x, y(x));
                            /
                            [        z(x)  d
          (%o7)             I y(x) %e     (-- (z(x))) dx
                            ]              dx
                            /

     Categories: Integral calculus

 -- Function: antidiff (EXPR, X, U(X))

     Returns an antiderivative of EXPR with respect to X. The expression EXPR may contain an unknown function U and its derivatives.

     When antidiff succeeds entirely, the resulting expression is free of integral signs (that is, free of the integrate noun). Otherwise, antidiff returns an expression which is partly or entirely within an integral sign. If antidiff cannot make any progress, the return value is entirely within an integral sign.

     load ("antid") loads this function. The antid package also defines the functions nonzeroandfreeof and linear.

     antidiff is related to antid as follows. Let L, a list of two elements, be the return value of antid. Then the return value of antidiff is equal to L[1] + 'integrate (L[2], X) where X is the variable of integration.

     Examples:

          (%i1) load ("antid")$
          (%i2) expr: exp (z(x)) * diff (z(x), x) * y(x);
                                      z(x)  d
          (%o2)                y(x) %e     (-- (z(x)))
                                            dx
          (%i3) a1: antid (expr, x, z(x));
                                 z(x)      z(x)  d
          (%o3)          [y(x) %e    , - %e     (-- (y(x)))]
                                                 dx
          (%i4) a2: antidiff (expr, x, z(x));
                                      /
                               z(x)   [   z(x)  d
          (%o4)         y(x) %e     - I %e     (-- (y(x))) dx
                                      ]         dx
                                      /
          (%i5) a2 - (first (a1) + 'integrate (second (a1), x));
          (%o5)                           0
          (%i6) antid (expr, x, y(x));
                                       z(x)  d
          (%o6)             [0, y(x) %e     (-- (z(x)))]
                                             dx
          (%i7) antidiff (expr, x, y(x));
                            /
                            [        z(x)  d
          (%o7)             I y(x) %e     (-- (z(x))) dx
                            ]              dx
                            /

     Categories: Integral calculus

 -- Function: at
     at (EXPR, [EQN_1, ..., EQN_N])
     at (EXPR, EQN)

     Evaluates the expression EXPR with the variables assuming the values as specified for them in the list of equations [EQN_1, ..., EQN_N] or the single equation EQN.

     If a subexpression depends on any of the variables for which a value is specified but there is no atvalue specified and it can't be otherwise evaluated, then a noun form of the at is returned which displays in a two-dimensional form.

     at carries out multiple substitutions in parallel.

     See also atvalue  For other functions which carry out substitutions, see also subst and ev

     Examples:

          (%i1) atvalue (f(x,y), [x = 0, y = 1], a^2);
                                          2
          (%o1)                          a

          (%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y);
          (%o2)                        @2 + 1

          (%i3) printprops (all, atvalue);
                                          !
                            d             !
                           --- (f(@1, @2))!       = @2 + 1
                           d@1            !
                                          !@1 = 0

                                               2
                                    f(0, 1) = a

          (%o3)                         done

          (%i4) diff (4*f(x, y)^2 - u(x, y)^2, x);
                            d                          d
          (%o4)  8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y)))
                            dx                         dx

          (%i5) at (%, [x = 0, y = 1]);
                                                      !
                           2              d           !
          (%o5)        16 a  - 2 u(0, 1) (-- (u(x, 1))!     )
                                          dx          !
                                                      !x = 0

     Note that in the last line y is treated differently to x as y isn't used as a differentiation variable.

     The difference between subst at and ev can be seen in the following example:

          (%i1) e1:I(t)=C*diff(U(t),t)$
          (%i2) e2:U(t)=L*diff(I(t),t)$

          (%i3) at(e1,e2);
                                         !
                                d        !
          (%o3)       I(t) = C (-- (U(t))!                    )
                                dt       !          d
                                         !U(t) = L (-- (I(t)))
                                                    dt

          (%i4) subst(e2,e1);
                                      d      d
          (%o4)             I(t) = C (-- (L (-- (I(t)))))
                                      dt     dt

          (%i5) ev(e1,e2,diff);
                                            2
                                           d
          (%o5)                I(t) = C L (--- (I(t)))
                                             2
                                           dt

     Categories: Evaluation Differential equations

 -- Property: atomgrad

     atomgrad is the atomic gradient property of an expression. This property is assigned by gradef.

     Categories: Differential calculus

 -- Function: atvalue
     atvalue (EXPR, [X_1 = A_1, ..., X_M = A_M], C)
     atvalue (EXPR, X_1 = A_1, C)

     Assigns the value C to EXPR at the point X = A. Typically boundary values are established by this mechanism.

     EXPR is a function evaluation, F(X_1, ..., X_M), or a derivative, diff (F(X_1, ..., X_M), X_1, N_1, ..., X_N, N_M) in which the function arguments explicitly appear. N_I is the order of differentiation with respect to X_I.

     The point at which the atvalue is established is given by the list of equations [X_1 = A_1, ..., X_M = A_M]. If there is a single variable X_1, the sole equation may be given without enclosing it in a list.

     printprops ([F_1, F_2, ...], atvalue) displays the atvalues of the functions F_1, F_2, ... as specified by calls to atvalue.  printprops (F, atvalue) displays the atvalues of one function F.  printprops (all, atvalue) displays the atvalues of all functions for which atvalues are defined.

     The symbols @1, @2, ... represent the variables X_1, X_2, ... when atvalues are displayed.

     atvalue evaluates its arguments. atvalue returns C, the atvalue.

     See also at

     Examples:

          (%i1) atvalue (f(x,y), [x = 0, y = 1], a^2);
                                          2
          (%o1)                          a

          (%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y);
          (%o2)                        @2 + 1

          (%i3) printprops (all, atvalue);
                                          !
                            d             !
                           --- (f(@1, @2))!       = @2 + 1
                           d@1            !
                                          !@1 = 0

                                               2
                                    f(0, 1) = a

          (%o3)                         done

          (%i4) diff (4*f(x,y)^2 - u(x,y)^2, x);
                            d                          d
          (%o4)  8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y)))
                            dx                         dx

          (%i5) at (%, [x = 0, y = 1]);
                                                      !
                           2              d           !
          (%o5)        16 a  - 2 u(0, 1) (-- (u(x, 1))!     )
                                          dx          !
                                                      !x = 0

     Categories: Differential equations Declarations and inferences

 -- Function: cartan

     The exterior calculus of differential forms is a basic tool of differential geometry developed by Elie Cartan and has important applications in the theory of partial differential equations. The cartan package implements the functions ext_diff and lie_diff, along with the operators ~ (wedge product) and | (contraction of a form with a vector.) Type demo ("tensor") to see a brief description of these commands along with examples.

     cartan was implemented by F.B. Estabrook and H.D. Wahlquist.

     Categories: Differential geometry

 -- Function: init_cartan ([X_1, ..., X_N])

     init_cartan([X_1, ..., X_N]) initializes global variables for the cartan package. The sole argument is a list of symbols, from which the Cartan basis is constructed.

     init_cartan returns the basis which is constructed.

     init_cartan assigns values to the following global variables: cartan_coords, cartan_dim, extdim, and cartan_basis. In addition, the following arrays are assigned: extsub and extsubb.

     Note: Because of the internal implementation of the cartan package, it is necessary for init_cartan to be called before any expression containing the Cartan coordinates X_1, ..., X_N is parsed.

     Categories: Differential geometry Package cartan

 -- Function: del (X)

     del (X) represents the differential of the variable x.

     diff returns an expression containing del if an independent variable is not specified. In this case, the return value is the so-called "total differential".

     See also diff del and derivdegree

     Examples:

          (%i1) diff (log (x));
                                       del(x)
          (%o1)                        ------
                                         x
          (%i2) diff (exp (x*y));
                               x y              x y
          (%o2)            x %e    del(y) + y %e    del(x)
          (%i3) diff (x*y*z);
          (%o3)         x y del(z) + x z del(y) + y z del(x)

     Categories: Differential calculus

 -- Function: delta (T)

     The Dirac Delta function.

     Currently only laplace knows about the delta function.

     Example:

          (%i1) laplace (delta (t - a) * sin(b*t), t, s);
          Is  a  positive, negative, or zero?

          p;
                                             - a s
          (%o1)                   sin(a b) %e

     Categories: Mathematical functions Laplace transform

 -- System variable: dependencies
 -- Function: dependencies (F_1, ..., F_N)

     The variable dependencies is the list of atoms which have functional dependencies, assigned by depends, the function dependencies, or gradef. The dependencies list is cumulative: each call to depends, dependencies, or gradef appends additional items. The default value of dependencies is [].

     The function dependencies(F_1, ..., F_N) appends F_1, ..., F_N, to the dependencies list, where F_1, ..., F_N are expressions of the form F(X_1, ..., X_M), and X_1, ..., X_M are any number of arguments.

     dependencies(F(X_1, ..., X_M)) is equivalent to depends(F, [X_1, ..., X_M]).

     See also depends and gradef

          (%i1) dependencies;
          (%o1)                          []

          (%i2) depends (foo, [bar, baz]);
          (%o2)                    [foo(bar, baz)]

          (%i3) depends ([g, h], [a, b, c]);
          (%o3)               [g(a, b, c), h(a, b, c)]

          (%i4) dependencies;
          (%o4)        [foo(bar, baz), g(a, b, c), h(a, b, c)]

          (%i5) dependencies (quux (x, y), mumble (u));
          (%o5)                [quux(x, y), mumble(u)]

          (%i6) dependencies;
          (%o6) [foo(bar, baz), g(a, b, c), h(a, b, c), quux(x, y),
                                                                 mumble(u)]

          (%i7) remove (quux, dependency);
          (%o7)                         done

          (%i8) dependencies;
          (%o8)  [foo(bar, baz), g(a, b, c), h(a, b, c), mumble(u)]

     Categories: Declarations and inferences Global variables

 -- Function: depends (F_1, X_1, ..., F_N, X_N)

     Declares functional dependencies among variables for the purpose of computing derivatives.  In the absence of declared dependence, diff (f, x) yields zero.  If depends (f, x) is declared, diff (f, x) yields a symbolic derivative (that is, a diff noun).

     Each argument F_1, X_1, etc., can be the name of a variable or array, or a list of names. Every element of F_I (perhaps just a single element) is declared to depend on every element of X_I (perhaps just a single element). If some F_I is the name of an array or contains the name of an array, all elements of the array depend on X_I.

     diff recognizes indirect dependencies established by depends and applies the chain rule in these cases.

     remove (F, dependency) removes all dependencies declared for F.

     depends returns a list of the dependencies established. The dependencies are appended to the global variable dependencies. depends evaluates its arguments.

     diff is the only Maxima command which recognizes dependencies established by depends.  Other functions (integrate, laplace, etc.) only recognize dependencies explicitly represented by their arguments. For example, integrate does not recognize the dependence of f on x unless explicitly represented as integrate (f(x), x).

     depends(F, [X_1, ..., X_N]) is equivalent to dependencies(F(X_1, ..., X_N)).

     See also diff del derivdegree and derivabbrev

          (%i1) depends ([f, g], x);
          (%o1)                     [f(x), g(x)]
          (%i2) depends ([r, s], [u, v, w]);
          (%o2)               [r(u, v, w), s(u, v, w)]
          (%i3) depends (u, t);
          (%o3)                        [u(t)]
          (%i4) dependencies;
          (%o4)      [f(x), g(x), r(u, v, w), s(u, v, w), u(t)]
          (%i5) diff (r.s, u);
                                   dr           ds
          (%o5)                    -- . s + r . --
                                   du           du

          (%i6) diff (r.s, t);
                                dr du           ds du
          (%o6)                 -- -- . s + r . -- --
                                du dt           du dt

          (%i7) remove (r, dependency);
          (%o7)                         done
          (%i8) diff (r.s, t);
                                          ds du
          (%o8)                       r . -- --
                                          du dt

     Categories: Differential calculus Declarations and inferences

 -- Option variable: derivabbrev
     Default value: false

     When derivabbrev is true, symbolic derivatives (that is, diff nouns) are displayed as subscripts. Otherwise, derivatives are displayed in the Leibniz notation dy/dx.

     Categories: Differential calculus Global flags

 -- Function: derivdegree (EXPR, Y, X)

     Returns the highest degree of the derivative of the dependent variable Y with respect to the independent variable X occurring in EXPR.

     Example:

          (%i1) 'diff (y, x, 2) + 'diff (y, z, 3) + 'diff (y, x) * x^2;
                                   3     2
                                  d y   d y    2 dy
          (%o1)                   --- + --- + x  --
                                    3     2      dx
                                  dz    dx
          (%i2) derivdegree (%, y, x);
          (%o2)                           2

     Categories: Differential calculus Expressions

 -- Function: derivlist (VAR_1, ..., VAR_K)

     Causes only differentiations with respect to the indicated variables, within the ev command.

     Categories: Differential calculus Evaluation

 -- Option variable: derivsubst
     Default value: false

     When derivsubst is true, a non-syntactic substitution such as subst (x, 'diff (y, t), 'diff (y, t, 2)) yields 'diff (x, t).

     Categories: Differential calculus Expressions

 -- Function: diff
     diff (EXPR, X_1, N_1, ..., X_M, N_M)
     diff (EXPR, X, N)
     diff (EXPR, X)
     diff (EXPR)

     Returns the derivative or differential of EXPR with respect to some or all variables in EXPR.

     diff (EXPR, X, N) returns the N'th derivative of EXPR with respect to X.

     diff (EXPR, X_1, N_1, ..., X_M, N_M) returns the mixed partial derivative of EXPR with respect to X_1, ..., X_M.  It is equivalent to diff (... (diff (EXPR, X_M, N_M) ...), X_1, N_1).

     diff (EXPR, X) returns the first derivative of EXPR with respect to the variable X.

     diff (EXPR) returns the total differential of EXPR, that is, the sum of the derivatives of EXPR with respect to each its variables times the differential del of each variable. No further simplification of del is offered.

     The noun form of diff is required in some contexts, such as stating a differential equation. In these cases, diff may be quoted (as 'diff) to yield the noun form instead of carrying out the differentiation.

     When derivabbrev is true, derivatives are displayed as subscripts. Otherwise, derivatives are displayed in the Leibniz notation, dy/dx.

     See also depends del derivdegree derivabbrev and gradef

     Examples:

          (%i1) diff (exp (f(x)), x, 2);
                               2
                        f(x)  d               f(x)  d         2
          (%o1)       %e     (--- (f(x))) + %e     (-- (f(x)))
                                2                   dx
                              dx
          (%i2) derivabbrev: true$
          (%i3) 'integrate (f(x, y), y, g(x), h(x));
                                   h(x)
                                  /
                                  [
          (%o3)                   I     f(x, y) dy
                                  ]
                                  /
                                   g(x)
          (%i4) diff (%, x);
                 h(x)
                /
                [
          (%o4) I     f(x, y)  dy + f(x, h(x)) h(x)  - f(x, g(x)) g(x)
                ]            x                     x                  x
                /
                 g(x)

     For the tensor package, the following modifications have been incorporated:

     (1) The derivatives of any indexed objects in EXPR will have the variables X_I appended as additional arguments.  Then all the derivative indices will be sorted.

     (2) The X_I may be integers from 1 up to the value of the variable dimension [default value: 4].  This will cause the differentiation to be carried out with respect to the X_I'th member of the list coordinates which should be set to a list of the names of the coordinates, e.g., [x, y, z, t]. If coordinates is bound to an atomic variable, then that variable subscripted by X_I will be used for the variable of differentiation.  This permits an array of coordinate names or subscripted names like X[1], X[2], ... to be used.  If coordinates has not been assigned a value, then the variables will be treated as in (1) above.

     Categories: Differential calculus

 -- Special symbol: diff

     When diff is present as an evflag in call to ev, all differentiations indicated in expr are carried out.

 -- Function: express (EXPR)

     Expands differential operator nouns into expressions in terms of partial derivatives.  express recognizes the operators grad, div, curl, laplacian.  express also expands the cross product ~.

     Symbolic derivatives (that is, diff nouns) in the return value of express may be evaluated by including diff in the ev function call or command line. In this context, diff acts as an evfun.

     load ("vect") loads this function.

     Examples:

          (%i1) load ("vect")$
          (%i2) grad (x^2 + y^2 + z^2);
                                        2    2    2
          (%o2)                  grad (z  + y  + x )
          (%i3) express (%);
                 d    2    2    2   d    2    2    2   d    2    2    2
          (%o3) [-- (z  + y  + x ), -- (z  + y  + x ), -- (z  + y  + x )]
                 dx                 dy                 dz
          (%i4) ev (%, diff);
          (%o4)                    [2 x, 2 y, 2 z]
          (%i5) div ([x^2, y^2, z^2]);
                                        2   2   2
          (%o5)                   div [x , y , z ]
          (%i6) express (%);
                             d    2    d    2    d    2
          (%o6)              -- (z ) + -- (y ) + -- (x )
                             dz        dy        dx
          (%i7) ev (%, diff);
          (%o7)                    2 z + 2 y + 2 x
          (%i8) curl ([x^2, y^2, z^2]);
                                         2   2   2
          (%o8)                   curl [x , y , z ]
          (%i9) express (%);
                 d    2    d    2   d    2    d    2   d    2    d    2
          (%o9) [-- (z ) - -- (y ), -- (x ) - -- (z ), -- (y ) - -- (x )]
                 dy        dz       dz        dx       dx        dy
          (%i10) ev (%, diff);
          (%o10)                      [0, 0, 0]
          (%i11) laplacian (x^2 * y^2 * z^2);
                                            2  2  2
          (%o11)                laplacian (x  y  z )
          (%i12) express (%);
                   2                2                2
                  d     2  2  2    d     2  2  2    d     2  2  2
          (%o12)  --- (x  y  z ) + --- (x  y  z ) + --- (x  y  z )
                    2                2                2
                  dz               dy               dx
          (%i13) ev (%, diff);
                                2  2      2  2      2  2
          (%o13)             2 y  z  + 2 x  z  + 2 x  y
          (%i14) [a, b, c] ~ [x, y, z];
          (%o14)                [a, b, c] ~ [x, y, z]
          (%i15) express (%);
          (%o15)          [b z - c y, c x - a z, a y - b x]

     Categories: Differential calculus Vectors Operators

 -- Function: gradef
     gradef (F(X_1, ..., X_N), G_1, ..., G_M)
     gradef (A, X, EXPR)

     Defines the partial derivatives (i.e., the components of the gradient) of the function F or variable A.

     gradef (F(X_1, ..., X_N), G_1, ..., G_M) defines dF/dX_I as G_I, where G_I is an expression; G_I may be a function call, but not the name of a function. The number of partial derivatives M may be less than the number of arguments N, in which case derivatives are defined with respect to X_1 through X_M only.

     gradef (A, X, EXPR) defines the derivative of variable A with respect to X as EXPR.  This also establishes the dependence of A on X (via depends (A, X)).

     The first argument F(X_1, ..., X_N) or A is quoted, but the remaining arguments G_1, ..., G_M are evaluated. gradef returns the function or variable for which the partial derivatives are defined.

     gradef can redefine the derivatives of Maxima's built-in functions. For example, gradef (sin(x), sqrt (1 - sin(x)^2)) redefines the derivative of sin.

     gradef cannot define partial derivatives for a subscripted function.

     printprops ([F_1, ..., F_N], gradef) displays the partial derivatives of the functions F_1, ..., F_N, as defined by gradef.

     printprops ([A_N, ..., A_N], atomgrad) displays the partial derivatives of the variables A_N, ..., A_N, as defined by gradef.

     gradefs is the list of the functions for which partial derivatives have been defined by gradef. gradefs does not include any variables for which partial derivatives have been defined by gradef.

     Gradients are needed when, for example, a function is not known explicitly but its first derivatives are and it is desired to obtain higher order derivatives.

     Categories: Differential calculus Declarations and inferences

 -- System variable: gradefs
     Default value: []

     gradefs is the list of the functions for which partial derivatives have been defined by gradef. gradefs does not include any variables for which partial derivatives have been defined by gradef.

     Categories: Differential calculus Declarations and inferences