Description Usage Arguments Details Value Author(s) References Examples
find all roots of the equation,including complex roots
1 | allroots(a, b)
|
a |
vector of coefficients of the equation |
b |
vector of exponention of the equation,One one corresponding with a mentioned above |
a should be one one corresponding with b,or there might lead to wrong results
all roots of the equation,including complex roots.Besides,the inaccuracy error of the roots is also given
Bingpei Wu
a passage about finding all roots,whose author is Dequan Shang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
a=c(2,-1,-13,-1,-5)
b=c(4:0)
allroots(a,b)
## The function is currently defined as
function (a, b)
{
a1 = a
b1 = b
n = length(b) - 1
a = a/a[1]
b = matrix(0, ncol = n, nrow = n)
for (i in 1:(n - 1)) b[i, i + 1] = 1
for (i in 1:n) b[n, i] = -a[n + 2 - i]
c = eigen(b)
print(c$values)
print("inaccuracy error")
print(f(c$values, a1, b1))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.