curl( f, var, params = list(), coordinates ="cartesian", accuracy =4, stepsize =NULL, drop =TRUE)f %curl% var
Arguments
f: array of characters or a function returning a numeric array.
var: vector giving the variable names with respect to which the derivatives are to be computed and/or the point where the derivatives are to be evaluated. See derivative.
params: list of additional parameters passed to f.
coordinates: coordinate system to use. One of: cartesian, polar, spherical, cylindrical, parabolic, parabolic-cylindrical or a vector of scale factors for each varibale.
accuracy: degree of accuracy for numerical derivatives.
stepsize: finite differences stepsize for numerical derivatives. It is based on the precision of the machine by default.
drop: if TRUE, return the curl as a vector and not as an array for vector-valued functions.
Returns
Vector for vector-valued functions when drop=TRUE, array otherwise.
Details
The curl of a vector-valued function Fi at a point is represented by a vector whose length and direction denote the magnitude and axis of the maximum circulation. In 2 dimensions, the curl is computed in arbitrary orthogonal coordinate systems using the scale factors hi and the Levi-Civita symbol epsilon:
f %curl% var: binary operator with default parameters.
Examples
### symbolic curl of a 2-d vector fieldf <- c("x^3*y^2","x")curl(f, var = c("x","y"))### numerical curl of a 2-d vector field in (x=1, y=1)f <-function(x,y) c(x^3*y^2, x)curl(f, var = c(x=1, y=1))### numerical curl of a 3-d vector field in (x=1, y=1, z=1)f <-function(x,y,z) c(x^3*y^2, x, z)curl(f, var = c(x=1, y=1, z=1))### vectorized interfacef <-function(x) c(x[1]^3*x[2]^2, x[1], x[3])curl(f, var = c(1,1,1))### symbolic array of vector-valued 3-d functionsf <- array(c("x*y","x","y*z","y","x*z","z"), dim = c(2,3))curl(f, var = c("x","y","z"))### numeric array of vector-valued 3-d functions in (x=1, y=1, z=1)f <-function(x,y,z) array(c(x*y,x,y*z,y,x*z,z), dim = c(2,3))curl(f, var = c(x=1, y=1, z=1))### binary operatorc("x*y","y*z","x*z")%curl% c("x","y","z")
References
Guidotti E (2022). "calculus: High-Dimensional Numerical and Symbolic Calculus in R." Journal of Statistical Software, 104(5), 1-37. tools:::Rd_expr_doi("10.18637/jss.v104.i05")
See Also
Other differential operators: derivative(), divergence(), gradient(), hessian(), jacobian(), laplacian()