[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] Explanation required for the examples given for the 'curl' function in the 'r' package 'calculus
From: Winod Dhamnekar <vinoddhamnekar11 () gmail ! com>
Date: 2022-11-29 12:57:49
Message-ID: CADL+Ce2=yY=ysQZVoM9MHPbAQwaL2pdhQJH3qtdHN9pLGQX2gQ () mail ! gmail ! com
[Download RAW message or body]
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]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic