Thanks,  that's a start,  but my polynomials have some parameters
a,b,c,...
in the coefficients.  In Mathematica you say PolyomialRemainder[f,g,x]
where the
last 'x'  names the polynomial variable, so all other variables are
parameters.  When
I tried to modify your code by inserting  a=var('a')  and then
f=a*x^10,   it didn't work,
because now f only belongs to sage.symbolic.expression.Expression, and
not
to P.   Well,  obviously, because I didn't specify that a belongs to
QQ.   Is there
a way to do that so that I can work with parameters in the
coefficients of a polynomial?
Various guesses as to what might be the way to do that didn't work.

If there's an easy way that I should have been able to look this up
for myself I would like to know that even more than the specific
answer.

On another subject:
The documentation mentions the "ring" of symbolic expressions.   To be
a ring one needs to know when two symbolic expressions are equal.   Is
1/0  a symbolic expression and if so is it equal to oo ?   How about x-
x and 0?    x/x and 1?    More generally has anything been written
about the or "a" semantics for Sage?

Michael


On Jan 3, 12:42 pm, bump <[email protected]> wrote:
> On Jan 3, 10:59 am, Michael Beeson <[email protected]> wrote:
>
> > I am just learning Sage.   I tried to define a polynomial and then
> > find the polynomial remainder upon division by the
> > cyclotomic_polynomial(18), which is 1-x^3+x^6.    This is easily
> > accomplished in Mathematica using the PolynomialRemainder function.
> > But I could not find the analog of that function in the Sage
> > documentation.
> > What is the right way to do this in Sage?
>
> I think this is what you are trying to do:
>
> sage: P.<x> = PolynomialRing(QQ)
> sage: f = x^10+2*x^8+3*x+1
> sage: f in P
> True
> sage: g = cyclotomic_polynomial(18); g
> x^6 - x^3 + 1
> sage: f.quo_rem(g)
> (x^4 + 2*x^2 + x, 2*x^5 - 2*x^2 + 2*x + 1)
>
> The first term is the quotient and the second is the remainder. See
> sage: f.quo_rem?
>
> for the description of the method.
>
> Daniel Bump

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to