a newbe question



> a:(s3+B*s2+C*s+d)/(s+a);

> I would like to do this division and get the quadratic and the remainder
> both out as a formula to use later.
> How do I do this?

Is this what you have in mind?

(%i1) expr:(s^3+B*s^2+C*s+d)/(s+a);

3 2
s + B s + C s + d
(%o1) -------------------
s + a

(%i2) divide(part(expr,1),part(expr,2));

2 2 2 3
(%o2) [s + (B - a) s + C - a B + a , d - a C + a B - a ]

(%i3) %o2[1] + %o2[2]/part(expr,2);

2 3
d - a C + a B - a 2 2
(%o3) ------------------- + s + (B - a) s + C - a B + a
s + a


Now you can automate this by defining a function:

(%i4) divthru(q):=
if (not atom(q) and part(q,0)="//")
then
block([num,den,div,quo,rem],
num:part(q,1),
den:part(q,2),
div:divide(num,den),
quo:div[1],
rem:div[2],
quo+rem/den )
else q;

This can be written more compactly in Maxima, but I've written it out for
clarity.

(%i5) divthru(expr);

2 3
d - a C + a B - a 2 2
(%o5) ------------------- + s + (B - a) s + C - a B + a
s + a

(%i6) divthru((x+1)^3/(x+2));

1 2
(%o6) - ----- + x + x + 1
x + 2