I want to compute a function which creates the polynomial, if we know the degree and coefficients of that polynomial.
So, that is, I want to ask the user for the degree and for a vector with the coefficients. With this information I want to return the polynomial.
This is what I have right now
polynomial <- func{
m = readline("What is the degree of the polynomial?")
coefficients = readline("What are the coefficients of the polynomial?")
a = as.vector(coefficients)
}
Can someone help me further with this? R should treat the polynomial as a vector a = (a0, ..., am)