roots of polynomial
f= z^3 + (3a + 4)z^2 + 3z + 3a + 2 # z is variable f1=f.roots() [(3a + 1, 1), (2a, 2)]# what is 1 and 2 represent in the bracket
f= z^3 + (3a + 4)z^2 + 3z + 3a + 2 # z is variable f1=f.roots() [(3a + 1, 1), (2a, 2)]# what is 1 and 2 represent in the bracket
It is the multiplicity of the respective root. Try factoring the polynomial with f.factor()
and you will see.
Whenever in doubt about the output of a function, use help
or `?``
to check its documentation.
Here, you can do:
sage: help(f.roots)
sage: f.roots?
and this will display the documentation for f.roots
,
which documents that it returns pairs (root, multiplicity),
and explains how to use an optional argument to not
display the mutiplicities.
To skip the multiplicities:
f.roots(multiplicities=False)
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2019-06-09 07:17:00 +0100
Seen: 739 times
Last updated: Jun 10 '19
To display inline code, like
expr = x*y*z
, use backticks.For instance, compare the input and output without backticks:
to the ones with backticks:
Notice how in one case the
*
are preserved, while in the other case they just make the y italics.To display blocks of code or error messages, skip a line above and below, and do one of the following (all give the same result):
For instance, typing
produces:
Could you edit your question to take these points into account?
Please also keep that in mind for future questions.
It makes the code display correctly, and makes it possible to copy and paste.
In that way it helps other users who try to answer your questions.
Please include complete code that allows to reproduce the input and output in the question.
For example, you probably defined
a
in some way, which you did not provide.