# To expand Li2 in Taylor series about some other point, such as -1/2. Li2(z) = sum[k positive integer]z^k/k^2. We differentiate Li2 n times term wise: d^n/(dz)^n = sum[k >= n](k!/(k-n)!)z^(k-n)/k^2 dli2(n, z) below computes (the nth derivitive of li2 at z)/n!. # MODE C = LONG COMPLEX; PROC sq = (REAL z)REAL: z*z; MODE REP = STRUCT(C a, INT c); PROC m2 = (C z)REAL: sq(SHORTEN RE z) + sq(SHORTEN IM z); PROC li2 = (C z) REP: IF m2(z) < 1 THEN C s := 0, f := z; INT d :=-2; FOR n WHILE REAL fn = n; C t = f/(fn*fn); ABS t > 1.e-18 DO s +:= t; f *:= z; d := n OD; (s, d) ELSE (0, -1) FI; PROC dli2 = (INT n, C z) REP: (C s := 0, f := 1; INT d := -2; FOR k FROM n WHILE C t = f/(k*k); ABS t > 1.e-18 DO s +:= t; f *:= z*(k+1)/(k-n+1); d := k OD; (s, d-n)); C nc = -0.5; INT ts = 70; [0:ts] C u; u[0] := (REP q = li2(nc); print(("c0=", c OF q, newline)); a OF q); FOR n TO ts DO u[n] := (REP q = dli2(n, nc); print((q, newline)); a OF q) OD; (PROC li2h = (C zo)REP: (C s := 0, f := 1; C z = zo - nc; INT d := -2; FOR n FROM 0 WHILE C t = f*u[n]; ABS t > 1.e-18 DO s +:= t; f *:= z; d := n OD; (s, d)); PROC s = (STRING m, REP z) VOID: print((z, " ", m, newline)); PROC t = (C z)VOID: (s("z", (z, 0)); s("li2h", li2h(z)); s("li2", li2(z)); print(newline)); t(0); t(-0.5); t(0.1); t(-0.99); t((-0.52) I .452); t(-1); t(long cos(1) I long sin(1)))