>    restart;
Digits := 6;
nicelog := z -> if z < 10.0^(-Digits) then -Digits else log[10](z) fi;

Digits := 6

nicelog := proc (z) options operator, arrow; if z < 10.0^(-Digits) then -Digits else log[10](z) end if end proc

>    nTerms := 150;
Eerror := vector(nTerms):
Erelerr := vector(nTerms):
Lerror := vector(nTerms):
Lrelerr := vector(nTerms):
Serror := vector(nTerms):
Srelerr := vector(nTerms):
for x in [0.01,0.1,0.2,0.5,1.0,2.0,5.0,10.0,100.0]
do
   Es := 1:
   Eterm := 1:
   Ls := (x-1)/(x+1):
   Ltop := (x-1)/(x+1):
   Ss := x:
   Sterm := x:
   for k from 1 to nTerms do
     Eterm := x * Eterm / k:
     Es := Es + Eterm:
     Eerror[k] := abs(exp(x) - Es):
     Erelerr[k] := Eerror[k]/abs(exp(x)):
     Ltop := Ltop*((x-1)/(x+1))^2:
     Lterm := Ltop/(2*k+1):
     Ls := Ls + Lterm:
     Lerror[k] := abs(log(x) - 2*Ls):
     Lrelerr[k] := Lerror[k]/abs(log(x)):
     Sterm := Sterm*(-x^2)/(4*k^2+2*k):
     Ss := Ss + Sterm:
     Serror[k] := abs(sin(x) - Ss):
     Srelerr[k] := Serror[k]/abs(sin(x)):
   od:
   print("x" = x);
   Elog:=-log10(Erelerr[nTerms]):
   Slog:=-log10(Srelerr[nTerms]):
   Llog:=-log10(Lrelerr[nTerms]):

plot( [seq([j,nicelog(Erelerr[j])], j=1..nTerms)], axes=FRAME,
       labels = ["Order of Partial Sum", "Relative Error of Partial Sum"] );
plot( [seq([j,nicelog(Lrelerr[j])], j=1..nTerms)], axes=FRAME,
       labels = ["Order of Partial Sum", "Relative Error of Partial Sum"] );
plot( [seq([j,nicelog(Srelerr[j])], j=1..nTerms)], axes=FRAME,
       labels = ["Order of Partial Sum", "Relative Error of Partial Sum"] );

od;
   

nTerms := 150

Es := 1

Eterm := 1

Ls := -.980198

Ltop := -.980198

Ss := .1e-1

Sterm := .1e-1

Elog := Float(infinity)

Slog := Float(infinity)

Llog := 4.02978

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := -.818182

Ltop := -.818182

Ss := .1

Sterm := .1

Elog := Float(infinity)

Slog := Float(infinity)

Llog := 4.88510

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := -.666667

Ltop := -.666667

Ss := .2

Sterm := .2

Elog := Float(infinity)

Slog := 5.29813

Llog := Float(infinity)

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := -.333333

Ltop := -.333333

Ss := .5

Sterm := .5

Elog := 5.21715

Slog := 5.68072

Llog := 5.84082

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := 0.

Ltop := 0.

Ss := 1.0

Sterm := 1.0

Elog := Float(infinity)

Slog := Float(infinity)

Llog := Float(undefined)+Float(undefined)*I

[Maple Plot]

Plotting error, empty plot

[Maple Plot]

Es := 1

Eterm := 1

Ls := .333333

Ltop := .333333

Ss := 2.0

Sterm := 2.0

Elog := Float(infinity)

Slog := 5.48158

Llog := 5.84082

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := .666667

Ltop := .666667

Ss := 5.0

Sterm := 5.0

Elog := 5.17147

Slog := 4.56681

Llog := Float(infinity)

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := .818182

Ltop := .818182

Ss := 10.0

Sterm := 10.0

Elog := 5.04192

Slog := 2.23033

Llog := 4.88510

[Maple Plot]

[Maple Plot]

[Maple Plot]

Es := 1

Eterm := 1

Ls := .980198

Ltop := .980198

Ss := 100.0

Sterm := 100.0

Elog := Float(infinity)

Slog := -35.8838

Llog := 4.02978

[Maple Plot]

[Maple Plot]

[Maple Plot]

>