Displaying 20 results from an estimated 268 matches for "1i".
Did you mean:
l1i
2016 Mar 18
1
formatting of complex matrix
While working on the printing code, my colleague Zbyn?k ?lajchrt noticed that complex matrixes are sometimes misaligned:
> { matrix(1i,2,13) }
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i
[2,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i
(the values in the last four columns should be prefixed by two spaces instea...
2023 Nov 09
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...> instead of NA_complex_?
> My opinions:
> (1) No. The imaginary part of the result of parsing the strings "<b>i",
> "<a>+<b>i", and "<a>-<b>i" can be nonzero.
> Consider, e.g., Im(eval(str2lang("0+1i"))) and Im(as.complex("0+1i")).
> If NA_character_ means "a string with unknown content", then we should
> not assume that the string is parsed as a real number.
> (2) Yes. I'd very much like to preserve the identity of c(Im(NA), Im(x))
> a...
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
2023 Nov 08
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...real_, i=0)
instead of NA_complex_?
My opinions:
(1) No. The imaginary part of the result of parsing the strings "<b>i",
"<a>+<b>i", and "<a>-<b>i" can be nonzero.
Consider, e.g., Im(eval(str2lang("0+1i"))) and Im(as.complex("0+1i")).
If NA_character_ means "a string with unknown content", then we should
not assume that the string is parsed as a real number.
(2) Yes. I'd very much like to preserve the identity of c(Im(NA), Im(x))
and I...
2003 Jun 24
3
R-1.7.1 regression test failure on alphaev68-dec-osf5.1
...gression 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)))
> stopifnot(all.equal(log2(2^pi), 2^log2(pi)))
> stopifnot(Mod(pi - log(exp(pi*1i)) / 1i) < .Machine$double.eps)
Error: Mod(pi - log(exp(pi * (0+1i)))/(0+1i)) < .Machine$double.eps is
not TRUE
Execution halted
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I'm compiling on Tru64UNIX 5.1A using DECs C and Fortran compilers and
perl 5.6.0. I found the above error in a f...
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 data.table::shift()
However, these are now (r85472) different:
Im(c(NA, 0+1i))
# [1] NA 1
Im(c(as.complex(NA), 0+1i))
# [1] 0 1
The former m...
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...23 09:41:42 -0800 writes:
> 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 data.table::shift()
> However, these are now (r85472) different:
> Im(c(NA, 0+1i))
>...
2024 Sep 05
2
BUG: atan(1i) / 5 = NaN+Infi ?
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 <murdoch.duncan at gmail.com>
wrote:
> On 2024-09-05 4:23 p.m., Leo Mada via R-help wrote:
> > Dear R Users,
> >
>...
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...ercion works different that it used to, so that
as.complex(NA) == as.complex(NA_real) == NA_real_+0i)
which now differs from
NA_complex
although both print as NA.
I haven't been quite alert when this change was discussed, but it does look a bit unfortunate that usage patterns like c(NA, 0+1i) does not give complex NA for the 1st component, effectively changing the interpretation from "I don't know what this is" to "I don't know what this is but I'm sure it is on the real line".
Also, notice that things like
> Im(scan(text= "NA 0+1i", what...
2024 Sep 05
2
BUG: atan(1i) / 5 = NaN+Infi ?
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]]
2005 Apr 13
2
Inf +1i vs 1+Inf*1i
Hi
If I have
a <- Inf + 1i
then
Re(a) is Inf, and Im(a) is 1, as expected.
But if
b <- 1 + Inf * 1i,
then
Im(b) = Inf , as expected, but Re(b) = NaN, which I didn't expect.
Why this asymmetry? How to define an object with Re(b)=1, Im(b)=Inf?
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography C...
2023 Nov 07
1
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 data.table::shift()
>
> > However, these are now (r85472) differen...
2024 Sep 05
0
BUG: atan(1i) / 5 = NaN+Infi ?
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 a valid complex number:
> tan(atan(1i))
> # 0+1i
>
> Inf / 5
> # Inf
>
> Note: atan(1i) / 5 should have generated 0 + Inf * 1i; even the explicit
> complex number fails:
> c...
2005 Jun 15
0
(PR#7942) extra spaces before imag part when printing complex numbers
Prof Brian Ripley wrote:
> This is intentional: it aligns the numbers. E.g.
>
> >options(width=12)
> >print(c(1+1i, 1-10i, 1+100i))
> [1] 1+ 1i
> [2] 1- 10i
> [3] 1+100i
>
> Neat, eh?
>
> What made you think this was a bug?
Ah ok, I've misunderstood this feature probably perhaps
because, at first sight, I found the display looks "strange"
when some of the numbers have lar...
2024 Sep 06
0
BUG: atan(1i) / 5 = NaN+Infi ?
It seems to me that the documentation of R's complex class & R's atan function do not tell us what to expect, so (as others have suggested), some additional notes are needed. I think that mathematically atan(1i) should be NA_complex_, but R seems not to use any mathematically standard compactification of the complex plane (and I'm not sure that IEEE does either).
Incidentally, the signature of the complex constructor is confusing. complex(1L) returns zero, but complex(1L, argument=theta) is an elemen...
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...
2024 Sep 05
1
BUG: atan(1i) / 5 = NaN+Infi ?
..._________________________
From: Bert Gunter <bgunter.4567 at gmail.com>
Sent: Friday, September 6, 2024 1:12 AM
To: Duncan Murdoch <murdoch.duncan at gmail.com>
Cc: Leo Mada <leo.mada at syonic.eu>; r-help at r-project.org <r-help at r-project.org>
Subject: Re: [R] BUG: atan(1i) / 5 = NaN+Infi ?
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 <murdoch.duncan at gmail.com<mailto:murdoch.duncan at gmail.com>> wrote:
On 2024-09-05 4...
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 ano...
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
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,infinity)/5 = (0/5,i...
2005 Jul 11
1
Sweave and complex numbers
Hi
When using Sweave, most of my functions get called with complex
arguments.
They get typeset in with additions that I don't want; "1+1i" appears
as "1 + (0 + 1i)"
and I would rather have plain old "1+1i".
Example follows:
\documentclass[a4paper]{article}
\title{A Test File}
\author{Robin Hankin}
\usepackage{a4wide}
\begin{document}
\maketitle
A simple example:
<<print=TRUE>>=
f <-...