polnm | R Documentation |
Returns a 2 column dataframe.
First column containts the independent variable.
Second column contains the dependent variable (polynomial outputs against the independent variable).
polnm(X, v)
X |
The independent variable against which the polynomial needs to be defined. |
v |
The vector comprising of the sequence of coefficients of the polynomials. |
Suppose that a polynomial is defined as y = ao + a1*x + a2*x^2 + a3*x^3 + ...
Then for the vector v,
v[1] = a0
v[2] = a1
v[3] = a2
v[4] = a3
.
.
.
so on and so forth
The returned value is always a dataframe with column names 'X' and 'Y'
Chitran Ghosal
S <- seq(-2, 2, by = 0.001) #define the independent variable
coeff <- c(0, 1, 1) #define the coefficient vector ( a0 = 0, a1 = 1, a2 = 1)
df <- polnm(X = S, v = coeff) #call the polnm function
plot(df$X, df$Y) #plot the output
##check the roots
abline(h = 0)
abline(v = c(-1, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.