3 Generate figure for colnew example 1
10 /* Function to generate list of n+1 equally spaced values */
11 xlist(xmin,xmax,n):=block([dx:(xmax-xmin)/n],makelist(i,i,0,n)*dx+xmin)$
12 X: xlist(aleft,aright,500)$
14 /* First run: No initial approx provided */
17 [iflag, fspace, ispace] :
18 colnew_expert(ncomp, m, aleft, aright, zeta, ipar, ltol, tol,
19 fixpnt, ispace, fspace,
20 0, fsub, dfsub, gsub, dgsub, dummy)$
22 /* Generate solution values */
23 ans:colnew_appsln(X,4,fspace,ispace)$
25 /* List of first variable */
26 z1:maplist(first,ans)$
28 /* Second run: initial approx provided */
31 [iflag, fspace, ispace] :
32 colnew_expert(ncomp, m, aleft, aright, zeta, ipar, ltol, tol,
33 fixpnt, ispace, fspace,
34 0, fsub, dfsub, gsub, dgsub, solutn)$
36 /* Generate solution values */
37 ans:colnew_appsln(X,4,fspace,ispace)$
39 /* List of first variable */
40 z2:maplist(first,ans)$
42 plot2d([[discrete,X,z1],[discrete,X,z2]],
43 [legend,"Solution I","Solution II"],
46 [pdf_file,"./figures/colnew-ex2.pdf"]);
48 plot2d([[discrete,X,z1],[discrete,X,z2]],
49 [legend,"Solution I","Solution II"],
52 [png_file,"./figures/colnew-ex2.png"]);