Ask Your Question
0

Polynomial division command

asked 2013-04-02 15:37:22 +0100

Neda gravatar image

updated 2013-04-02 16:35:08 +0100

kcrisman gravatar image

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

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

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

edit retag flag offensive close merge delete

Comments

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

fidbc gravatar imagefidbc ( 2013-04-02 17:08:19 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-04-02 17:07:08 +0100

fidbc gravatar image

updated 2013-04-02 18:37:57 +0100

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!

edit flag offensive delete link more

Comments

so it isn't relevant to maxima computation system?

Neda gravatar imageNeda ( 2013-04-02 17:12:14 +0100 )edit

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.

fidbc gravatar imagefidbc ( 2013-04-02 18:06:21 +0100 )edit
2

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

kcrisman gravatar imagekcrisman ( 2013-04-02 18:12:23 +0100 )edit
1

It seems so, I'll update the answer.

fidbc gravatar imagefidbc ( 2013-04-02 18:26:39 +0100 )edit

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

Mathematic gravatar imageMathematic ( 2017-05-23 00:30:06 +0100 )edit

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: 2013-04-02 15:37:22 +0100

Seen: 14,504 times

Last updated: Apr 02 '13