Ask Your Question

Hit's profile - activity

2020-09-08 16:29:01 +0200 received badge  Student (source)
2020-09-07 05:51:40 +0200 received badge  Scholar (source)
2020-09-07 05:51:37 +0200 commented answer Division algorithm in one variable

Hi! After playing and reading for a while after posting the question I managed to make it look similar to yours, but still wasn't compiling correctly. Now I see why

Thanks a ton, mate!!

2020-09-07 01:47:27 +0200 asked a question Division algorithm in one variable

Hi! I'm trying to implement the division algorithm 'by hand' (yes, I know the existence of f.maxima_methods().divide(g))

So far I've came up with this:

def div(f,g):
q==0; r==f;
while r != 0 and g.lt().divides(r.lt()):
q==q+r.lt()/g.lt()
r==r-(r.lt()/g.lt())*g
return q,r

but I'm getting an error on the "while" line. I'm following Ideals, Varieties and Algorithms by Cox (page 39 of the book), and they insert a "do" at the end of the while line, but I'm getting an "invalid syntax" error there. I'm pretty inexperienced with coding, and even more with Python/Sage (I've only taken a numerical methods course with Fortran).

I've gotten this "far" reading the book + documentation. Any ideas on how to proceed here?