Physics[Vectors][int] - extend the int command to also compute path, surface, and volume integrals from the mathematical representation of the region, vectorial, parametric or as a set of expressions relating the coordinates to each other
|
Calling Sequence
|
|
int(F, r_ = A .. B, path = C)
int(F, r_, path = C, parameter = [t = a..b])
int(F, r_ = C, parameter = [t = a..b])
int(F, r_ = A .. B, path = C, kind = crossproduct)
int(F, S_, surface = C, parameters = [u = a..b, v = c..d])
int(F, S_ = C, parameters = [u = a..b, v = c..d])
int(F, S_, parameters = [u = a..b, v = c..d], kind = crossproduct)
int(F, V, volume = C, parameters = [u = a..b, v = c..d, w = c..d])
int(F, V = C, parameters = [u = a..b, v = c..d, w = c..d])
|
|
Parameters
|
|
F or F_
|
-
|
the integrand, can be an algebraic scalar expression F, or a vector function F_ (to represent vector functions see notation)
|
C
|
-
|
the mathematical formulation for the region of integration; it could be a vector function representation - of a curve, surface, or volume - or an algebraic equation relating the coordinates, or any region's representation as a set or list of such relations, solved or not for the coordinates in terms of parameters.
|
r_ = A..B
|
-
|
the global symbol r_ (not another symbol), representing the position vector, whose differential is the line element of the integration path. On the right-hand side A and B represent the initial and final points of the path C of integration and can be omitted when the parameter option is used and includes the parameter's range of integration.
|
r_ = C
|
-
|
in this case the right-hand side is itself the region of integration C and the argument path = C can be omitted.
|
S_
|
-
|
the global symbol S_ (not another symbol); represents the surface element of the surface of integration.
|
S_ = C
|
-
|
in this case the right-hand side is itself the region of integration C and the argument surface = C can be omitted.
|
V
|
-
|
the global symbol V (not another symbol); represents the volume element of the volume of integration.
|
V = C
|
-
|
in this case the right-hand side is itself the region of integration C and the argument volume = C can be omitted.
|
path = C
|
-
|
synonym curve = C, together with using the symbol r_ as integration variable, it indicates that the integral is a 1-dimensional path integral
|
surface = C
|
-
|
together with using the symbol S_ as integration variable, indicates that the integral is a 2-dimensional surface integral
|
volume = C
|
-
|
together with using the symbol V as integration variable, indicates that the integral is a 3-dimensional volume integral
|
kind = crossproduct
|
-
|
indicates that the integrand is the cross product of the vector function F_ (the first argument to int) with the line or surface elements or
|
parameters = ...
|
-
|
synonym parameter, optional for line integrals, mandatory for surface and volume integrals, the right-hand side is a list with the parameters and their ranges specifying the region of integration, e.g. in the case of surface integrals [u = a..b, v = c..d]. In the case of path integrals, the right-hand side can also be only the parameter, without its range, provide that the integration limits A and B are given.
|
inert
|
-
|
optional, when passed it makes int return the integral expressed in terms of the parameters but before performing the integration, as an inert Int function call
|
|
|
|
|
Description
|
|
•
|
The int command of the Vectors package extends the Maple int command to also compute vector integrals; these are path, surface, or volume integrals, where the integrand is a scalar or vector function, and starting from any region's description (algebraic, parametric, vectorial). In the context of the Physics Vectors package, vectors are names that end with the underscore _ and vector functions are functions where the name ends with the underscore _.
|
•
|
There are three kinds of line or path integrals:
|
|
where and are points in space, the limits of integration, that belong to the curve over which the integral is performed. In the first integral, is a scalar function and the result of the integration is thus a vector. In the second and third integrals the integrand is a vector function, so that the dot product is a scalar and so is the integral, while in the third one is a vector and so is its integration over the region .
|
•
|
Likewise, there are three kinds of surface integrals
|
|
and two types of volume integrals
|
•
|
The conventions to represent these integrals are those of the standard int Maple command, extended to handle vector integrals as follows:
|
–
|
The first argument - the integrand - can be a scalar function, say , or a vector function , in which case, for line and surface integrals, where the element of integration is also a vector, the integral is understood as the integral of their scalar product e.g. for line integrals. If the optional argument kind = crossproduct is passed, the integral is understood as the integral of the cross product e.g. for surface integrals.
|
–
|
The second argument, the integration variable, also indicates the kind of integration - line (path), surface, or volume - by respectively using the global names r_, S_, or V, so that is a line element, a surface element and a volume element. In the case of path integrals, the second argument can include the range as in r_ = A_ .. B_ where A_ and B_ represent two points in space that belong to the integration curve .
|
–
|
The region of integration is indicated as region = ... where region is the keyword path or curve for line integrals, and surface and volume for surface and volume integrals. The right-hand side of region = ... specifies the region of integration as a vector function or as an equation relating the coordinates, or as a set or list of them. That specification is used by int to derive parametric equations representing the region using the ParametrizeCurve, ParametrizeSurface, and ParametrizeVolume commands. Alternative ways of specifying the region of integration are discussed in the Examples section.
|
–
|
The parameters and their ranges covering the region of integration, are required in the case of surface and volume integrals. Indicating the parameter, or its range, are both optional in the case of line integrals and, when the range is not passed, the integration limits are required expressed as two points and . When these two points are one and the same, it is understood to be a closed path of integration. The parameters can also be indicated as functionality of the coordinates, for example using instead of just when indicating the integration region C.
|
–
|
The limits of integration and in path integrals must be points of the integration path and can be represented using the notation for algebraic vectors of the Vectors package, as a sum of terms where each one is the product of a unit vector times some coefficient, or as a list with the three components of the vector.
|
•
|
You can use a shortcut notation for all of path, surface, and volume integrals, consisting of passing the second argument as an equation having integration variable (r_, S_, or V) on the left-hand side, and the region of integration C on the right-hand side. In those cases, the argument region = C where region is one of path, surface, or volume becomes redundant and can be omitted.
|
•
|
The line element in path integrals is expressed in terms of a parameter as
|
|
Using indexed notation for derivatives , the surface element in surface integrals is expressed in terms of parameters as
|
|
and the volume element in volume integrals as
|
|
Since both and involve a cross product, there is a sign that depends on the ordering of the parameters . To have control over that sign, the parameters on the right-hand side of parameters = ... are expected as an ordered list.
|
•
|
The integrals in the three cases are computed by first expressing the integrand and the integration element in terms of the parameters using the parametric equations derived with ParametrizeCurve, ParametrizeSurface, and ParametrizeVolume, then performing the vector product operations, then the integration. Passing the optional argument inert, the last integration step is not performed and a result is returned using the inert function Int.
|
|
|
Examples
|
|
>
|
with(Physics:-Vectors);
|
| (1) |
>
|
Setup(mathematicalnotation = true);
|
| (2) |
|
Path integrals
|
|
Consider the following scalar function , path and integration limits and
The line or path integral, shown here in inert form on the left-hand side and active, computed to the end on the right-hand side, is
>
|
(Int = int)(F, r_ = A_ .. B_, path = C);
|
Note that the output on the right-hand side is a vector. Within int, to perform this integration the curve is first parametrized using ParametrizeCurve
| (8) |
The output above is a sequence, first the parametric equations as an ordered list (order ) then the parameter, in this case . For the formulation of the integral to make sense, the limits of integration and must belong to this curve, i.e. satisfy the parametric equations for some value of the parameter, in this case and
>
|
A_ = Eval((8)[1], t = 0);
|
| (9) |
>
|
B_ = Eval((8)[1], t = 1);
|
| (10) |
To see the integral after being parametrized and before performing the integration use the option inert
>
|
(Int = int)(F, r_ = A_ .. B_, path = C, inert);
|
Since there is a relation one-to-one between the integration limits and and the parameter's range, instead of indicating and you can also indicate the range of itself, getting the same result (7)
>
|
(Int = int)(F, r_, path = C, parameter = {t = 0..1});
|
When the parameter's range is passed, you can also use a shortcut notation, passing the second argument as an equation r_ = C, making more explicit that r_ is the vector representation of region of integration, so the line element is the differential of the parametric equations of C. In this case indicating path = C is redundant and can be omitted.
>
|
(Int = int)(F, r_ = C, parameter = {t = 0..1});
|
The integration path and the limits of integration can be expressed in vector notation as well
>
|
(Int = int)(F, r_ = A_ .. B_, path = C_);
|
The following represents a circle of radius on the plane
>
|
C := {x^2 + y^2 = a^2, z = 0};
|
| (18) |
To perform a path integral over this curve, the curve is first parametrized as
| (19) |
Checking the form of the parametrization returned is useful when using the parameter = a..b option to understand what the values of a and b need to be. From the above we see that for , the limits of integration and are
>
|
eval((19)[1], phi = 0);
|
| (20) |
>
|
eval((19)[1], phi = Pi/2);
|
| (22) |
So for the following integrand, we have (in the context of int, the keywords curve and path are synonyms)
>
|
(Int = int)(F, r_ = A_ .. B_, curve = C);
|
An example having for integrand a vector function , also expressing the path using vector notation
>
|
F_ := x^2*_i + y*_j + x*y*z*_k;
|
| (26) |
>
|
C_ := x*(_i + _j + _k);
|
Integrate over this curve from the origin to the point . To represent a point whose three coordinates are equal, you can use a list with three equal values or, as a shortcut notation, use the single value of the three coordinates. So instead of you can use and instead of you can use 1
When the integrand is a vector function, int computes the integral of the dot product over the given curve, resulting in a scalar value
>
|
(Int = int)(F_, r_ = A_ .. B_, path = C_);
|
To compute the integral of the cross product use the option kind = crossproduct. In this example, we can see that the value of the parameter for which the points and satisfy the parametric equations are and . Knowing those values allows for passing this information directly and omit the integration limits and
>
|
(Int = int)(F_, r_, path = C_, kind = crossproduct, parameters = {t = 0..1});
|
The case of a straight line that passes through two given points is special: in addition to handling any mathematical formulation of a line, ParametrizeCurve can also compute the parametric equations directly from the coordinates of those two points. For example
>
|
P__1 := 2*_i - 3*_j + 4*_k;
|
>
|
P__2 := -4*_i + 2*_j - _k;
|
we have (in the computational context of ParametrizeCurve, line and straightline are synonyms)
>
|
ParametrizeCurve(line(P__1, P__2));
|
| (33) |
Likewise, int can compute path integrals over a straight line that passes through two points in the same way. Take for instance as integration limits the points that satisfy this line for and
>
|
A_ := (16*_i)/5 - 4*_j + 5*_k;
|
>
|
B_ := -(44*_i)/5 + 6*_j - 5*_k;
|
| (35) |
>
|
(Int = int)(F_, r_ = A_ .. B_, path = line(P__1, P__2), kind = crossproduct);
|
Consider integrating over a path that consists of three line segments, say , connecting the origin with the point via , so first a translation along the axis only, then one along the axis, then one along the axis.
One way of performing this computation is to make three calls to int, passing each of the three different paths then add the results. Another way, significantly simpler, is using the . First one path at a time: the vectorial representations of these paths and the three computations are as follows:
>
|
(Int = int)(F_, r_ = A_ .. B_, path = C__1_);
|
>
|
(Int = int)(F_, r_ = A_ .. B_, path = C__2_);
|
>
|
C__3_ := _i + _j + z*_k;
|
| (44) |
>
|
(Int = int)(F_, r_ = A_ .. B_, path = C__3_);
|
These three steps can be compacted into one using
>
|
(Int = int)(F_, r_, path = linesegments(0, _i, _i + _j, _i + _j + _k));
|
Moreover, note that this integral from 0 to depends on the path of integration. To see that, compute the same integral over the straight line that joins these two points:
>
|
(Int = int)(F_, r_, path = linesegment(0, _i + _j + _k));
|
So instead of . The reason for that: the curl of is not zero
| (49) |
therefore, the path integral from to depends on the path. Note as well that when there are only two points, the notation is equivalent to so the integral above can also be expressed as
>
|
(Int = int)(F_, r_ = 0.. _i + _j + _k, path = line(0, _i + _j + _k));
|
Consider the same computation over two different paths in a case where the curl of is equal to zero; take for instance to be equal to the position vector itself
>
|
F_ := x * _i + y * _j + z * _k;
|
Now the integral does not depend on the path:
>
|
(Int = int)(F_, r_, path = linesegments(0, _i, _i + _j, _i + _j + _k));
|
>
|
(Int = int)(F_, r_, path = linesegment(0, _i + _j + _k));
|
You can indicate that the line integral is around a closed curve in two different ways: passing the initial and final points (integration limits) and such that , or entirely omitting the integration limits and passing a range for the parameter such that the curve is closed. The following represents a circle on the plane
>
|
C := {x^2 + y^2 = a^2, z = 0};
|
| (55) |
Integrate the vectorial line element around the whole circle using the two mentioned ways of representing a closed curve. From symmetry considerations, this integral should be equal to 0: we are adding infinitesimal vectorial line elements tangent to the circle around all of it: the contributions of the upper half cancel those of the lower half. Start and finish the integration at the point
>
|
(Int = int)(1, r_ = A_ .. A_, path = C);
|
>
|
(Int = int)(1, r_, path = C, parameter = {phi = 0..2*Pi});
|
These are the contributions of the upper half only
>
|
(Int = int)(1, r_, path = C, parameter = {phi = 0..Pi});
|
Take now , the position vector, and integrate the cross product around the circle : this time, at each point of the circle, is perpendicular to the plane , in the direction, so there are no cancellations, everything adds. Here again start and finish the integration at the point
>
|
F_ := x * _i + y * _j + z * _k;
|
>
|
(Int = int)(F_, r_ = A_ .. A_, path = C, kind = crossproduct);
|
>
|
(Int = int)(F_, r_, path = C, parameter = {phi = 0..2*Pi}, kind = crossproduct);
|
|
|
Surface and Volume integrals
|
|
The case of surface and volume integrals is analogous to that of line (path) integrals, but for two things: instead of one, there are two or three parameters, and instead of indicating integration limits, it is required that you indicate the parameter's ranges.
The following represents the surface of a sphere of radius centered at the origin
>
|
with(Physics, Assume, CompactDisplay);
|
| (63) |
>
|
C__2 := x^2 + y^2 + z^2 = a^2;
|
>
|
ParametrizeSurface(C__2);
|
| (66) |
From the definition of the vectorial surface element as
is a vector perpendicular to the surface of the sphere. Hence, the vectorial surface integral of over the upper half of the sphere should be a vector perpendicular to the plane in the direction. Also, checking the form of the parametrization returned by ParametrizeSurface is useful to understand what the ranges for parameters and need to be to represent the desired region.
>
|
(Int = int)(1, S_, surface = C__2, parameters = [theta = 0..Pi/2, phi = 0..2*Pi]);
|
From symmetry considerations, the integral of over the lower half of the sphere should have the same magnitude but opposite direction (), from where the integral over the whole sphere, so for , should be equal to 0
>
|
(Int = int)(1, S_, surface = C__2, parameters = [theta = 0..Pi, phi = 0..2*Pi]);
|
From this example we see that to get the area computing the integral of over the whole surface it is necessary to take as integrand the modulus of , that is its scalar product with a unit vector parallel to it. By definition of surface element (see the Description) that unit vector is given by
>
|
CompactDisplay(r_(theta, phi));
|
| (69) |
>
|
n_ := diff(r_(theta, phi), theta) &x diff(r_(theta, phi), phi)/Norm(diff(r_(theta, phi), theta) &x diff(r_(theta, phi), phi));
|
where is the vectorial form of the parametric equations of the surface. It is easy to see this vector is the radial unit vector . For that purpose you can use the option output = vector of ParametrizeSurface to get the vectorial form of the parametric equations for
>
|
ParametrizeSurface(C__2, output = vector);
|
| (71) |
Introduce this value of into the expression for and change basis to spherical
>
|
n_ := eval(n_, r_(theta, phi) = (71)[1]);
|
| (72) |
>
|
n_ := ChangeBasis(n_, spherical);
|
Putting all together, the area of a sphere of radius is given by this closed surface integral
>
|
(Int = int)(n_, S_, surface = C__2, parameters = [theta = 0..Pi, phi = 0..2*Pi]);
|
You can also use a shortcut notation for surface integrals passing the second argument as an equation S_ = C, making more explicit that S_ is the vector representation of the surface. In this case indicating surface = C is redundant and can be omitted.
>
|
(Int = int)(n_, S_ = C__2, parameters = [theta = 0..Pi, phi = 0..2*Pi]);
|
In the case of the volume of a sphere, an algebraic representation of the region is
>
|
C__3 := x^2 + y^2 + z^2 = r^2;
|
from where the volume of a sphere of radius is equal to the integral of the corresponding with parameters , and
>
|
(Int = int)(1, V, volume = C__3, parameters = [r = 0..a, theta=0..Pi, phi = 0..2*Pi]);
|
Using ParametrizeVolume one can also see that the vectorial representation of this region is just the position vector written in spherical coordinates and basis
>
|
ParametrizeVolume(C__3, basis = spherical, output = vector);
|
| (78) |
so one can use this simpler vectorial representation of the sphere as well
>
|
(Int = int)(1, V, volume = r*_r, parameters = [r = 0..a, theta=0..Pi, phi = 0..2*Pi]);
|
You can also use a shortcut notation for volume integrals passing the second argument as an equation V = C, making more explicit that V is the specified volume of integration C. In this case indicating volume = C is redundant and can be omitted.
>
|
(Int = int)(1, V = r*_r, parameters = [r = 0..a, theta=0..Pi, phi = 0..2*Pi]);
|
|
|
|
See Also
|
|
ChangeBasis, ChangeCoordinates, convert,VectorCalculus, Identify, int, notation, operations, ParametrizeCurve, ParametrizeSurface, ParametrizeVolume, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[Vectors], Setup, standard int, VectorCalculus:-int
|
|
Compatibility
|
|
•
|
The Physics[Vectors][int] command was introduced in Maple 2022.
|
|
|