# [R] Explanation required for the examples given for the 'curl' function in the 'r' package 'calculus'

Winod Dhamnekar v|noddh@mnek@r11 @end|ng |rom gm@||@com
Tue Nov 29 13:45:49 CET 2022

```Hello sir,

In the Reference manual given by Cran.r-project.org, the following examples
for the function 'curl' are given.

I know how to compute 'curl' in octave. I can use HP 50g calculator to
compute curl of a vector field to compute line integrals using Stokes's
theorem.

I compute curl of a vector field manually as well.

But I don't understand these examples. The results after running the
examples in 'R' are given below:
curl> ### symbolic curl of a 2-d vector field
curl> f <- c("x^3*y^2","x")

curl> curl(f, var = c("x","y"))
[1] "(1) * 1 + (x^3 * (2 * y)) * -1"

curl> ### numerical curl of a 2-d vector field in (x=1, y=1)
curl> f <- function(x,y) c(x^3*y^2, x)

curl> curl(f, var = c(x=1, y=1))
[1] -1

curl> ### numerical curl of a 3-d vector field in (x=1, y=1, z=1)
curl> f <- function(x,y,z) c(x^3*y^2, x, z)

curl> curl(f, var = c(x=1, y=1, z=1))
[1]  0  0 -1

curl> ### vectorized interface
curl> f <- function(x) c(x[1]^3*x[2]^2, x[1], x[3])

curl> curl(f, var = c(1,1,1))
[1]  0  0 -1

curl> ### symbolic array of vector-valued 3-d functions
curl> f <- array(c("x*y","x","y*z","y","x*z","z"), dim = c(2,3))

curl> curl(f, var = c("x","y","z"))
[,1]       [,2]       [,3]
[1,] "(y) * -1" "(z) * -1" "(x) * -1"
[2,] "0"        "0"        "0"

curl> ### numeric array of vector-valued 3-d functions in (x=1, y=1, z=1)
curl> f <- function(x,y,z) array(c(x*y,x,y*z,y,x*z,z), dim = c(2,3))

curl> curl(f, var = c(x=1, y=1, z=1))
[,1] [,2] [,3]
[1,]   -1   -1   -1
[2,]    0    0    0

curl> ### binary operator
curl> c("x*y","y*z","x*z") %curl% c("x","y","z")
[1] "(y) * -1" "(z) * -1" "(x) * -1"

Yours R-help subscriber
Winod Dhamnekar

[[alternative HTML version deleted]]

```