1Math::Symbolic::VectorCUaslecrulCuosn(t3r)ibuted Perl DoMcautmhe:n:tSaytmiboonlic::VectorCalculus(3)
2
3
4

NAME

6       Math::Symbolic::VectorCalculus - Symbolically comp. grad, Jacobi
7       matrices etc.
8

SYNOPSIS

10         use Math::Symbolic qw/:all/;
11         use Math::Symbolic::VectorCalculus; # not loaded by Math::Symbolic
12
13         @gradient = grad 'x+y*z';
14         # or:
15         $function = parse_from_string('a*b^c');
16         @gradient = grad $function;
17         # or:
18         @signature = qw(x y z);
19         @gradient = grad 'a*x+b*y+c*z', @signature; # Gradient only for x, y, z
20         # or:
21         @gradient = grad $function, @signature;
22
23         # Similar syntax variations as with the gradient:
24         $divergence = div @functions;
25         $divergence = div @functions, @signature;
26
27         # Again, similar DWIM syntax variations as with grad:
28         @rotation = rot @functions;
29         @rotation = rot @functions, @signature;
30
31         # Signatures always inferred from the functions here:
32         @matrix = Jacobi @functions;
33         # $matrix is now array of array references. These hold
34         # Math::Symbolic trees. Or:
35         @matrix = Jacobi @functions, @signature;
36
37         # Similar to Jacobi:
38         @matrix = Hesse $function;
39         # or:
40         @matrix = Hesse $function, @signature;
41
42         $wronsky_determinant = WronskyDet @functions, @vars;
43         # or:
44         $wronsky_determinant = WronskyDet @functions; # functions of 1 variable
45
46         $differential = TotalDifferential $function;
47         $differential = TotalDifferential $function, @signature;
48         $differential = TotalDifferential $function, @signature, @point;
49
50         $dir_deriv = DirectionalDerivative $function, @vector;
51         $dir_deriv = DirectionalDerivative $function, @vector, @signature;
52
53         $taylor = TaylorPolyTwoDim $function, $var1, $var2, $degree;
54         $taylor = TaylorPolyTwoDim $function, $var1, $var2,
55                                    $degree, $var1_0, $var2_0;
56         # example:
57         $taylor = TaylorPolyTwoDim 'sin(x)*cos(y)', 'x', 'y', 2;
58

DESCRIPTION

60       This module provides several subroutines related to vector calculus
61       such as computing gradients, divergence, rotation, and Jacobi/Hesse
62       Matrices of Math::Symbolic trees.  Furthermore it provides means of
63       computing directional derivatives and the total differential of a
64       scalar function and the Wronsky Determinant of a set of n scalar
65       functions.
66
67       Please note that the code herein may or may not be refactored into the
68       OO-interface of the Math::Symbolic module in the future.
69
70   EXPORT
71       None by default.
72
73       You may choose to have any of the following routines exported to the
74       calling namespace. ':all' tag exports all of the following:
75
76         grad
77         div
78         rot
79         Jacobi
80         Hesse
81         WronskyDet
82         TotalDifferential
83         DirectionalDerivative
84         TaylorPolyTwoDim
85

SUBROUTINES

87   grad
88       This subroutine computes the gradient of a Math::Symbolic tree
89       representing a function.
90
91       The gradient of a function f(x1, x2, ..., xn) is defined as the vector:
92
93         ( df(x1, x2, ..., xn) / d(x1),
94           df(x1, x2, ..., xn) / d(x2),
95           ...,
96           df(x1, x2, ..., xn) / d(xn) )
97
98       (These are all partial derivatives.) Any good book on calculus will
99       have more details on this.
100
101       grad uses prototypes to allow for a variety of usages. In its most
102       basic form, it accepts only one argument which may either be a
103       Math::Symbolic tree or a string both of which will be interpreted as
104       the function to compute the gradient for. Optionally, you may specify a
105       second argument which must be a (literal) array of
106       Math::Symbolic::Variable objects or valid Math::Symbolic variable names
107       (strings). These variables will the be used for the gradient instead of
108       the x1, ..., xn inferred from the function signature.
109
110   div
111       This subroutine computes the divergence of a set of Math::Symbolic
112       trees representing a vectorial function.
113
114       The divergence of a vectorial function F = (f1(x1, ..., xn), ...,
115       fn(x1, ..., xn)) is defined like follows:
116
117         sum_from_i=1_to_n( dfi(x1, ..., xn) / dxi )
118
119       That is, the sum of all partial derivatives of the i-th component
120       function to the i-th coordinate. See your favourite book on calculus
121       for details.  Obviously, it is important to keep in mind that the
122       number of function components must be equal to the number of
123       variables/coordinates.
124
125       Similar to grad, div uses prototypes to offer a comfortable interface.
126       First argument must be a (literal) array of strings and Math::Symbolic
127       trees which represent the vectorial function's components. If no second
128       argument is passed, the variables used for computing the divergence
129       will be inferred from the functions. That means the function signatures
130       will be joined to form a signature for the vectorial function.
131
132       If the optional second argument is specified, it has to be a (literal)
133       array of Math::Symbolic::Variable objects and valid variable names
134       (strings).  These will then be interpreted as the list of variables for
135       computing the divergence.
136
137   rot
138       This subroutine computes the rotation of a set of three Math::Symbolic
139       trees representing a vectorial function.
140
141       The rotation of a vectorial function F = (f1(x1, x2, x3), f2(x1, x2,
142       x3), f3(x1, x2, x3)) is defined as the following vector:
143
144         ( ( df3/dx2 - df2/dx3 ),
145           ( df1/dx3 - df3/dx1 ),
146           ( df2/dx1 - df1/dx2 ) )
147
148       Or "nabla x F" for short. Again, I have to refer to the literature for
149       the details on what rotation is. Please note that there have to be
150       exactly three function components and three coordinates because the
151       cross product and hence rotation is only defined in three dimensions.
152
153       As with the previously introduced subroutines div and grad, rot offers
154       a prototyped interface.  First argument must be a (literal) array of
155       strings and Math::Symbolic trees which represent the vectorial
156       function's components. If no second argument is passed, the variables
157       used for computing the rotation will be inferred from the functions.
158       That means the function signatures will be joined to form a signature
159       for the vectorial function.
160
161       If the optional second argument is specified, it has to be a (literal)
162       array of Math::Symbolic::Variable objects and valid variable names
163       (strings).  These will then be interpreted as the list of variables for
164       computing the rotation. (And please excuse my copying the last two
165       paragraphs from above.)
166
167   Jacobi
168       Jacobi() returns the Jacobi matrix of a given vectorial function.  It
169       expects any number of arguments (strings and/or Math::Symbolic trees)
170       which will be interpreted as the vectorial function's components.
171       Variables used for computing the matrix are, by default, inferred from
172       the combined signature of the components. By specifying a second
173       literal array of variable names as (second) argument, you may override
174       this behaviour.
175
176       The Jacobi matrix is the vector of gradient vectors of the vectorial
177       function's components.
178
179   Hesse
180       Hesse() returns the Hesse matrix of a given scalar function. First
181       argument must be a string (to be parsed as a Math::Symbolic tree) or a
182       Math::Symbolic tree. As with Jacobi(), Hesse() optionally accepts an
183       array of signature variables as second argument.
184
185       The Hesse matrix is the Jacobi matrix of the gradient of a scalar
186       function.
187
188   TotalDifferential
189       This function computes the total differential of a scalar function of
190       multiple variables in a certain point.
191
192       First argument must be the function to derive. The second argument is
193       an optional (literal) array of variable names (strings) and
194       Math::Symbolic::Variable objects to be used for deriving. If the
195       argument is not specified, the functions signature will be used. The
196       third argument is also an optional array and denotes the set of
197       variable (names) to use for indicating the point for which to evaluate
198       the differential. It must have the same number of elements as the
199       second argument.  If not specified the variable names used as
200       coordinated (the second argument) with an appended '_0' will be used as
201       the point's components.
202
203   DirectionalDerivative
204       DirectionalDerivative computes the directional derivative of a scalar
205       function in the direction of a specified vector. With f being the
206       function and X, A being vectors, it looks like this: (this is a partial
207       derivative)
208
209         df(X)/dA = grad(f(X)) * (A / |A|)
210
211       First argument must be the function to derive (either a string or a
212       valid Math::Symbolic tree). Second argument must be vector into whose
213       direction to derive. It is to be specified as an array of variable
214       names and objects.  Third argument is the optional signature to be used
215       for computing the gradient.  Please see the documentation of the grad
216       function for details. It's dimension must match that of the directional
217       vector.
218
219   TaylorPolyTwoDim
220       This subroutine computes the Taylor Polynomial for functions of two
221       variables. Please refer to the documentation of the TaylorPolynomial
222       function in the Math::Symbolic::MiscCalculus package for an explanation
223       of single dimensional Taylor Polynomials. This is the counterpart in
224       two dimensions.
225
226       First argument must be the function to approximate with the Taylor
227       Polynomial either as a string or a Math::Symbolic tree. Second and
228       third argument must be the names of the two coordinates. (These may
229       alternatively be Math::Symbolic::Variable objects.) Fourth argument
230       must be the degree of the Taylor Polynomial. Fifth and Sixth arguments
231       are optional and specify the names of the variables to introduce as the
232       point of approximation. These default to the names of the coordinates
233       with '_0' appended.
234
235   WronskyDet
236       WronskyDet() computes the Wronsky Determinant of a set of n functions.
237
238       First argument is required and a (literal) array of n functions. Second
239       argument is optional and a (literal) array of n variables or variable
240       names.  If the second argument is omitted, the variables used for
241       deriving are inferred from function signatures. This requires, however,
242       that the function signatures have exactly one element. (And the
243       function this exactly one variable.)
244

AUTHOR

246       Please send feedback, bug reports, and support requests to the
247       Math::Symbolic support mailing list: math-symbolic-support at lists dot
248       sourceforge dot net. Please consider letting us know how you use
249       Math::Symbolic. Thank you.
250
251       If you're interested in helping with the development or extending the
252       module's functionality, please contact the developers' mailing list:
253       math-symbolic-develop at lists dot sourceforge dot net.
254
255       List of contributors:
256
257         Steffen Mueller, symbolic-module at steffen-mueller dot net
258         Stray Toaster, mwk at users dot sourceforge dot net
259         Oliver Ebenhoeh
260

SEE ALSO

262       New versions of this module can be found on http://steffen-mueller.net
263       or CPAN. The module development takes place on Sourceforge at
264       http://sourceforge.net/projects/math-symbolic/
265
266       Math::Symbolic
267
268
269
270perl v5.32.0                      2020-07-28 Math::Symbolic::VectorCalculus(3)
Impressum