Displaying 20 results from an estimated 3000 matches similar to: "printing of complex numbers in R-alpha"
2006 Dec 18
2
write() gotcha
Hi
I used write() the other day to save some results.
It seems that write() does not record the full precision of
the objects being written:
> write(pi,file="~/f",ncolumns=1)
> pi.saved <- scan("~/f")
Read 1 item
> dput(pi)
3.14159265358979
> dput(pi.saved)
3.141593
> pi-pi.saved
[1] -3.464102e-07
>
This difficulty was particularly difficult to
2006 Jul 11
1
invalid alignment error in R-2.4.0
Hi
I thought I'd pass one of my package through R CMD check with R-2.4.0
with the following result (it's clean under R-2.3.1):
[snip]
>
> # histogram of the fourth power:
> hist(out^4, col="gray")
*** caught bus error ***
address 0x12, cause 'invalid alignment'
Traceback:
1: sort(x, partial = c(half, half + 1))
2: sum(sort(x, partial = c(half, half +
2006 Sep 15
1
setMethod() woes
Hello everybody
R version 2.4.0 alpha (2006-09-15 r39323), MacOSX 10.4.7
Next S4 problem.
I have "brob" objects that are large real numbers, and now I want "glub"
numbers that are to be a pair of glubs that represent complex numbers.
I want to define binary operator "+" so that if either the left or right
argument are glubs, it uses .ArithGlub.
If either
2005 Apr 29
1
accuracy of test cases
Hi
I have several methods for evaluating a function. The methods are
algebraically
identical but use different numerical techniques. The different methods
work
better (converge faster, etc) in different parts of the function's
domain.
I am compiling a test suite for a package, and would like to verify
that the
different methods return approximately identical results.
Toy example
2005 Jan 07
1
Visualizing complex analytic functions using domain coloring
Hi
has anyone coded up domain colouring for visualizing complex analytic
functions
(such as elliptic functions)?
[
the idea is to depict a complex function f(z) using a filled.contour()
variant
in which the hue is given by Arg(f(z)), and the saturation by Mod(f(z)).
]
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
tel
2006 Apr 06
1
R CMD check for packages in a bundle
Hi
[MacOsX 10.4.6; R-2.2.1]
I have a bundle that comprises three packages. I want to run R CMD
check on
each one individually, as it takes a long time to run on all three.
I am
having problems.
The bundle as a whole passes R CMD check, but fails when I cd to the
bundle
directory and run R CMD check on a package directory.
The whole bundle passes:
octopus:~/scratch% R CMD check
2018 Jul 10
1
problem with display of complex number
Hi,
> 1e10+5i
[1] 1e+10+0e+00i
> Im(1e10+5i)
[1] 5
maybe little better...
--- R-3.5.1.orig/src/main/complex.c 2018-03-26 07:02:25.000000000 +0900
+++ R-3.5.1/src/main/complex.c 2018-07-10 12:50:42.523874767 +0900
@@ -381,6 +381,7 @@
r->i = fround(pow10 * x->i, digits)/pow10;
} else {
digits = (double)(dig);
+ if(digits < 1) digits=1; /* a little better */
2005 Feb 16
3
real and complex vectors
The following caught me off-guard:
R> z <- 1i + 1:10
R> z <- Re(z)
R> z
[1] 1 2 3 4 5 6 7 8 9 10
as expected. But look:
R> z <- 1i + 1:10
R> make.real <- abs(z) < 1000
R> z[make.real] <- Re(z[make.real])
R> z
[1] 1+0i 2+0i 3+0i 4+0i 5+0i 6+0i 7+0i 8+0i 9+0i 10+0i
R>
didn't make z a real vector, which is what I wanted.
2006 May 22
1
R CMD check problem
Hi
I have a package that I'm testing.
It seems to install fine and it works, as far as I can tell.
For example, I can install the package, and use it,
and source the test suite with no errors.
My problem is with R CMD check.
It passes on R-2.2-0:
Robin-Hankins-Computer:~/scratch% R CMD check ./partitions_1.1-0.tar.gz
* checking for working latex ... OK
[snip]
make[1]: Leaving directory
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
2006 Sep 12
1
package.skeleton() in R-2.4.1
Hi
R version 2.4.0 alpha (2006-09-06 r39158)
MacOSX 10.4.7
There was a thread some time ago as to whether the structure created by
package.skeleton() would pass R CMD check.
I have an example where package.skeleton() gives an R file that gives an
error when sourced.
If I type
setClass("brob",
representation = representation
2004 Jul 05
1
"make" error for R-1.9.1
Hello everybody.
I am trying to upgrade from R-1.9.0 to R-1.9.1 on a RedHat linux
2.4.18 system. I get
the following error after "tar -xvzf R-1.9.1.tgz ; cd ./R-1.9.1/ ; ./configure"
and "make" :
[make works for 10 minutes ... snip ...]
varExp text html latex
varFixed text html latex
varFunc
2005 Jan 11
1
integrate() and complex values
[apologies for possible multiple post]
Hi
The manpage for integrate() does not mention imaginary numbers.
I found the following unexpected:
> integrate(function(x){0*x+1+1i},0,1)
1 with absolute error < 1.1e-14
>
(I would expect 1+1i here)
One can write a little wrapper, but it's not straightforward.
Would it be hard to accommodate such functions in integrate()?
Some other
2004 Sep 13
1
Rd files with "%" (was: permuting dimensions)
Professor Ripley
thanks for this. Very much appreciated.
The original subject line reflected my late-night conviction
that the answer might involve passing a strange list to do.call().
Anyway, package magic is broken (only in R-devel, I might add) because I have
a function called "%eq%".
R-2.0.0 CMD check is stopping (I think) because it interprets the
"%" as a
2006 Feb 22
3
elements that appear only once
Hi.
I have a factor and I want to extract just those elements that appear
exactly once.
How to do this?
Toy example follows.
> a <- as.factor(c(rep("oak",5) ,rep("ash",1),rep("elm",1),rep
("beech",4)))
> a
[1] oak oak oak oak oak ash elm beech beech beech beech
Levels: ash beech elm oak
> table(a)
a
ash beech elm oak
2006 Feb 28
2
lines() and recycled colours
Hi
?lines says
For 'type = "h"', 'col' can be a vector and will be recycled as
needed.
Why doesn't lines() recycle colours for other types?
If I type
> plot(0:1,0:1,type="n")
> lines(runif(11),runif(11),col=c("red","green"))
>
then all ten lines are red, with no warning given. Is there a reason
why
2007 Mar 19
3
character to numeric conversion
Hi.
Is there a straightforward way to convert a character string
containing comma-delimited
numbers to a numeric vector?
In my application, I use
system(executable.string, intern=TRUE)
which returns a string like
"[0.E-38, 2.096751179214927596171268230,
3.678944959657480671183123052, 4.976528845643001020345216157,
6.072390165503099343887569007, 7.007958550337542210168866070,
2005 Jun 13
3
extracting components of a list
Hi
how do I extract those components of a list that satisfy a certain
requirement? If
jj <- list(list(a=1,b=4:7),list(a=5,b=3:6),list(a=10,b=4:5))
I want just the components of jj that have b[1] ==4 which in this case
would be the first and
third of jj, viz list (jj[[1]],jj[[3]]).
How to do this efficiently?
My only idea was to loop through jj, and set unwanted components to
NULL,
2006 Jul 26
2
largest acceptable lookup table in a package
Hi
One of my packages needs a look-up table of pre-calculated
numbers in the data directory.
I would like to have the matrix as large as possible.
What is the largest size matrix that would be an acceptable datafile in
an R package?
[
The table is a square, upper triangular matrix
consisting of logs of Stirling numbers calculated by Maple.
As discussed on the List a few days ago (thanks
2006 Jul 25
2
pari/gp interface
Hi
I'm developing an R package that
needs to execute some code written in pari/gp.
I've used this before from an R package (elliptic) but the interface
is very
basic: the R function creates a string such as the following:
string <- echo ' ellwp ([ 2+0*I , 0+2*I ], 1+0*I )' | gp -q
And then
system(string)
returns the output from gp which then needs to be text processed