Displaying 20 results from an estimated 11000 matches similar to: "Friday question: negative zero"
2024 Sep 05
2
BUG: atan(1i) / 5 = NaN+Infi ?
atan(1i) -> 0 + Inf i
complex(1/5) -> 0.2 + 0i
atan(1i) -> (0 + Inf i) * (0.2 + 0i)
-> 0*0.2 + 0*0i + Inf i * 0.2 + Inf i * 0i
infinity times zero is undefined
-> 0 + 0i + Inf i + NaN * i^2
-> 0 + 0i + Inf i - NaN
-> NaN + Inf i
I am not sure how complex arithmetic could arrive at another answer.
I advise against messing with infinities... use atan2() if you don't
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
>>>>> Richard O'Keefe
>>>>> on Fri, 6 Sep 2024 17:24:07 +1200 writes:
> The thing is that real*complex, complex*real, and complex/real are not
> "complex arithmetic" in the requisite sense.
> The complex numbers are a vector space over the reals,
Yes, but they _also_ are field (and as others have argued mathematically only
2024 Sep 05
1
BUG: atan(1i) / 5 = NaN+Infi ?
> complex(real = 0, imaginary = Inf)
[1] 0+Infi
> Inf*1i
[1] NaN+Infi
>> complex(real = 0, imaginary = Inf)/5
[1] NaN+Infi
See the Note in ?complex for the explanation, I think. Duncan can correct
if I'm wrong.
-- Bert
On Thu, Sep 5, 2024 at 3:20?PM Leo Mada <leo.mada at syonic.eu> wrote:
> Dear Bert,
>
> These behave like real divisions/multiplications:
>
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
G.5.1 para 2 can be found in the C17 standard -- I actually have the
final draft not the published standard. It's in earlier standards, I
just didn't check earlier standards. Complex arithmetic was not in
the first C standard (C89) but was in C99.
The complex numbers do indeed form a field, and Z*W invokes an
operation in that field when Z and W are both complex numbers. Z*R
and R*Z,
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
The thing is that real*complex, complex*real, and complex/real are not
"complex arithmetic"
in the requisite sense. The complex numbers are a vector space over
the reals, and
complex*real and real*complex are vector*scalar and scalar*vector.
For example, in the Ada programming language, we have
function "*" (Left, Right : Complex) return Complex;
function "*" (Left :
2007 Aug 03
4
FW: Selecting undefined column of a data frame (was [BioC] read.phenoData vs read.AnnotatedDataFrame)
Hi all,
What are current methods people use in R to identify
mis-spelled column names when selecting columns
from a data frame?
Alice Johnson recently tackled this issue
(see [BioC] posting below).
Due to a mis-spelled column name ("FileName"
instead of "Filename") which produced no warning,
Alice spent a fair amount of time tracking down
this bug. With my fumbling fingers
2007 Aug 07
2
Embedded nuls in strings
Hi,
?rawToChar
'rawToChar' converts raw bytes either to a single character string
or a character vector of single bytes. (Note that a single
character string could contain embedded nuls.)
Allowing embedded nuls in a string might be an interesting experiment but it
seems to cause some troubles to most of the string manipulation functions.
A string with an embedded 0:
2007 Oct 04
2
plot from source file
Dear list
Maybe someone can help with the following problem:
I have a source file containing the following code for plotting:
pdf(file = 'data/mario/boxplot.pdf')
bwplot(sig100 ~ target | group, data = fish, main = 'Boxplot der
Signale in 100 Zellen nach Gruppe', xlab = '', ylab = 'Anzahl der
Signale')
dev.off()
pdf(file = 'data/mario/xyplot.pdf')
2003 Jun 24
3
R-1.7.1 regression test failure on alphaev68-dec-osf5.1
I'm attempting to compile and install R version 1.7.1 for my statistical
geneticists. It seems to compile correctly -- that is, it compiles
without errors -- but the regression test is failing in the following
manner:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> ## log
> stopifnot(all.equal(log(1:10), log(1:10, exp(1))))
> stopifnot(all.equal(log10(30), log(30, 10)))
>
2016 May 28
1
complex NA's match(), etc: not back-compatible change proposal
On 'factor', I meant the case where 'levels' is not specified, where 'unique' is called.
> factor(c(complex(real=NaN), complex(imaginary=NaN)))
[1] NaN+0i <NA>
Levels: NaN+0i
Look at <NA> in the result above. Yes, it happens in earlier versions of R, too.
On matching both NA and NaN, another consequence is that length(unique(.)) may depend on order.
2007 May 17
1
model.matrix bug? Nested factor yields singular design matrix.
Hi all,
I believe this is a bug in the model.matrix function.
I'd like a second opinion before filing a bug report.
If I have a nested covariate B with multiple values for
just one level of A, I can not get a non-singular design
matrix out of model.matrix
> df <- data.frame(A = factor(c("a", "a", "x", "x"), levels = c("x",
2017 Mar 17
4
Hyperbolic tangent different results on Windows and Mac
Dear all,
We seem to have found a "strange" behaviour in the hyperbolic tangent
function tanh on Windows.
When running tanh(356 + 0i) the Windows result is NaN + 0.i while on Mac
the result is 1 + 0i. It doesn't seem to be a floating point error because
on Mac it is possible to run arbitrarily large numbers (say tanh(
2024 Sep 05
3
BUG: atan(1i) / 5 = NaN+Infi ?
On 2024-09-05 4:23 p.m., Leo Mada via R-help wrote:
> Dear R Users,
>
> Is this desired behaviour?
> I presume it's a bug.
>
> atan(1i)
> # 0+Infi
>
> tan(atan(1i))
> # 0+1i
>
> atan(1i) / 5
> # NaN+Infi
There's no need to involve atan() and tan() in this:
> (0+Inf*1i)/5
[1] NaN+Infi
Why do you think this is a bug?
Duncan Murdoch
2024 Sep 05
1
BUG: atan(1i) / 5 = NaN+Infi ?
Dear Bert,
These behave like real divisions/multiplications:
complex(re=Inf, im = Inf) * 5
# Inf+Infi
complex(re=-Inf, im = Inf) * 5
# -Inf+Infi
The real division / multiplication should be faster and also is well behaved. I was expecting R to do the real division/multiplication on a complex number. Which R actually does for these very particular cases; but not when only Im(x) is Inf.
2010 Mar 25
2
print(big+small*1i) -> big + 0i
Should both parts of a complex number be printed
to the same precision? The imaginary part of 0
looks a bit odd when log10(real/imag) >=~ getOption("digits"),
but I'm not sure it is awful. Some people might
expect the same number of significant digits in the
two parts.
> 1e7+4i
[1] 10000000+0i
> 1e7+5i
[1] 10000000+0i
> 1e10 + 1000i
[1] 1e+10+0e+00i
>
2007 Jul 02
1
download.file - it works on my Mac but not on Windows.
Hi:
I am working with someone remotely to allow them access to our data.
The follow command using "download.file" works perfectly on my Mac:
> > download.file(url="http://oceanwatch.pfeg.noaa.gov:8081/thredds/
> wcs/satellite/AG/ssta/14day?
> request=GetCoverage&version=1.0.0&service=WCS&format=NetCDF3&coverage=
>
2023 Nov 05
2
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
This is another follow-up to the thread from September "Recent changes to
as.complex(NA_real_)".
A test in data.table was broken by the changes for NA coercion to complex;
the breakage essentially comes from
c(NA, 0+1i)
# vs
c(as.complex(NA), 0+1i)
The former is the output we tested against; the latter is essentially (via
coerceVector() in C) what's generated by our
2006 Jan 18
1
function 'eigen' (PR#8503)
Full_Name: Pierre Legendre
Version: 2.1.1
OS: Mac OSX 10.4.3
Submission from: (NULL) (132.204.120.81)
I am reporting the mis-behaviour of the function 'eigen' in 'base', for the
following input matrix:
A <- matrix(c(2,3,4,-1,3,1,1,-2,0),3,3)
eigen(A)
I obtain the following results, which are incorrect for eigenvalues and
eigenvectors 2 and 3 (incorrect imaginary portions):
2016 May 13
1
complex NA's match(), etc: not back-compatible change proposal
That, for example, complex(real=NaN) and complex(imaginary=NaN) are regarded as equal makes it possible that length(unique(as.character(x))) > length(unique(x)) (current code of function 'factor' doesn't expect it). Yes, an argument for the behavior is that NA and NaN are of one kind.
On my system, using 32-bit R for Windows from binary from CRAN, the result of sapply(z, match,
2013 Mar 22
4
ggplot2 will not draw a rectangle. Error: ggplot2 doesn't know how to deal with data of class XXX"
What am I missing? When I run the code below I get the error message
"Error: ggplot2 doesn't know how to deal with data of class function"
Googling suggests a message of "Error: ggplot2 doesn't know how to deal with data of class XXX" is not uncommon but I don't see why I am getting a "function" error unless I am using some reserved word?