I hope if someone knows how to express the following Mupad code in Python:
for n from 1 to 6 do
M:= matrix([[B(k,j) $ k = 0..n] $ j = 0..n]);
C:=matrix([c(j)$ j = 0..n]);
A:=linalg::matlinsolve(M, C);P:=sum(A[j+1]*x^j, j = 0..n);plot(P,fx, x =-1..1);
end_for:
I don't understand this code at all, but here's some tips...
For-loops in Python look like this (this is Python shell):
Not knowing Mupad I am unsure if
for n from 1 to 6 domeans:I see that there's references of "matrix", for that see the commonly used library NumPy and their documentation on numpy.matrix. It already has a lot of methods for your simplicity.
Your best option is probably to search up the NumPy alternative rather than do the work with this piece of code.