I'm trying to approximate the function $f(x)=\max(-x,0)$ over $[-a,a]$ using polynomials. So, I used the Legendre polynomials for a generalized Fourier Series (relevant question), but with the dilation $\frac xa$. However, with $10$ polynomials, when I look at the absolute error, it's only "good" relative to the range, around $\frac{a}{100}$. However, I need something a bit better-- to formalize it, with $10$ of these new polynomials, for approximation $g(x)$, $|f(x)-g(x)| \leq 0.1 \, x \in [-a,a]$.
However, of course, to do that I need an orthogonal set of polynomials that are relative to weight function $w(x)=1$ (in fact any polynomial will do) that is orthogonal over $[-a,a]$. So, is there a way of generating such polynomials, so that creating and approximation for my function $f(x)$ over $[-a,a]$ (the polynomials should be different for each $a$. The $w(x)$ can change as well if needed, but it should still remain a polynomial) using the "generalized Fourier Series method" will satisfy my inequality above?
EDIT: I was just reading this page, and it points out that for larger $x$, the approximation got better, as the weight $\exp(\pi x)$ got bigger. So, I was wondering if I could just use the Gram-Schmidt orthogonalization method to create polynomials based on a large weight, like $w(x)=x^{14}$.