First time here? Check out the FAQ!

Ask Your Question
0

roots of polynomial

asked 5 years ago

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

Preview: (hide)

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 ( 5 years ago )

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 ( 5 years ago )

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 ( 5 years ago )

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 ( 5 years ago )

2 Answers

Sort by » oldest newest most voted
1

answered 5 years ago

rburing gravatar image

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

Preview: (hide)
link
0

answered 5 years ago

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)
Preview: (hide)
link

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: 5 years ago

Seen: 863 times

Last updated: Jun 10 '19