2 * Functions and Variables for Differentiation::
5 @c -----------------------------------------------------------------------------
6 @node Functions and Variables for Differentiation, , Differentiation, Differentiation
7 @section Functions and Variables for Differentiation
8 @c -----------------------------------------------------------------------------
10 @c -----------------------------------------------------------------------------
12 @deffn {Function} antid (@var{expr}, @var{x}, @var{u(x)})
14 @c TODO: The antid package is currently undocumented except of this function.
15 Returns a two-element list, such that an antiderivative of @var{expr} with
16 respect to @var{x} can be constructed from the list. The expression @var{expr}
17 may contain an unknown function @var{u} and its derivatives.
19 Let @var{L}, a list of two elements, be the return value of @code{antid}.
20 Then @code{@var{L}[1] + 'integrate (@var{L}[2], @var{x})}
21 is an antiderivative of @var{expr} with respect to @var{x}.
23 When @code{antid} succeeds entirely,
24 the second element of the return value is zero.
25 Otherwise, the second element is nonzero,
26 and the first element is nonzero or zero.
27 If @code{antid} cannot make any progress,
28 the first element is zero and the second nonzero.
30 @code{load ("antid")} loads this function. The @code{antid} package also
31 defines the functions @code{nonzeroandfreeof} and @code{linear}.
33 @code{antid} is related to @mref{antidiff} as follows.
34 Let @var{L}, a list of two elements, be the return value of @code{antid}.
35 Then the return value of @code{antidiff} is equal to
36 @code{@var{L}[1] + 'integrate (@var{L}[2], @var{x})} where @var{x} is the
37 variable of integration.
43 @c expr: exp (z(x)) * diff (z(x), x) * y(x);
44 @c a1: antid (expr, x, z(x));
45 @c a2: antidiff (expr, x, z(x));
46 @c a2 - (first (a1) + 'integrate (second (a1), x));
47 @c antid (expr, x, y(x));
48 @c antidiff (expr, x, y(x));
52 (%i2) expr: exp (z(x)) * diff (z(x), x) * y(x);
54 (%o2) y(x) %e (-- (z(x)))
56 (%i3) a1: antid (expr, x, z(x));
58 (%o3) [y(x) %e , - %e (-- (y(x)))]
60 (%i4) a2: antidiff (expr, x, z(x));
63 (%o4) y(x) %e - I %e (-- (y(x))) dx
66 (%i5) a2 - (first (a1) + 'integrate (second (a1), x));
68 (%i6) antid (expr, x, y(x));
70 (%o6) [0, y(x) %e (-- (z(x)))]
72 (%i7) antidiff (expr, x, y(x));
75 (%o7) I y(x) %e (-- (z(x))) dx
80 @opencatbox{Categories:}
81 @category{Integral calculus}
85 @c -----------------------------------------------------------------------------
87 @deffn {Function} antidiff (@var{expr}, @var{x}, @var{u}(@var{x}))
89 Returns an antiderivative of @var{expr} with respect to @var{x}.
90 The expression @var{expr} may contain an unknown function @var{u} and its
93 When @code{antidiff} succeeds entirely, the resulting expression is free of
94 integral signs (that is, free of the @code{integrate} noun).
95 Otherwise, @code{antidiff} returns an expression
96 which is partly or entirely within an integral sign.
97 If @code{antidiff} cannot make any progress,
98 the return value is entirely within an integral sign.
100 @code{load ("antid")} loads this function.
101 The @code{antid} package also defines the functions @code{nonzeroandfreeof} and
104 @code{antidiff} is related to @code{antid} as follows.
105 Let @var{L}, a list of two elements, be the return value of @code{antid}.
106 Then the return value of @code{antidiff} is equal to
107 @code{@var{L}[1] + 'integrate (@var{L}[2], @var{x})} where @var{x} is the
108 variable of integration.
112 @c THERE IS A DEMO FILE share/integration/antid.dem, EXECUTED BY demo('antid)
113 @c BUT I THINK THE FOLLOWING ILLUSTRATES THE BASIC FUNCTIONALITY MORE CLEARLY
114 @c MAYBE MERGE IN THE DEMO PROBLEMS LATER
117 @c expr: exp (z(x)) * diff (z(x), x) * y(x);
118 @c a1: antid (expr, x, z(x));
119 @c a2: antidiff (expr, x, z(x));
120 @c a2 - (first (a1) + 'integrate (second (a1), x));
121 @c antid (expr, x, y(x));
122 @c antidiff (expr, x, y(x));
125 (%i1) load ("antid")$
126 (%i2) expr: exp (z(x)) * diff (z(x), x) * y(x);
128 (%o2) y(x) %e (-- (z(x)))
130 (%i3) a1: antid (expr, x, z(x));
132 (%o3) [y(x) %e , - %e (-- (y(x)))]
134 (%i4) a2: antidiff (expr, x, z(x));
137 (%o4) y(x) %e - I %e (-- (y(x))) dx
140 (%i5) a2 - (first (a1) + 'integrate (second (a1), x));
142 (%i6) antid (expr, x, y(x));
144 (%o6) [0, y(x) %e (-- (z(x)))]
146 (%i7) antidiff (expr, x, y(x));
149 (%o7) I y(x) %e (-- (z(x))) dx
154 @opencatbox{Categories:}
155 @category{Integral calculus}
159 @c -----------------------------------------------------------------------------
161 @deffn {Function} at @
162 @fname{at} (@var{expr}, [@var{eqn_1}, @dots{}, @var{eqn_n}]) @
163 @fname{at} (@var{expr}, @var{eqn})
165 Evaluates the expression @var{expr} with the variables assuming the values as
166 specified for them in the list of equations @code{[@var{eqn_1}, ...,
167 @var{eqn_n}]} or the single equation @var{eqn}.
169 If a subexpression depends on any of the variables for which a value is
170 specified but there is no @code{atvalue} specified and it can't be otherwise
171 evaluated, then a noun form of the @code{at} is returned which displays in a
172 two-dimensional form.
174 @code{at} carries out multiple substitutions in parallel.
176 See also @mrefdot{atvalue} For other functions which carry out substitutions,
177 see also @mref{subst} and @mrefdot{ev}
182 @c atvalue (f(x,y), [x = 0, y = 1], a^2);
183 @c atvalue ('diff (f(x,y), x), x = 0, 1 + y);
184 @c printprops (all, atvalue);
185 @c diff (4*f(x, y)^2 - u(x, y)^2, x);
186 @c at (%, [x = 0, y = 1]);
190 (%i1) atvalue (f(x,y), [x = 0, y = 1], a^2);
195 (%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y);
198 (%i3) printprops (all, atvalue);
201 --- (f(@@1, @@2))! = @@2 + 1
210 (%i4) diff (4*f(x, y)^2 - u(x, y)^2, x);
212 (%o4) 8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y)))
216 (%i5) at (%, [x = 0, y = 1]);
219 (%o5) 16 a - 2 u(0, 1) (-- (u(x, 1))! )
225 Note that in the last line @code{y} is treated differently to @code{x}
226 as @code{y} isn't used as a differentiation variable.
228 The difference between @mrefcomma{subst} @mref{at} and @mref{ev} can be
229 seen in the following example:
232 @c e1:I(t)=C*diff(U(t),t)$
233 @c e2:U(t)=L*diff(I(t),t)$
239 (%i1) e1:I(t)=C*diff(U(t),t)$
240 (%i2) e2:U(t)=L*diff(I(t),t)$
245 (%o3) I(t) = C (-- (U(t))! )
247 !U(t) = L (-- (I(t)))
253 (%o4) I(t) = C (-- (L (-- (I(t)))))
257 (%i5) ev(e1,e2,diff);
260 (%o5) I(t) = C L (--- (I(t)))
267 @opencatbox{Categories:}
268 @category{Evaluation}
269 @category{Differential equations}
273 @c I SUSPECT THERE IS MORE TO BE SAID HERE
275 @c Me, too: Where is desolve, for example?
277 @c -----------------------------------------------------------------------------
279 @defvr {Property} atomgrad
281 @code{atomgrad} is the atomic gradient property of an expression.
282 This property is assigned by @code{gradef}.
285 @opencatbox{Categories:}
286 @category{Differential calculus}
290 @c -----------------------------------------------------------------------------
292 @deffn {Function} atvalue @
293 @fname{atvalue} (@var{expr}, [@var{x_1} = @var{a_1}, @dots{}, @var{x_m} = @var{a_m}], @var{c}) @
294 @fname{atvalue} (@var{expr}, @var{x_1} = @var{a_1}, @var{c})
296 Assigns the value @var{c} to @var{expr} at the point @code{@var{x} = @var{a}}.
297 Typically boundary values are established by this mechanism.
299 @var{expr} is a function evaluation, @code{@var{f}(@var{x_1}, ..., @var{x_m})},
300 or a derivative, @code{diff (@var{f}(@var{x_1}, ..., @var{x_m}), @var{x_1},
301 @var{n_1}, ..., @var{x_n}, @var{n_m})}
302 @c HMM, WHAT IS THIS NEXT PHRASE GETTING AT ??
303 @c DOES IT INTEND TO IMPLY THAT IMPLICIT DEPENDENCIES ARE IGNORED ??
304 in which the function arguments explicitly appear.
305 @var{n_i} is the order of differentiation with respect to @var{x_i}.
307 The point at which the atvalue is established is given by the list of equations
308 @code{[@var{x_1} = @var{a_1}, ..., @var{x_m} = @var{a_m}]}.
309 If there is a single variable @var{x_1},
310 the sole equation may be given without enclosing it in a list.
312 @code{printprops ([@var{f_1}, @var{f_2}, ...], atvalue)} displays the atvalues
313 of the functions @code{@var{f_1}, @var{f_2}, ...} as specified by calls to
314 @code{atvalue}. @code{printprops (@var{f}, atvalue)} displays the atvalues of
315 one function @var{f}. @code{printprops (all, atvalue)} displays the atvalues
316 of all functions for which atvalues are defined.
318 The symbols @code{@@1}, @code{@@2}, @dots{} represent the
319 variables @var{x_1}, @var{x_2}, @dots{} when atvalues are displayed.
321 @code{atvalue} evaluates its arguments.
322 @code{atvalue} returns @var{c}, the atvalue.
324 See also @mrefdot{at}
329 @c atvalue (f(x,y), [x = 0, y = 1], a^2);
330 @c atvalue ('diff (f(x,y), x), x = 0, 1 + y);
331 @c printprops (all, atvalue);
332 @c diff (4*f(x,y)^2 - u(x,y)^2, x);
333 @c at (%, [x = 0, y = 1]);
337 (%i1) atvalue (f(x,y), [x = 0, y = 1], a^2);
342 (%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y);
345 (%i3) printprops (all, atvalue);
348 --- (f(@@1, @@2))! = @@2 + 1
357 (%i4) diff (4*f(x,y)^2 - u(x,y)^2, x);
359 (%o4) 8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y)))
363 (%i5) at (%, [x = 0, y = 1]);
366 (%o5) 16 a - 2 u(0, 1) (-- (u(x, 1))! )
372 @opencatbox{Categories:}
373 @category{Differential equations}
374 @category{Declarations and inferences}
378 @c LOOKS LIKE cartan IS THE NAME OF A PACKAGE AND NOT A FUNCTION OR VARIABLE
379 @c PROBABLY SHOULD SPLIT OUT cartan AND ITS CONTENTS INTO ITS OWN TEXINFO FILE
380 @c ext_diff AND lie_diff NOT DOCUMENTED (OTHER THAN HERE)
382 @c -----------------------------------------------------------------------------
384 @deffn {Function} cartan
386 The exterior calculus of differential forms is a basic tool
387 of differential geometry developed by Elie Cartan and has important
388 applications in the theory of partial differential equations.
389 The @code{cartan} package
390 implements the functions @code{ext_diff} and @code{lie_diff},
391 along with the operators @code{~} (wedge product) and @code{|} (contraction
392 of a form with a vector.)
393 Type @code{demo ("tensor")} to see a brief
394 description of these commands along with examples.
396 @code{cartan} was implemented by F.B. Estabrook and H.D. Wahlquist.
398 @opencatbox{Categories:}
399 @category{Differential geometry}
403 @c -----------------------------------------------------------------------------
405 @deffn {Function} init_cartan ([@var{x_1}, ..., @var{x_n}])
407 @code{init_cartan([@var{x_1}, ..., @var{x_n}])} initializes global variables
408 for the @code{cartan} package.
409 The sole argument is a list of symbols, from which the Cartan basis is constructed.
411 @code{init_cartan} returns the basis which is constructed.
413 @code{init_cartan} assigns values to the following global variables:
414 @code{cartan_coords}, @code{cartan_dim}, @code{extdim}, and @code{cartan_basis}.
415 In addition, the following arrays are assigned:
416 @code{extsub} and @code{extsubb}.
418 Note: Because of the internal implementation of the @code{cartan} package,
419 it is necessary for @code{init_cartan} to be called before any expression
420 containing the Cartan coordinates @code{@var{x_1}, ..., @var{x_n}} is parsed.
422 @opencatbox{Categories:}
423 @category{Differential geometry}
424 @category{Package cartan}
428 @c -----------------------------------------------------------------------------
430 @deffn {Function} del (@var{x})
432 @code{del (@var{x})} represents the differential of the variable @math{x}.
434 @code{diff} returns an expression containing @code{del}
435 if an independent variable is not specified.
436 In this case, the return value is the so-called "total differential".
438 See also @mrefcomma{diff} @mref{del} and @mrefdot{derivdegree}
448 (%i1) diff (log (x));
452 (%i2) diff (exp (x*y));
454 (%o2) x %e del(y) + y %e del(x)
456 (%o3) x y del(z) + x z del(y) + y z del(x)
459 @opencatbox{Categories:}
460 @category{Differential calculus}
464 @c -----------------------------------------------------------------------------
466 @deffn {Function} delta (@var{t})
468 The Dirac Delta function.
470 Currently only @mref{laplace} knows about the @code{delta} function.
475 @c laplace (delta (t - a) * sin(b*t), t, s);
479 (%i1) laplace (delta (t - a) * sin(b*t), t, s);
480 Is a positive, negative, or zero?
487 @opencatbox{Categories:}
488 @category{Mathematical functions}
489 @category{Laplace transform}
493 @c -----------------------------------------------------------------------------
494 @anchor{dependencies}
495 @defvr {System variable} dependencies
496 @defvrx {Function} dependencies (@var{f_1}, @dots{}, @var{f_n})
498 The variable @code{dependencies} is the list of atoms which have functional
499 dependencies, assigned by @mref{depends}, the function @code{dependencies}, or @mref{gradef}.
500 The @code{dependencies} list is cumulative:
501 each call to @code{depends}, @code{dependencies}, or @code{gradef} appends additional items.
502 The default value of @code{dependencies} is @code{[]}.
504 The function @code{dependencies(@var{f_1}, @dots{}, @var{f_n})} appends @var{f_1}, @dots{}, @var{f_n},
505 to the @code{dependencies} list,
506 where @var{f_1}, @dots{}, @var{f_n} are expressions of the form @code{@var{f}(@var{x_1}, @dots{}, @var{x_m})},
507 and @var{x_1}, @dots{}, @var{x_m} are any number of arguments.
509 @code{dependencies(@var{f}(@var{x_1}, @dots{}, @var{x_m}))} is equivalent to @code{depends(@var{f}, [@var{x_1}, @dots{}, @var{x_m}])}.
511 See also @mref{depends} and @mrefdot{gradef}
515 @c depends (foo, [bar, baz]);
516 @c depends ([g, h], [a, b, c]);
518 @c dependencies (quux (x, y), mumble (u));
520 @c remove (quux, dependency);
529 (%i2) depends (foo, [bar, baz]);
530 (%o2) [foo(bar, baz)]
533 (%i3) depends ([g, h], [a, b, c]);
534 (%o3) [g(a, b, c), h(a, b, c)]
538 (%o4) [foo(bar, baz), g(a, b, c), h(a, b, c)]
541 (%i5) dependencies (quux (x, y), mumble (u));
542 (%o5) [quux(x, y), mumble(u)]
546 (%o6) [foo(bar, baz), g(a, b, c), h(a, b, c), quux(x, y),
550 (%i7) remove (quux, dependency);
555 (%o8) [foo(bar, baz), g(a, b, c), h(a, b, c), mumble(u)]
559 @opencatbox{Categories:}
560 @category{Declarations and inferences}
561 @category{Global variables}
565 @c -----------------------------------------------------------------------------
567 @deffn {Function} depends (@var{f_1}, @var{x_1}, @dots{}, @var{f_n}, @var{x_n})
569 Declares functional dependencies among variables for the purpose of computing
570 derivatives. In the absence of declared dependence, @code{diff (f, x)} yields
571 zero. If @code{depends (f, x)} is declared, @code{diff (f, x)} yields a
572 symbolic derivative (that is, a @code{diff} noun).
574 Each argument @var{f_1}, @var{x_1}, etc., can be the name of a variable or
575 array, or a list of names.
576 Every element of @var{f_i} (perhaps just a single element)
577 is declared to depend
578 on every element of @var{x_i} (perhaps just a single element).
579 If some @var{f_i} is the name of an array or contains the name of an array,
580 all elements of the array depend on @var{x_i}.
582 @code{diff} recognizes indirect dependencies established by @code{depends}
583 and applies the chain rule in these cases.
585 @code{remove (@var{f}, dependency)} removes all dependencies declared for
588 @code{depends} returns a list of the dependencies established.
589 The dependencies are appended to the global variable @mref{dependencies}.
590 @code{depends} evaluates its arguments.
592 @code{diff} is the only Maxima command which recognizes dependencies established
593 by @code{depends}. Other functions (@code{integrate}, @code{laplace}, etc.)
594 only recognize dependencies explicitly represented by their arguments.
595 For example, @mref{integrate} does not recognize the dependence of @code{f} on
596 @code{x} unless explicitly represented as @code{integrate (f(x), x)}.
598 @code{depends(@var{f}, [@var{x_1}, @dots{}, @var{x_n}])} is equivalent to @code{dependencies(@var{f}(@var{x_1}, @dots{}, @var{x_n}))}.
600 See also @mrefcomma{diff} @mrefcomma{del} @mref{derivdegree} and
601 @mrefdot{derivabbrev}
604 @c depends ([f, g], x);
605 @c depends ([r, s], [u, v, w]);
611 (%i1) depends ([f, g], x);
613 (%i2) depends ([r, s], [u, v, w]);
614 (%o2) [r(u, v, w), s(u, v, w)]
615 (%i3) depends (u, t);
618 (%o4) [f(x), g(x), r(u, v, w), s(u, v, w), u(t)]
621 (%o5) -- . s + r . --
631 (%o6) -- -- . s + r . -- --
636 @c remove (r, dependency);
640 (%i7) remove (r, dependency);
648 @opencatbox{Categories:}
649 @category{Differential calculus}
650 @category{Declarations and inferences}
654 @c -----------------------------------------------------------------------------
656 @defvr {Option variable} derivabbrev
657 Default value: @code{false}
659 When @code{derivabbrev} is @code{true},
660 symbolic derivatives (that is, @code{diff} nouns) are displayed as subscripts.
661 Otherwise, derivatives are displayed in the Leibniz notation @code{dy/dx}.
663 @c NEED EXAMPLES HERE
664 @opencatbox{Categories:}
665 @category{Differential calculus}
666 @category{Global flags}
670 @c SEEMS LIKE THIS STATEMENT COULD BE LESS CLUMSY
672 @c -----------------------------------------------------------------------------
674 @deffn {Function} derivdegree (@var{expr}, @var{y}, @var{x})
676 Returns the highest degree of the derivative
677 of the dependent variable @var{y} with respect to the independent variable
678 @var{x} occurring in @var{expr}.
683 @c 'diff (y, x, 2) + 'diff (y, z, 3) + 'diff (y, x) * x^2;
684 @c derivdegree (%, y, x);
687 (%i1) 'diff (y, x, 2) + 'diff (y, z, 3) + 'diff (y, x) * x^2;
690 (%o1) --- + --- + x --
693 (%i2) derivdegree (%, y, x);
697 @opencatbox{Categories:}
698 @category{Differential calculus}
699 @category{Expressions}
703 @c I HAVE NO IDEA WHAT THIS DOES
705 @c -----------------------------------------------------------------------------
707 @deffn {Function} derivlist (@var{var_1}, @dots{}, @var{var_k})
709 Causes only differentiations with respect to
710 the indicated variables, within the @mref{ev} command.
712 @opencatbox{Categories:}
713 @category{Differential calculus}
714 @category{Evaluation}
718 @c -----------------------------------------------------------------------------
720 @defvr {Option variable} derivsubst
721 Default value: @code{false}
723 When @code{derivsubst} is @code{true}, a non-syntactic substitution such as
724 @code{subst (x, 'diff (y, t), 'diff (y, t, 2))} yields @code{'diff (x, t)}.
726 @opencatbox{Categories:}
727 @category{Differential calculus}
728 @category{Expressions}
732 @c -----------------------------------------------------------------------------
734 @deffn {Function} diff @
735 @fname{diff} (@var{expr}, @var{x_1}, @var{n_1}, @dots{}, @var{x_m}, @var{n_m}) @
736 @fname{diff} (@var{expr}, @var{x}, @var{n}) @
737 @fname{diff} (@var{expr}, @var{x}) @
738 @fname{diff} (@var{expr})
740 Returns the derivative or differential of @var{expr} with respect to some or
741 all variables in @var{expr}.
743 @code{diff (@var{expr}, @var{x}, @var{n})} returns the @var{n}'th derivative of
744 @var{expr} with respect to @var{x}.
746 @code{diff (@var{expr}, @var{x_1}, @var{n_1}, ..., @var{x_m}, @var{n_m})}
747 returns the mixed partial derivative of @var{expr} with respect to @var{x_1},
748 @dots{}, @var{x_m}. It is equivalent to @code{diff (... (diff (@var{expr},
749 @var{x_m}, @var{n_m}) ...), @var{x_1}, @var{n_1})}.
751 @code{diff (@var{expr}, @var{x})}
752 returns the first derivative of @var{expr} with respect to
753 the variable @var{x}.
755 @code{diff (@var{expr})} returns the total differential of @var{expr}, that is,
756 the sum of the derivatives of @var{expr} with respect to each its variables
757 times the differential @code{del} of each variable.
758 @c WHAT DOES THIS NEXT STATEMENT MEAN, EXACTLY ??
759 No further simplification of @code{del} is offered.
761 The noun form of @code{diff} is required in some contexts,
762 such as stating a differential equation.
763 In these cases, @code{diff} may be quoted (as @code{'diff}) to yield the noun
764 form instead of carrying out the differentiation.
766 When @code{derivabbrev} is @code{true}, derivatives are displayed as subscripts.
767 Otherwise, derivatives are displayed in the Leibniz notation, @code{dy/dx}.
769 See also @mrefcomma{depends} @mrefcomma{del} @mref{derivdegree} and
770 @mrefdot{derivabbrev}
775 @c diff (exp (f(x)), x, 2);
776 @c derivabbrev: true$
777 @c 'integrate (f(x, y), y, g(x), h(x));
781 (%i1) diff (exp (f(x)), x, 2);
784 (%o1) %e (--- (f(x))) + %e (-- (f(x)))
787 (%i2) derivabbrev: true$
788 (%i3) 'integrate (f(x, y), y, g(x), h(x));
800 (%o4) I f(x, y) dy + f(x, h(x)) h(x) - f(x, g(x)) g(x)
806 For the tensor package, the following modifications have been
809 (1) The derivatives of any indexed objects in @var{expr} will have the
810 variables @var{x_i} appended as additional arguments. Then all the
811 derivative indices will be sorted.
813 (2) The @var{x_i} may be integers from 1 up to the value of the variable
814 @code{dimension} [default value: 4]. This will cause the differentiation to be
815 carried out with respect to the @var{x_i}'th member of the list
816 @code{coordinates} which should be set to a list of the names of the
817 coordinates, e.g., @code{[x, y, z, t]}. If @code{coordinates} is bound to an
818 atomic variable, then that variable subscripted by @var{x_i} will be used for
819 the variable of differentiation. This permits an array of coordinate names or
820 subscripted names like @code{X[1]}, @code{X[2]}, @dots{} to be used. If
821 @code{coordinates} has not been assigned a value, then the variables will be
822 treated as in (1) above.
824 @c NEED EXAMPLES FOR TENSOR STUFF
825 @opencatbox{Categories:}
826 @category{Differential calculus}
830 @c MERGE THIS INTO @defun diff
832 @c -----------------------------------------------------------------------------
834 @defvr {Special symbol} diff
836 When @code{diff} is present as an @code{evflag} in call to @code{ev},
837 all differentiations indicated in @code{expr} are carried out.
842 @c -----------------------------------------------------------------------------
844 @deffn {Function} express (@var{expr})
846 @c HERE IS THE PREVIOUS TEXT. WHAT IS THE POINT ABOUT depends ?? I'M NOT GETTING IT
847 @c The result uses the noun form of any
848 @c derivatives arising from expansion of the vector differential
849 @c operators. To force evaluation of these derivatives, the built-in @code{ev}
850 @c function can be used together with the @code{diff} evflag, after using the
851 @c built-in @code{depends} function to establish any new implicit dependencies.
853 @c TODO: curl, grad, div and laplacian aren't currently documented.
855 Expands differential operator nouns into expressions in terms of partial
856 derivatives. @code{express} recognizes the operators @code{grad}, @code{div},
857 @code{curl}, @code{laplacian}. @code{express} also expands the cross product
860 Symbolic derivatives (that is, @code{diff} nouns)
861 in the return value of express may be evaluated by including @code{diff}
862 in the @code{ev} function call or command line.
863 In this context, @mref{diff} acts as an @mref{evfun}.
865 @code{load ("vect")} loads this function.
866 @c IN POINT OF FACT, express IS A SIMPLIFICATION RULE, AND express1 IS THE FCN WHICH DOES ALL THE WORK
872 @c grad (x^2 + y^2 + z^2);
875 @c div ([x^2, y^2, z^2]);
878 @c curl ([x^2, y^2, z^2]);
881 @c laplacian (x^2 * y^2 * z^2);
884 @c [a, b, c] ~ [x, y, z];
889 (%i2) grad (x^2 + y^2 + z^2);
891 (%o2) grad (z + y + x )
893 d 2 2 2 d 2 2 2 d 2 2 2
894 (%o3) [-- (z + y + x ), -- (z + y + x ), -- (z + y + x )]
897 (%o4) [2 x, 2 y, 2 z]
898 (%i5) div ([x^2, y^2, z^2]);
900 (%o5) div [x , y , z ]
903 (%o6) -- (z ) + -- (y ) + -- (x )
906 (%o7) 2 z + 2 y + 2 x
907 (%i8) curl ([x^2, y^2, z^2]);
909 (%o8) curl [x , y , z ]
911 d 2 d 2 d 2 d 2 d 2 d 2
912 (%o9) [-- (z ) - -- (y ), -- (x ) - -- (z ), -- (y ) - -- (x )]
916 (%i11) laplacian (x^2 * y^2 * z^2);
918 (%o11) laplacian (x y z )
921 d 2 2 2 d 2 2 2 d 2 2 2
922 (%o12) --- (x y z ) + --- (x y z ) + --- (x y z )
927 (%o13) 2 y z + 2 x z + 2 x y
928 (%i14) [a, b, c] ~ [x, y, z];
929 (%o14) [a, b, c] ~ [x, y, z]
931 (%o15) [b z - c y, c x - a z, a y - b x]
934 @opencatbox{Categories:}
935 @category{Differential calculus}
941 @c COMMENTING OUT THIS TEXT PENDING RESOLUTION OF BUG REPORT # 836704:
942 @c "gendiff is all bugs: should be deprecated"
944 @c Sometimes @code{diff(e,x,n)} can be reduced even though N is
951 @c and you can try, for example,
954 @c diff(%e^(a*x),x,q)
957 @c by using @code{gendiff} rather than @code{diff}. Unevaluable
958 @c items come out quoted. Some items are in terms of @code{genfact}, which
963 @c -----------------------------------------------------------------------------
965 @deffn {Function} gradef @
966 @fname{gradef} (@var{f}(@var{x_1}, @dots{}, @var{x_n}), @var{g_1}, @dots{}, @var{g_m}) @
967 @fname{gradef} (@var{a}, @var{x}, @var{expr})
969 Defines the partial derivatives (i.e., the components of the gradient) of the
970 function @var{f} or variable @var{a}.
972 @code{gradef (@var{f}(@var{x_1}, ..., @var{x_n}), @var{g_1}, ..., @var{g_m})}
973 defines @code{d@var{f}/d@var{x_i}} as @var{g_i}, where @var{g_i} is an
974 expression; @var{g_i} may be a function call, but not the name of a function.
975 The number of partial derivatives @var{m} may be less than the number of
976 arguments @var{n}, in which case derivatives are defined with respect to
977 @var{x_1} through @var{x_m} only.
979 @code{gradef (@var{a}, @var{x}, @var{expr})} defines the derivative of variable
980 @var{a} with respect to @var{x} as @var{expr}. This also establishes the
981 dependence of @var{a} on @var{x} (via @code{depends (@var{a}, @var{x})}).
983 The first argument @code{@var{f}(@var{x_1}, ..., @var{x_n})} or @var{a} is
984 quoted, but the remaining arguments @var{g_1}, ..., @var{g_m} are evaluated.
985 @code{gradef} returns the function or variable for which the partial derivatives
988 @code{gradef} can redefine the derivatives of Maxima's built-in functions.
989 For example, @code{gradef (sin(x), sqrt (1 - sin(x)^2))} redefines the
990 derivative of @code{sin}.
992 @code{gradef} cannot define partial derivatives for a subscripted function.
994 @code{printprops ([@var{f_1}, ..., @var{f_n}], gradef)} displays the partial
995 derivatives of the functions @var{f_1}, ..., @var{f_n}, as defined by
998 @code{printprops ([@var{a_n}, ..., @var{a_n}], atomgrad)} displays the partial
999 derivatives of the variables @var{a_n}, ..., @var{a_n}, as defined by
1002 @code{gradefs} is the list of the functions
1003 for which partial derivatives have been defined by @code{gradef}.
1004 @code{gradefs} does not include any variables
1005 for which partial derivatives have been defined by @code{gradef}.
1007 @c REPHRASE THIS NEXT BIT
1008 Gradients are needed when, for example, a function is not known
1009 explicitly but its first derivatives are and it is desired to obtain
1010 higher order derivatives.
1012 @c NEED EXAMPLES HERE
1013 @opencatbox{Categories:}
1014 @category{Differential calculus}
1015 @category{Declarations and inferences}
1019 @c -----------------------------------------------------------------------------
1021 @defvr {System variable} gradefs
1022 Default value: @code{[]}
1024 @code{gradefs} is the list of the functions
1025 for which partial derivatives have been defined by @code{gradef}.
1026 @code{gradefs} does not include any variables
1027 for which partial derivatives have been defined by @code{gradef}.
1029 @opencatbox{Categories:}
1030 @category{Differential calculus}
1031 @category{Declarations and inferences}
1035 @c -----------------------------------------------------------------------------
1037 @deffn {Function} laplace (@var{expr}, @var{t}, @var{s})
1039 Attempts to compute the Laplace transform of @var{expr} with respect to the
1040 variable @var{t} and transform parameter @var{s}. The Laplace
1041 transform of the function @code{f(t)} is the one-sided transform defined by
1044 F(s) = integrate(f(t) * exp(-s*t), t, 0, inf)
1048 $$F(s) = \int_0^{\infty} f(t) e^{-st} dt$$
1050 where @code{F(s)} is the transform of @code{f(t)}.
1052 @code{laplace} recognizes in @var{expr} the functions @mrefcomma{delta} @mrefcomma{exp}
1053 @mrefcomma{log} @mrefcomma{sin} @mrefcomma{cos} @mrefcomma{sinh} @mrefcomma{cosh} and @mrefcomma{erf}
1054 as well as @code{derivative}, @mrefcomma{integrate} @mrefcomma{sum} and @mrefdot{ilt} If
1055 laplace fails to find a transform the function @mref{specint} is called.
1056 @code{specint} can find the laplace transform for expressions with special
1057 functions like the bessel functions @mrefcomma{bessel_j} @mrefcomma{bessel_i} @dots{}
1058 and can handle the @mref{unit_step} function. See also @mrefdot{specint}
1060 If @code{specint} cannot find a solution too, a noun @code{laplace} is returned.
1063 @var{expr} may also be a linear, constant coefficient differential equation in
1064 which case @mref{atvalue} of the dependent variable is used.
1065 @c "used" -- USED HOW ??
1066 The required atvalue may be supplied either before or after the transform is
1067 computed. Since the initial conditions must be specified at zero, if one has
1068 boundary conditions imposed elsewhere he can impose these on the general
1069 solution and eliminate the constants by solving the general solution
1070 for them and substituting their values back.
1072 @code{laplace} recognizes convolution integrals of the form
1073 @code{integrate (f(x) * g(t - x), x, 0, t)};
1074 other kinds of convolutions are not recognized.
1076 Functional relations must be explicitly represented in @var{expr};
1077 implicit relations, established by @mrefcomma{depends} are not recognized.
1078 That is, if @var{f} depends on @var{x} and @var{y},
1079 @code{f (x, y)} must appear in @var{expr}.
1081 See also @mrefcomma{ilt} the inverse Laplace transform.
1086 @c laplace (exp (2*t + a) * sin(t) * t, t, s);
1087 @c laplace ('diff (f (x), x), x, s);
1088 @c diff (diff (delta (t), t), t);
1089 @c laplace (%, t, s);
1091 @c declare(a, integer)$
1092 @c laplace(gamma_incomplete(a,t),t,s),gamma_expand:true;
1093 @c factor(laplace(gamma_incomplete(1/2,t),t,s));
1094 @c assume(exp(%pi*s)>1)$
1095 @c laplace(sum((-1)^n*unit_step(t-n*%pi)*sin(t),n,0,inf),t,s),
1099 (%i1) laplace (exp (2*t + a) * sin(t) * t, t, s);
1102 (%o1) ---------------
1105 (%i2) laplace ('diff (f (x), x), x, s);
1106 (%o2) s laplace(f(x), x, s) - f(0)
1107 (%i3) diff (diff (delta (t), t), t);
1110 (%o3) --- (delta(t))
1113 (%i4) laplace (%, t, s);
1116 (%o4) - -- (delta(t))! + s - delta(0) s
1120 (%i6) laplace(gamma_incomplete(a,t),t,s),gamma_expand:true;
1123 (%o6) -------- - -----------------
1127 (%i7) factor(laplace(gamma_incomplete(1/2,t),t,s));
1129 sqrt(%pi) (sqrt(s) sqrt(-----) - 1)
1131 (%o7) -----------------------------------
1135 (%i8) assume(exp(%pi*s)>1)$
1136 (%i9) laplace(sum((-1)^n*unit_step(t-n*%pi)*sin(t),n,0,inf),t,s),
1140 ------------------------ - ------------------------
1142 (s + %i) (1 - %e ) (s - %i) (1 - %e )
1143 (%o9) ---------------------------------------------------
1149 (%o9) -------------------------------
1151 (s - %i) (s + %i) (%e - 1)
1155 @opencatbox{Categories:}
1156 @category{Laplace transform}
1157 @category{Differential equations}