You are right, the test p=1 q=m was only necessary at some point were I had output like '((mplus simp)), which is not printed as 0.
I didn't check after modifications. Now I think it's, at last, usable, thank you !
?
About substpart / apply, I thought in some cases there could be problems of that kind:
?
substpart(diff, [sin(x), x], 0);
diff(sin(x),x)
?
apply(diff, [sin(x), x]);
cos(x)
?
But I didn't investigate more, and I think you are right.
?
At least, it was a very instructive experience for me, since I am quite new to both lisp and maxima.
Thanks for your comments !
?
Jean-Claude Arbaut
?
> Message du 01/09/12 23:09
> De : "Stavros Macrakis"
> A : "Jean-Claude ARBAUT"
> Copie ? : "maxima"
> Objet : Re: [Maxima] some thoughts about rempart
>
> You could use apply(op(e), ...) instead of substpart(op(e)...) and args(e) instead of substpart("[",e,0). ?I don't think you need to special-case p=1 q=m, either. ?How about:
>
rempart(e,n):=block([p,q,argse:args(e)],
? ? ? ? ? ? ? ? if listp(n) then [p,q]:n else p:q:n,
? ? ? ? ? ? ? ? apply(op(e),append(rest(argse,-length(e)+p-1),rest(argse,q))))
>
This also is consistent with part re. inpart.
>
? ? ? ? ? ? ? ? -s