Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* This file: * http://angg.twu.net/MAXIMA/findchanges1.mac.html * http://angg.twu.net/MAXIMA/findchanges1.mac * (find-angg "MAXIMA/findchanges1.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * (defun m () (interactive) (find-angg "MAXIMA/findchanges1.mac")) * (find-es "maxima" "2022-2-C3-VR") * * Status: untested! */ findchanges1(f,a,b,n) := block([va,vb,c,vc], [va,vb] : [f(a),f(b)], for i: 1 thru n do (c : (a+b)/2, vc : f(c), if equal(va,vc) then [a,va]:[c,vc] else [b,vb]:[c,vc]), c)$ findchanges(Fboo,F,points,n, tag) := block([npoints,results,fboo,a,b,xa,ya,xb,yb,c], npoints : length(points), results : [], fboo(t) := Fboo(F(t)[1], F(t)[2]), for i: 1 thru npoints-1 do (a : points[i], b : points[i+1], if not equal(fboo(a), fboo(b)) then (c : float(binsearch(fboo,a,b,n)), push([F(c), c, tag], results) ) ), reverse(results))$ /* Local Variables: * coding: utf-8-unix * End: */