`assign`(frac2, proc (x) options operator, arrow; `+`(x, `-`(floor(x))) end proc); 1; `assign`(f, proc (x) options operator, arrow; `*`(`+`(`*`(2, `*`(frac2(`+`(`/`(`*`(`/`(1, 2), `*`(`+`(x, Pi))), `*... 

proc (x) options operator, arrow; `+`(x, `-`(floor(x))) end proc
proc (x) options operator, arrow; `*`(`+`(`*`(2, `*`(frac2(`+`(`/`(`*`(`/`(1, 2), `*`(`+`(x, Pi))), `*`(Pi)))))), `*`(-2, `*`(.5))), `*`(Pi)) end proc (1)

with(plots); -1; plot(f(x), x = -4 .. 4, scaling = constrained) 

 

Plot_2d  

`assign`(terms, proc (k, x) options operator, arrow; `+`(`/`(`*`(2, `*`(`^`(-1, `+`(k, `-`(1))), `*`(sin(`*`(k, `*`(x)))))), `*`(k))) end proc); 1; `assign`(ser, proc (n, x) options operator, arrow; s... 

proc (k, x) options operator, arrow; `+`(`/`(`*`(2, `*`(`^`(-1, `+`(k, `-`(1))), `*`(sin(`*`(k, `*`(x)))))), `*`(k))) end proc
proc (n, x) options operator, arrow; sum(terms(k, x), k = 1 .. n) end proc (2)

`assign`(A, Array(1 .. 6, 1 .. 2)); -1 

for n to 6 do `assign`(A[n, 1], plot([seq(terms(k, x), k = 1 .. n)], x = -4 .. 4)); `assign`(A[n, 2], plot([f(x), ser(n, x)], x = -4 .. 4)) end do; -1
for n to 6 do `assign`(A[n, 1], plot([seq(terms(k, x), k = 1 .. n)], x = -4 .. 4)); `assign`(A[n, 2], plot([f(x), ser(n, x)], x = -4 .. 4)) end do; -1
 

display(A, scaling = constrained) 

 

 

Plot_2d Plot_2d
Plot_2d Plot_2d
Plot_2d Plot_2d
Plot_2d Plot_2d
Plot_2d Plot_2d
Plot_2d Plot_2d
 

plot([f(x), ser(10, x), ser(30, x), ser(100, x)], x = -4 .. 4, scaling = constrained, legend = [f, typeset(
plot([f(x), ser(10, x), ser(30, x), ser(100, x)], x = -4 .. 4, scaling = constrained, legend = [f, typeset(
 

 

Plot_2d