Finding maximum value in a domain



I just got started using maxima so the questions may seem quite easy but
I've been struggling with this for a while now.

 

I want to set up a small framework for testing the maximum error of an
approximating function g(x) that approximates a function f(x). The code
I've figured out so far is below,

 

expandcount : 6;

function(x) := sin(x);

approximatingfunction(x) := trunc(taylor(f(x), x, 0, expandcount));

 

f(x) := function(x);

g(x) := approximatingfunction(x);

 

error(x) := abs(f(x) - g(x));

plot2d(error(x), [x, 0, %pi/2], [y, 0, .1]);

 

I have a few questions:

 

1) Is there any way to find the maximum of error(x) on a domain? I guess
the question comes down to how do you find the maximum of a function
over a domain. I know how to do it on paper though I was wondering if
there is a simple max() type method that would do this for me, if not
that's ok!

 

2) Is there a way to take samples of a function over a domain and either
output to a list or possibly a file? I.e. f(x) = x; sample from [0,1]
with 10 samples. So it would sample the function at f(0.1), f(0.2),
f(0.3) ... f(1). 

 

3) Other then the documentation is there any recommended readings, i.e.
a book or a something else that is very beneficial to learning maxima?

 

Thanks!

-= Dave