similar to: Comparing complex numbers

Displaying 20 results from an estimated 3000 matches similar to: "Comparing complex numbers"

2001 Jan 17
2
PR#751
I'd just like to report a possible R bug--or rather, confirm an existing one (bug #751). I have had some difficulty using the polyroot() function. For example, in Win 98, R 1.1.1, > polyroot(c(2,1,1)) correctly (per the help index) gives the roots of 1 + (1*x) + (2*x^2) as [1] -0.5+1.322876i -0.5-1.322876i However, > polyroot(c(-100,0,1)) gives the roots of [1] 10+0i -10+0i
2007 Nov 23
1
complex conjugates roots from polyroot?
Hi, All: Is there a simple way to detect complex conjugates in the roots returned by 'polyroot'? The obvious comparison of each root with the complex conjugate of the next sometimes produces roundoff error, and I don't know how to bound its magnitude: (tst <- polyroot(c(1, -.6, .4))) tst[-1]-Conj(tst[-2]) [1] 3.108624e-15+2.22045e-16i
2001 Mar 19
2
A limitation for polyroot ? (PR#880)
Dear R Development Team, I have encountered the following difficulty in using the function polyroot under either NT4.0 (R version 1.2.1) or linux (R version 0.90.1). In the provided example, the non-zero root of c(0,0,0,1) depends on the results of the previous call of polyroot. R : Copyright 2001, The R Development Core Team Version 1.2.1 (2001-01-15) R is free software and comes with
2015 Oct 16
2
potencia fracional de un número negativo
El problema del módulo es que pierde el signo. En tu caso sale igual porque has invertido el signo del coeficiente en el polinomio (en realidad se me pasó a a mí advertir que el término independiente debe ir con signo negativo): .> polyroot(z=c(0.5,0,0,0,0,1)) [1] 0.7042902+0.5116968i -0.2690149+0.8279428i -0.2690149-0.8279428i [4] 0.7042902-0.5116968i -0.8705506+0.0000000i .> .>
2007 Apr 17
1
predict.ar() produces wrong SE's (PR#9614)
Full_Name: Kirk Hampel Version: 2.4.1 OS: Windows Submission from: (NULL) (144.53.251.2) Given an AR(p) model, the last p SE's are wrong. The source of the bug is that the C code (ver 2.4.0) assumes *npsi is the length of the psi vector (which is n+p), whilst the predict.ar function in R passes out as.integer(npsi), where npsi <- n-1. Some R code following reproduces the error. Let p=4,
2000 Nov 28
2
BUG: polyroot() (PR#751)
I have found that the polyroot() function in R-1.1.1(both solaris and Win32 version) gives totally incorrect result. Here is the offending code: # Polyroot bug report: # from R-1.1.1 > sort(abs(polyroot(c(1, -2,1,0,0,0,0,0,0,0,0,0,-2,5,-2,0,0,0,0,0,0,0,0,0,1,-2,1)))) [1] 0.8758259 0.9486499 0.9731015 1.5419189 1.7466214 1.7535362 1.7589484 [8] 2.0216317 2.4421509 2.5098488 2.6615572
2001 Jul 16
1
polyroot() (PR#751)
In a bug report from Nov.28 2000, Li Dongfeng writes: ----- I have found that the polyroot() function in R-1.1.1(both solaris and Win32 version) gives totally incorrect result. Here is the offending code: # Polyroot bug report: # from R-1.1.1 > sort(abs(polyroot(c(1,-2,1,0,0,0,0,0,0,0,0,0,-2,5,-2,0,0,0,0,0,0,0,0,0,1,-2)))) [1] 0.8758259 0.9486499 0.9731015 1.5419189 1.7466214 1.7535362
2006 Jul 08
2
String mathematical function to R-function
hello I make a subroutine that give-me a (mathematical) function in string format. I would like transform this string into function ( R function ). thanks for any tips. cleber #e.g. fun_String = "-100*x1 + 0*x2 + 100*x3" fun <- function(x1,x2,x3){ return( ############ evaluation( fun_String ) ############ ) True String mathematical function :-( :-( > nomes [1]
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script: #1) read in data: daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep="\t") daten<-as.matrix(daten) #2) create empty matrix: indxind<-matrix(nrow=617, ncol=617) indxind[1:20,1:19] #3) compare cells to each other, score: for (s in 3:34) { #walks though the matrix colum by colum, starting at
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users, I'm trying to transform a matrix A into B (see below). Anyone knows how to do it in R? Thanks. Matrix A (zone to zone travel time) zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0 B: from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1 4.3 z3 z2 2.5 z3 z3 0 The real matrix I have is much larger, with more than 2000 zones. But I think it should
2010 Jan 08
0
solving cubic/quartic equations non-iteratively -- comparisons
Hi, I'm responding to a post about finding roots of a cubic or quartic equation non-iteratively. One obviously could create functions using the explicit algebraic solutions. One post on the subject noted that the square-roots in those solutions also require iteration, and one post claimed iterative solutions are more accurate than the explicit solutions. This post, however, is about
2005 Aug 19
1
Using lm coefficients in polyroot()
Dear useRs, I need to compute zero of polynomial function fitted by lm. For example if I fit cubic equation by fit=lm(y~x+I(x^2)+i(x^3)) I can do it simply by polyroot(fit$coefficients). But, if I fit polynomial of higher order and optimize it by stepAIC, I get of course some coefficients removed. Then, if i have model y ~ I(x^2) + I(x^4) i cannot call polyroot in such way, because there is
2002 Mar 27
2
Error with nls
Dear R-group members, I use: platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.1 year 2002 month 01 day 30 language R I try to fit a 2 compartment model. The compartments are open, connected to each other and
2006 Jan 27
1
about lm restrictions...
Hello all R-users _question 1_ I need to make a statistical model and respective ANOVA table but I get distinct results for the T-test (in summary(lm.object) function) and the F-test (in anova(lm.object) ) shouldn't this two approach give me the same result, i.e to indicate the same significants terms in both tests??????? obs. The system has two restrictions: 1) sum( x_i ) = 1 2) sum(
2010 Jan 29
1
use zoo package with multiple column data sets
Readers, I am trying to use the zoo package with an array of data: file1: hh:mm:ss 1 hh:mm:ss 2 hh:mm:ss 3 hh:mm:ss 4 file2: hh:mm:ss 11 55 hh:mm:ss 22 66 hh:mm:ss 33 77 hh:mm:ss 44 88 I wanted to merge these data set so I tried the following commands: library(chron) library(zoo) z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
2006 Jun 15
3
matrix selection return types
Dear Rusers, I would like some comments about the following results (under R-2.2.0) > m = matrix(1:6 , 2 , 3) > m [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 > z1 = m[(m[,1]==2),] > z1 [1] 2 4 6 > is.matrix(z1) [1] FALSE > z2 = m[(m[,1]==0),] > z2 [,1] [,2] [,3] > is.matrix(z2) [1] TRUE Considered together, I'm a bit surprised about
2009 Mar 19
1
two plots side-by-side with persp3d(rgl)
Dear R-users, I would like to place two 3D plots side-by-side in a rgl-setting. It would nice to have something like "par(mfrow=c(1,2))" for basic plots, or an array framework for wireframe(lattice) (see example below). I only managed to overlap two persp3d plots. My final idea would be to animate both surfaces using play3d(rgl). Thanks in advance for any help. Best, Carlo Giovanni
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and z3 which is captured by "z" and "prob" as described below. For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13. Also, the probability adds up to 1. > head(z) z1 z2 z3 [1,] -0.46667 -1.0000 -1.0000 [2,] -0.33333 -0.9333 -0.9333 [3,] -0.20000 -0.8667 -0.8667
2009 Nov 24
1
Titles in plots overlap
Hi,   I use fCopulae package to draw different graphs of univariate and bivariate skew t.  But the plots titles overlap.  I tried using cex.main, font.main to adjust the size but they still overlaps.  Here is my code: par(mfrow = c(3, 1)) mu = 0 Omega = 1 alpha1 = 0 alpha2 = 1.5 alpha3 = 2 alpha4 = 0.5 Z1 = matrix(dmvst(x, 1, mu, Omega, alpha1, df = Inf), length(x)) Z2 = matrix(dmvst(x, 1, mu,
2009 Jul 02
1
lpSolve: how to allow variables to become negative
Dear all, I am interested in solving a MIP problem with binary outcomes and continuous variables, which ARE NOT RESTRICTED TO BE NEGATIVE. In particular, Max {z1,z2,z3,b1} z1 + z2 + z3 (s.t.) # 7 z1 + 0 z2 + 0 z3 + b1 <= 5 # 0 z1 + 8 z2 + 0 z3 - b1 <= 5 # 0 z1 + 0 z2 + 6 z3 + b1 <= 7 # z1, z2, z3 BINARY {0,1} # -5<= b1 <=5 (i.e. b1 <= 5; -b1 <= 5 ) Using