Displaying 20 results from an estimated 60 matches for "polyroot".
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.7...
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 ABSOL...
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
which corresponds to -100 + x^2, not 1 -...
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.7535...
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
abs(tst[-1]-Conj(tst[-2]))/abs(tst[-1])
1...
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 a need to call
polyroot(c(0,0,fit$coefficients[1],0,fit$coefficients...
2010 Jan 08
0
solving cubic/quartic equations non-iteratively -- comparisons
.... 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 comparative accuracy of (1) the R solve functionused in the included post, (2) the R polyroot function, (3) the Matlab roots function, (4) the SAS IML polyroot function. I tried the posted polynomial:
-8 + 14*x - 7*x^2 + x^3 = 0
and a repeating-roots example:
8 - 36*x + 54*x^2 - 27*x^3 = 0
I used Mathematica solutions as the reference:
(* Posted example *)
Roots[-8 + 14 x - 7 x...
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
.>
.> z_all <- polyroot(z=c(-0.5,0,0,0,0,-1))
.> z_all
[1] 0.7042902+0.5116968i -0.2690149+0.8279428i -0.2690149-0.8279428i
[4] 0.7042902-0.511696...
2008 Jul 11
1
Comparing complex numbers
Is there an easy way to compare complex numbers?
Here is a small example:
> (z1=polyroot(c(1,-.4,-.45)))
[1] 1.111111-0i -2.000000+0i
> (z2=polyroot(c(1,1,.25)))
[1] -2+0i -2+0i
> x=0
> if(any(identical(z1,z2))) x=99
> x
[1] 0
# real and imaginary parts:
> Re(z1); Im(z1)
[1] 1.111111 -2.000000
[1] -8.4968e-21 8.4968e-21
> Re(z2); Im(z2)
[1]...
2008 Oct 15
4
a really simple question on polynomial multiplication
Dear R people:
Is there a way to perform simple polynomial multiplication; that is,
something like
(x - 3) * (x + 3) = x^2 - 9, please?
I looked in poly and polyroot and expression. There used to be a
package that had this, maybe?
thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
2010 Jan 05
4
solving cubic/quartic equations non-iteratively
To R-helpers,
R offers the polyroot function for solving mentioned equations
iteratively.
However, Dr Math and Mathworld (and other places) show in detail how to
solve mentioned equations non-iteratively.
Do implementations for R that are non-iterative and that solve mentioned
equations exists?
Regards, Mads Jeppe
2012 Jan 24
1
problems with rollapply {zoo}
...so that the current record has rt = 0
d$rt <- seq(1-nrow(d),0)
# apply the regression to fit a 4th degree polynomial in rt
polyfit <- lm(Close ~ poly(rt,4),d)
# get the coefficients
p <- coef(polyfit)
# get the roots of the first derivative of the fitted polynomial
pr <- polyroot(c(p[2],2*p[3],3*p[4],4*p[5]))
# define a function that evaluates the second derivative as a function of x
dd <- function(x) { rv = 2*p[3]+6*p[4]*x+12*p[5]*x*x;rv;}
# evaluate the second derivative at the ith root, and print the result
r <- dd(pr[i])
r
}
rollRegFun(alpha,1)
r...
2015 Oct 15
3
potencia fracional de un número negativo
Mirando los comentarios, realmente lo que deseo es encontrar la raíz real
de (-0.5)^(1/5) la cual debería ser -0.87055056329. José me hace caer en
cuenta que además de no encontrar la raiz real, tampoco da todas las raiz
complejas. Habría alguna manera de que tuviera en cuenta?
> ------------------------------
>
> Message: 6
> Date: Thu, 15 Oct 2015 11:25:39 +0200
> From: José
2004 Mar 22
1
problem with seasonal arima
...lo to all
I've to calculate an arima model and I need only the
first and 365 th parameter and also the sar1 and the
intercept, so I'm traing with:
arima(X,order=c(365,0,0),seasonal=list(order=c(1,0,0),..),fixed=c(NA,rep(0,363),NA,NA,NA),transform.pars=F)
but the error answer is:
Error in polyroot(z) : polynomial degree too high (49
max)
also there are problems in allocating memory (I've 512
mb ram)
may be somebody could help me?
can R do it?
thanks
michele
______________________________________________________________________
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.c...
2009 Feb 17
0
What's the predict procedure of ARIMA in R?
...ncxreg <- ncxreg + 1
}
xm <- if (narma == 0)
drop(as.matrix(newxreg) %*% coefs)
else drop(as.matrix(newxreg) %*% coefs[-(1:narma)])
}
else xm <- 0
if (arma[2] > 0) {
ma <- coefs[arma[1] + 1:arma[2]]
if (any(Mod(polyroot(c(1, ma))) < 1))
warning("MA part of model is not invertible")
}
if (arma[4] > 0) {
ma <- coefs[sum(arma[1:3]) + 1:arma[4]]
if (any(Mod(polyroot(c(1, ma))) < 1))
warning("seasonal MA part of model is not invertible")...
2009 Mar 20
2
Finding determinants of x-loaded matrix?
R friends,
I need to find the determinant of this matrix
x 1 0 0
1 x 1 0
0 1 x 1
0 0 1 x
det yields x^4-3x^2+1
I can then use polyroot to find the roots of the coefficients.
The question is about the use of "x", which is what I'm solving for.
thanks in advance, and this is a back-burner question.
Apologies if I have posted this incorrectly/to the wrong place, I'm a newbie to
this list...
--
Robert Gotwals,...
2012 Apr 18
3
Is there a way to find all roots of a polynomial equation in R?
Is there a way to find all roots of a polynomial equation?
Lets say
x^5+a*x^4+b*x^3+c*x^2+d*x+e=0
how to find its all roots?
[[alternative HTML version deleted]]
2007 Apr 17
1
predict.ar() produces wrong SE's (PR#9614)
...he 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, n=6, then
> ar<-c(-0.5,0.25,-0.125,0.0625)
> Mod(polyroot(c(1,-ar))) # ar model is stationary
[1] 1.037580 2.444163 2.444163 2.581298
> #Pass in values as predict.ar does
> cumsum(c(1,.C("artoma",as.integer(4),as.double(ar),double(9),as.integer(5))[[3]][1:5]^2))
[1] 1.000000 1.250000 1.312500 1.328125 1.332031 1.332031
> #Pass in value...
2015 Oct 15
2
potencia fracional de un número negativo
No sé si he entendido bien la pregunta, pero creo que lo que quieres obtener es esto:
(as.complex(-0.5)^(1/5))
Saludos,Salva
> To: r-help-es en r-project.org
> From: canadasreche en gmail.com
> Date: Thu, 15 Oct 2015 10:45:10 +0200
> Subject: Re: [R-es] potencia fracional de un número negativo
>
> Hola.
> No sé si va por aquí, pero prueba a quitar el paréntesis a (-0.5)
>
2013 Mar 01
2
solving x in a polynomial function
Hi there,
Does anyone know how I solve for x from a given y in a polynomial
function? Here's some example code:
##example file
a<-1:10
b<-c(1,2,2.5,3,3.5,4,6,7,7.5,8)
po.lm<-lm(a~b+I(b^2)+I(b^3)+I(b^4)); summary(po.lm)
(please ignore that the model is severely overfit- that's not the point).
Let's say I want to solve for the value b where a = 5.5.
Any thoughts? I did