###################################################################### ## This is a set of functions provided for the first TP ## ## During the TP you have to complete this file, worksheet is only ## ## for experimentale part, not for programming. ## ###################################################################### MySolve := proc(f,x,a,b) RETURN({solve({f,x>=a,x<=b},x)}); end: MyFuncPlot := proc (f, x, a, b, grid) RETURN(CURVES([seq([a+(b-a)*i/grid, evalf(eval(f, x = a+(b-a)*i/grid))], i = 0 .. grid)])); end proc; PathFollowing := proc (Z, f, x, nbstep, prec) local F, i, j, delta, Pts; F := Homotop(Z, f, t, x); if IsGoodPath(F, t, x) = 0 then print("Bad starting point !"); RETURN(0) else delta := 1/nbstep; Pts := Z; for i to nbstep do Pts := [seq(MyNewtonMethod(eval(F, t = i*delta), x, Pts[j], prec), j = 1 .. nops(Pts))]; end do; RETURN(Pts); end if; end proc; GraphPathFollowing := proc (Z, f, x, nbstep, prec) local F, i, j, delta, Pts, s, Paths; F := Homotop(Z, f, t, x); if IsGoodPath(F, t, x) = 0 then print("Bad starting point !"); RETURN(0) else print("Path seem to be ok !"); delta := 1/nbstep; Pts := Z; s := nops(Pts); Paths := [seq([], j = 1 .. s)]; for i to nbstep do Pts := [seq(MyNewtonMethod(eval(F, t = i*delta), x, Pts[j], prec), j = 1 .. nops(Pts))]; Paths := [seq([op(Paths[j]), [Re(Pts[j]), Im(Pts[j])]], j = 1 .. s)] end do; Paths := [seq(CURVES(Paths[j]), j = 1 .. s)]; RETURN(Paths); end if; end proc;