1 | initial version |
Hello! Based on the statement of the question, this seems to be homework. It is important that you do it yourself without any help for two reason: (1) the exercise will show you some very important aspects and functionality of SageMath that you will find very useful in your professional life, and (2) if you can't solve this question by yourself, you won't be able to use the rest of SageMath efficiently (and---trust me on this---you really want to learn to use this beautiful piece of software).
However, I can give you some hints on how to proceed:
The exercise is self-explanatory. For example, the first step should be to execute x = var('x', n=7)
and explore the result. In an interactive session, you can write print(x)
or just x
to show the result on screen. I would also recommend, changing the 'x'
and the n=7
in order for you to understand the general behaviour.
SageMath is a mathematical software, and as such, it mostly uses mathematical notation: if there is a function called $det$ for matrices, changes are that Sage defines the function or method det
. If you don't know how it works, you can always write something like det?
(Concerning the previous point, you can also use var?
in order to learn more about the command.) This is a convenient feature predefined in Sage.
Your second step in solving the exercise should be call the method number_of_operands
on the polynomial p
. Since this is a method, you want to use the suffix dot notation: p.number_of_operands()
. Once again, in case of doubt, call p.number_of_operands?
Based on point 2, you should be able to deduce how to start on the factorization of p
. Additional hint: you don't need to code a subroutine to factor it, Sage has one.
These points should cover the behaviour of Sage regarding the commands. The fourth point of the question is simple observation and description of a property of Vandermonde matrices. You will have a pleasant surprise here.
One reminder: there is a Sage function for creating matrices. It is called---creatively enough---matrix
. You already know how to learn how it works.
The Sage website (www.sagemath.org) has a list of great resources (most of them free) for learning it. I recommend Prof. Gregory Bard's book, "Sage for Undergraduates" for this kind of problems. It will give you an excellent introduction to the subject.
Hope this helps! Sorry for the long message.