R Under development (unstable) (2024-10-16 r87241 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if(!require("GNE"))stop("this test requires package GNE.") Loading required package: GNE Loading required package: alabama Loading required package: numDeriv Loading required package: nleqslv Loading required package: BB Loading required package: SQUAREM > > GrAphiFB(0, 1) [1] -1 > GrAphiFB(0, 0) [1] -0.5 > library(GNE) > GrAphiFB(0, 0) [1] -0.5 > GrAphiFB(0, 1) [1] -1 > GrAphiFB(0, 1/10) [1] -1 > GrAphiFB(1/10, 0) [1] 0 > GrAphiFB(0:10, 0:10) [1] -0.5000000 -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 [7] -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 > 0:10 == 0 & 1:10 == 0 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE Warning message: In 0:10 == 0 & 1:10 == 0 : longer object length is not a multiple of shorter object length > 0:10 == 0 & 0:10 == 0 [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > a <- 0:10 > b <- 0:10 > a / sqrt(a^2+b^2) - 1 [1] NaN -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 [7] -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 > a / sqrt(a^2+b^2) - 1 [1] NaN -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 [7] -0.2928932 -0.2928932 -0.2928932 -0.2928932 -0.2928932 > a <- c(0, rnorm(10)) > b <- c(0, rnorm(10)) > a [1] 0.00000000 -1.20736503 -0.13196608 0.04378913 1.14346168 -0.40669169 [7] -1.39943642 0.31870748 0.40146871 -0.39232017 -2.02883833 > b [1] 0.00000000 -0.66773583 -0.52032231 0.09209787 -1.49682395 1.13626129 [7] -0.45480238 -0.79317945 -0.91520087 0.56939444 -0.19385774 > a / sqrt(a^2+b^2) - 1 [1] NaN -1.8750857 -1.2458401 -0.5706020 -0.3929414 -1.3369860 [7] -1.9510370 -0.6271619 -0.5982841 -1.5673745 -1.9954660 > GrAphiFB(a, b) [1] -0.5000000 -1.8750857 -1.2458401 -0.5706020 -0.3929414 -1.3369860 [7] -1.9510370 -0.6271619 -0.5982841 -1.5673745 -1.9954660 > GrBphiFB(a, b) [1] -0.50000000 -1.48396802 -1.96931039 -0.09688462 -1.79465705 -0.05849034 [7] -1.30907718 -1.92789641 -1.91576435 -0.17654015 -1.09511787 > a <- cbind(c(0, rnorm(10)), rnorm(11)) > a [,1] [,2] [1,] 0.0000000 1.9422499 [2,] -1.5228920 -0.1415821 [3,] 0.7590635 1.0573916 [4,] 1.4571201 -0.5760007 [5,] 1.1452536 1.0432299 [6,] -0.6632334 0.1645910 [7,] 0.8271336 1.5235907 [8,] -0.7013977 -1.1857962 [9,] 1.6609776 -0.2112580 [10,] -0.2906815 -0.5775489 [11,] 1.6072022 2.0152944 > b <- cbind(c(0, rnorm(10)), rnorm(11)) > GrAphiFB(a, b) [,1] [,2] [1,] -0.500000000 -0.002564790 [2,] -1.981997173 -1.374415719 [3,] -0.219060316 -0.061149460 [4,] -0.007063322 -1.838252260 [5,] -0.035738085 -0.032620697 [6,] -1.998886126 -0.604558129 [7,] -0.024571325 -0.182088035 [8,] -1.514352111 -1.724040040 [9,] -0.087270077 -1.265421527 [10,] -1.489035127 -1.308249733 [11,] -0.172300578 -0.006179132 > a == 0 & b == 0 [,1] [,2] [1,] TRUE FALSE [2,] FALSE FALSE [3,] FALSE FALSE [4,] FALSE FALSE [5,] FALSE FALSE [6,] FALSE FALSE [7,] FALSE FALSE [8,] FALSE FALSE [9,] FALSE FALSE [10,] FALSE FALSE [11,] FALSE FALSE > a / sqrt(a^2+b^2) - 1 [,1] [,2] [1,] NaN -0.002564790 [2,] -1.981997173 -1.374415719 [3,] -0.219060316 -0.061149460 [4,] -0.007063322 -1.838252260 [5,] -0.035738085 -0.032620697 [6,] -1.998886126 -0.604558129 [7,] -0.024571325 -0.182088035 [8,] -1.514352111 -1.724040040 [9,] -0.087270077 -1.265421527 [10,] -1.489035127 -1.308249733 [11,] -0.172300578 -0.006179132 > GrBphiFB(a, b) [,1] [,2] [1,] -0.5000000 -0.92842485 [2,] -0.8111044 -1.92726095 [3,] -0.3753936 -0.65567506 [4,] -0.8813545 -0.45471737 [5,] -0.7350491 -0.74666764 [6,] -0.9528141 -1.91849101 [7,] -0.7796845 -0.42465661 [8,] -0.1424209 -0.31024206 [9,] -1.4085634 -0.03586753 [10,] -0.1277359 -1.95130547 [11,] -1.5611717 -1.11099587 > > > xmax <- 10 > x <- seq(-xmax, xmax, length=31) > p <- 0 > > sapply(x, function(x) phipFB(x, 1, p) - phiFB(x, 1)) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > > p <- pi > > sapply(x, function(x) phipFB(x, 1, p) - (sqrt(x^2+1) - (x+1) - p*pmax(x, 0)*max(1,0))) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > sapply(x, function(x) phipFB(x, -1, p) - (sqrt(x^2+1) - (x-1) - p*pmax(x, 0)*max(-1,0))) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > > > proc.time() user system elapsed 0.32 0.17 0.43