Ask Your Question
0

roots of polynomial

asked 2019-06-09 07:17:00 +0100

santoshi gravatar image

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

edit retag flag offensive close merge delete

Comments

To display inline code, like expr = x*y*z, use backticks.

For instance, compare the input and output without backticks:

Having defined expr = x*y*z, how do I recover the individual factors?

Having defined expr = xyz, how do I recover the individual factors?

to the ones with backticks:

Having defined `expr = x*y*z`, how do I recover the individual factors?

Having defined expr = x*y*z, how do I recover the individual factors?

Notice how in one case the * are preserved, while in the other case they just make the y italics.

slelievre gravatar imageslelievre ( 2019-06-10 13:06:03 +0100 )edit

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):

  • indent all code lines with 4 spaces
  • select all code lines and click the "code" button (the icon with '101 010')
  • select all code lines and hit ctrl-K

For instance, typing

If we define `f` by

    def f(x, y, z):
        return x * y * z

then `f(2, 3, 5)` returns `30` but `f(2*3*5)` gives:

    TypeError: f() takes exactly 3 arguments (1 given)

produces:

If we define f by

def f(x, y, z):
    return x * y * z

then f(2, 3, 5) returns 30 but f(2*3*5) gives:

TypeError: f() takes exactly 3 arguments (1 given)
slelievre gravatar imageslelievre ( 2019-06-10 13:06:24 +0100 )edit

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.

slelievre gravatar imageslelievre ( 2019-06-10 13:08:16 +0100 )edit

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.

slelievre gravatar imageslelievre ( 2019-06-10 13:13:27 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-06-09 08:23:05 +0100

rburing gravatar image

It is the multiplicity of the respective root. Try factoring the polynomial with f.factor() and you will see.

edit flag offensive delete link more
0

answered 2019-06-10 13:15:24 +0100

slelievre gravatar image

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-06-09 07:17:00 +0100

Seen: 721 times

Last updated: Jun 10 '19