Ask Your Question

# Polynomial division command

hello I found this post from sage documents for division of two polynomials

def division(dividend, divisor) :
print 'quotient: ', (dividend._maxima_().divide(divisor).sage())
print 'remainder: ', (dividend._maxima_().divide(divisor).sage())


but could you please explain a little bit about this post? such as what is divided.maxima_() ?

edit retag close merge delete

## Comments

Perhaps [this](http://199.219.158.222/home/pub/0/) is the post you mention.

## 1 Answer

Sort by » oldest newest most voted The dividend._maxima_() returns the coercion of dividend to an object of the maxima interface. It seems it is only used to access the divide method, as symbolic expressions don't have this method.

Update:

As @kcrisman suggested, maxima_methods() can be used too. This provides a better approach, as it avoids using the underscored method _maxima_().

sage: f(x)=x^3+5*x^2-3*x+1
sage: g(x)=x+1
sage: f.maxima_methods().divide(g)
[x^2 + 4*x - 7, 8]


Perhaps it would be better to define the function as:

def division(dividend, divisor) :
q,r = dividend.maxima_methods().divide(divisor)
print 'quotient: ', q
print 'remainder: ', r


Thanks to @kcrisman for suggesting this!

more

## Comments

It is relevant in the sense that it uses the divide method. This method belongs to the coerced object, so my guess is that it uses maxima for that.

2

Presumably one could use maxima_methods() for this, then?

1

Hi! Good night! Can you explain me what maxima_methods does in this program?

## Your Answer

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

Add Answer

## Stats

Asked: 2013-04-02 15:37:22 +0200

Seen: 8,731 times

Last updated: Apr 02 '13