Displaying 20 results from an estimated 6000 matches similar to: "How to calculate modulus of complex number"
2001 Apr 28
2
Modulus operator??
I'm trying to do a modulus operator in R-1.2.2 on Windows -- specific
version:
R : Copyright 2001, The R Development Core Team
Version 1.2.2 Patched (2001-03-22)
Here's what the R language manual says:
"R contains a number of operators. They are listed in the table below.
[snip]
% Modulus, binary"
Here's what happens on the R console:
> records <- 100000
>
2006 Jan 30
4
Integer bit size and the modulus operator
I am a statistician and I come up to an interesting problem in
cryptography. I would like to use R since there are some statistical
procedures that I need to use.
However, I run into a problem when using the modulus operator %%.
I am using R 2.2.1 and when I calculate modulus for large numbers (that
I need with my problem) R gives me warnings. For instance if one does:
a=1:40;
8^a %% 41
one
2005 Jul 13
2
Efficient testing for +ve definiteness
Dear R-users,
Is there a preferred method for testing whether a real symmetric matrix is
positive definite? [modulo machine rounding errors.]
The obvious way of computing eigenvalues via "E <- eigen(A, symmetric=T,
only.values=T)$values" and returning the result of "!any(E <= 0)" seems
less efficient than going through the LU decomposition invoked in
2011 Nov 03
2
[PATCH 4 of 5] virtio: avoid modulus operation
Since we know vq->vring.num is a power of 2, modulus is lazy (it's asserted
in vring_new_virtqueue()).
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
---
drivers/virtio/virtio_ring.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@
2011 Nov 03
2
[PATCH 4 of 5] virtio: avoid modulus operation
Since we know vq->vring.num is a power of 2, modulus is lazy (it's asserted
in vring_new_virtqueue()).
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
---
drivers/virtio/virtio_ring.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@
2006 Jan 30
2
[R] Integer bit size and the modulus operator (PR#8541)
On 1/30/2006 1:39 PM, Ionut Florescu wrote:
> Thank you for the quick reply, I will look into the R packages.
> For crashing R try this:
>
> generator.zp=function(x,p)
> {a=1:(p-1); b=x^a%%p;
> if(all(b[1:(p-2)]!=1)&&(b[p-1]==1)){return(x, " Good ")}
> else{return(x, " No Good, try another integer ")}
> }
Thanks, I can reproduce the crash using
2004 Dec 08
2
Modulus Problem
R users, I am having a problem with the modulus operator for large
numbers as follows,
a <- 2
n <- 561
## n is the first Carmichael number, so by Fermat's Little Theorem the
below should equal zero.
(a^(n-1) - 1) %% n
[1] 2.193172e+152
## Seems that R and Fermat disagree
## Also,
1000000000000000000 %% 11
[1] -32
This seems like a bug. Should I be avoiding integer math for large
2012 Sep 25
1
REML - quasipoisson
hi
I'm puzzled as to the relation between the REML score computed by gam and
the formula (4) on p.4 here:
http://opus.bath.ac.uk/22707/1/Wood_JRSSB_2011_73_1_3.pdf
I'm ok with this for poisson, or for quasipoisson when phi=1.
However, when phi differs from 1, I'm stuck.
#simulate some data
library(mgcv)
set.seed(1)
x1<-runif(500)
x2<-rnorm(500)
2000 Jul 06
1
factorial(), modulus()
Dear R friends,
I was wondering if there were factorial and modulus functions out there
that I've somehow overlooked?
-P.
--
Peter L. Hurd, Ph.D.
phurd at uts.cc.utexas.edu
http://www.zo.utexas.edu/research/phurd fax 512.471-3878
Section of Integrative Biology, University of Texas, Austin TX 78712 USA
2001 Apr 28
1
modulus operator gets syntax error (PR#925)
Full_Name: M. Edward Borasky
Version: 1.2.2
OS: both Windows 2000 and Red Hat Linux 7.1
Submission from: (NULL) (208.130.245.188)
According to the R language manual, "%" is the modulus operator. However, on
both Windows and Linux, I get a syntax error when I type
records <- 100000
records % 1000
I tried wrapping the operands with "as.integer ()" but that didn't help
2007 Jun 29
4
Dominant eigenvector displayed as third (Marco Visser)
Dear R users & Experts,
This is just a curiousity, I was wondering why the dominant eigenvetor and eigenvalue
of the following matrix is given as the third. I guess this could complicate automatic selection
procedures.
0 0 0 0 0 5
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
Please
2009 Dec 01
1
eigenvalues of complex matrices
Dear all,
I want to compute the eigenvalues of a complex matrix for some statistics.
Comparing it to its matlab/octave sibling, I don't get the same eigenvalues
in R computing it from the exact same matrix.
In R, I used eigen() and arpack() that give different eigenvalues. In
matlab/octave I used eig() and eigs() that give out the same eigenvalues but
different to the R ones.
For real
2010 Mar 31
2
Should as.complex(NaN) -> NA?
I'm having trouble grokking complex NaN's.
This first set examples using complex(re=NaN,im=NaN)
give what I expect
> Re(complex(re=NaN, im=NaN))
[1] NaN
> Im(complex(re=NaN, im=NaN))
[1] NaN
> Arg(complex(re=NaN, im=NaN))
[1] NaN
> Mod(complex(re=NaN, im=NaN))
[1] NaN
> abs(complex(re=NaN, im=NaN))
[1] NaN
and so do the following
> Re(complex(re=1,
2003 May 19
0
FW: modulus operator?
try "%%" as the modulus operator and "%/%" for integer division
eg 5%%2 equals 1
John Marsland
> > -----Original Message-----
> > From: Anna H. Pryor [mailto:anna at ptolemy.arc.nasa.gov]
> > Sent: 19 May 2003 16:56
> > To: R Help
> > Subject: [R] modulus operator?
> >
> >
> >
> > Is there a modulus operator in R?
2010 Jun 28
2
Note on PCA (not directly with R)
Dear all, I am looking for some interactive study materials on Principal
component analysis. Basically I would like to know what we are actually
doing with PCA? What is happening within the dataset at the time of doing
PCA.
Probably a 3-dimensional interactive explanation would be best for me.
I have gone through some online materials specially Wikipedia etc, however
what I need a "movable
2013 Oct 03
0
DH modulus size
With the default openssh configuration, the selected cipher is
aes128-ctr. This means that dh_estimate gets called with bits=128, so
dh_estimate selects a DH modulus size of 1024 bits.
This seems questionable. Since the NSA seems to be sniffing most
internet traffic, keeping SSH sessions secure against after-the-fact
offline attack matters, and 1024-bit DH is not convincingly secure
against
2005 May 11
7
bug in modulus operator %% (PR#7852)
The following can't be right,
first rw2010:
> 1 %% 0.001
[1] 0.001
Then rw2001:
> 1 %% 0.001
[1] -2.081668e-17
>
and the last seems about right.
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
-- Mahdi Elmandjra
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
2006 Nov 22
3
odd behaviour of %%?
Dear R Helpers,
I am trying to extract the modulus from divisions by a sequence of
fractions.
I noticed that %% seems to behave inconsistently (to my untutored eye),
thus:
> 0.1%%0.1
[1] 0
> 0.2%%0.1
[1] 0
> 0.3%%0.1
[1] 0.1
> 0.4%%0.1
[1] 0
> 0.5%%0.1
[1] 0.1
> 0.6%%0.1
[1] 0.1
> 0.7%%0.1
[1] 0.1
> 0.8%%0.1
[1] 0
> 0.9%%0.1
The modulus for 0.1, 0.2, 0.4 and 0.8 is
2007 Dec 07
0
Studentized maximum modulus distribution
Can anyone tell me how to calculate quantiles of the studentized maximum modulus distribution using R?
Thanks!
__________________
Rob Kabacoff, Ph.D.
www.statmethods.net
[[alternative HTML version deleted]]