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
fu
I expect that atan(1i) = (0 + infinity i) and that atan(1i)/5 = (0 +
infinity i)/5 = (0 + infinity i).
Here's what I get in C:
(0,1) = (0, 1)
atan((0,1)) = (0, inf)
atan((0,1))/5 = (0, inf)
Note the difference between I*infinity = (0,1)*infinity =
(0*infinity,1*infinity) = (NaN,infinity)
and (0,in
I'm using quantreg package version 5.98 of 24 May 2024, in R 4.4.1 on
Linux Mint.
The online documentation for quantreg says, in part, under the
description of the rq.object, "The coefficients, residuals, and effects
may be extracted by the generic functions of the same name, rather than
by the $
> x <- complex(imag = Inf)
> x
[1] 0+Infi
> x*1
[1] NaN+Infi
> x+0
[1] 0+Infi
R does the addition and subtraction "coordinatewise"; the C library handles
everything else. This results in 2 different ways the point at infinity is
printed.
(Correction requested if this is wrong)
Bert
On Thu, Sep
On 2024-09-05 6:12 p.m., Leo Mada wrote:
Dear Duncan,
Here is also the missing information:
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
Regarding the results:
atan(1i)
# 0+Infi
Re(atan(1i))
# 0
Im(atan(1i))
# Inf
0 + Inf i is
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.
> 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 wrote:
> Dear Bert,
>
> These be
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 num
Perhaps
> Inf*1i
[1] NaN+Infi
clarifies why it is *not* a bug.
(Boy, did that jog some long dusty math memories :-) )
-- Bert
On Thu, Sep 5, 2024 at 2:48 PM Duncan Murdoch
wrote:
> On 2024-09-05 4:23 p.m., Leo Mada via R-help wrote:
> > Dear R Users,
> >
> > Is this desired behaviour?
> > I
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
What version of R are you using and on what platform?
I get:
> atan(1i)
[1] 0.7853982+Infi
> atan(1i)/5
[1] NaN+Infi
on:
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.6.1
-- Bert
On Thu, Sep 5, 2024 at 1:23 PM Leo Mada via R-help
wrote:
> Dear R
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 were some changes in handling of complex numbers. But it looks like a bug.
Sincerely,
Leonard
[[alternative HTML version deleted]]
__
Thanks Greg and Bert for solving my problem.
This gives what I want:
myticks <- 2^(3*(0:11))
mylabels <- parse(text=paste0("2^",log2(myticks)))
xyplot(c+t+u~n,data=x,type="b", xlab="Size", ylab="Number of tangles",
scales=list(x=list(at=4*(1:9)),y=list(log=2,at=myticks,labels=
Do the "at" and "labels" components of the "scales" list argument to xyplot
not do what you want?
Cheers,
Bert
On Thu, Sep 5, 2024 at 4:05 AM Gerrit Draisma wrote:
> Dear R-helpers,
>
> In the plot below I would like to have labels at positions 2^(3*(0:10)),
> and keep the labels in the exponen
sigma(model)^2 will give the correct MSE. Also note that your model
matrix has intercept at
the end whereas vcov will have it at the beginning so you will need to
permute the rows
and columns to get them to be the same/
On Wed, Sep 4, 2024 at 3:34 PM Daniel Lobo wrote:
>
> Hi,
>
> I am trying to
Dear R-helpers,
In the plot below I would like to have labels at positions 2^(3*(0:10)),
and keep the labels in the exponential format.
I tried using yscale.components.default.
*This* gives the right format of the labels:
> yscale.components.default(lim= c(0,30),log=2)
$num.limit
[
16 matches
Mail list logo