What happens why you try to multiply a number by a character string?
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: "b0" * 5
Out[1]: 'b0b0b0b0b0'
But in R
> "b0" * 5
Error in "b0" * 5 : non-numeric argument to binary operator
The %*% operator in your (mx %*% b) is giving the same complaint, because b is a list of two characters, which, of course are non-numeric. Matrices have to be all numeric or all character, so it stands to reason that their combinations do, as well.
The key, I think, lies in misunderstanding the third term in the image
See what happens if you turn those into numeric variables:
b0 <- as.matrix(pi)
b1 <- as.matrix(2.71828)
b <- rbind(b0,b1)
Heramb. My objective is to obtain a matrix of expressions to then apply and solve a system of equations.
I'm working to make an algorithm that presents a set of ordered pairs apply a least squares adjustment that looks for a polynomial of degree and that better fit in the set of ordered pairs.
I was thinking about doing it with a matrix approach. But more than solving the problem, I look for a tool that allows me to handle these concepts of algebra in R that are very important in engineering.
You are trying to perform a linear regression using linear algebra. Doing this kind of exercise it is always educational, but if you are more focused on exploring the applications of linear algebra, maybe you want to use a different tool for the job, like Matlab for example, because actually these concepts are more important while you are studying engineering than they are in real life scenarios.
Yes, I know, but despite the name of the Task View, there are packages that do symbolic algebra discussed in there anyway. But I agree that I should have made it clearer that that’s an imperfect starting point (I’d love to know of a better one! Symbolic math in R is a rather esoteric topic thus far).