Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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!