cast_s := proc (ps, f) local s; global old_s, nk, nz; s := old_s; if s <= ps then s := s+f(nk); nk := nk+2 else s := s+f(nz); nz := nz+2 fi; old_s := s ; RETURN(s) end; clen := proc (ps, f) local s, h; global old_s, nk, nz; s := old_s; if s <= ps then h := f(nk); s := s+h; nk := nk+2 else h := f(nz); s := s+h; nz := nz+2 fi; old_s := s; RETURN(h) end; preskl := proc (ps, n, fce, prom) local f, s, l; global old_s, nk, nz; f := unapply(fce,prom); if 0 < f(1) then nk := 1; nz := 2 else nk := 2; nz := 1 fi; s := 0; old_s := 0; l := [seq([i, clen(ps,f,nk,nz)],i = 1 .. n)]; RETURN( pointplot(l,symbol = CIRCLE)) end; rieman := proc (ps, n, fce, prom) local f, s, l; global old_s, nk, nz; f := unapply(fce,prom); if 0 < f(1) then nk := 1; nz := 2 else nk := 2; nz := 1 fi; s := 0; old_s := 0; l := [seq([i, cast_s(ps,f,nk,nz)],i = 1 .. n)]; RETURN (display({pointplot(l,symbol = CIRCLE), plot(ps,x = 0 .. n, labels = [``, ``])})) end;