Normally, when we want to approximate a function $f(x)$ close to $x=a$, we do a Taylor approximation around $a$:
However, what if we want to approximate a function $f(x)$ on the interval $[a,b]$, by an approximating function $g(x)$ where we require the following:
Contrary to Taylor approximation, where we only necessarily have that $g(a)=f(a)$ for some $a$. We now require two endpoints to coincide. That is, we need $g(a)=f(a)$ and $g(b)=f(b)$
Ideally: g(x) should be simple, easily integrable, analytically tractable, and (just like Taylor approximation) allow for arbitrary degrees of precision. Preferably polynomial.
We only care about the approximation on the interval $[a,b]$. That is, we need $g(x)\approx f(x)$ on $x\in[a,b]$ only.
We care whether the integrals of $f(x)$ and $g(x)$ on $[a,b]$ are approximately equal for arbitrary functions $f(x)$.
Moreover, the approximation should ideally be the "best" approximation in its class $\mathcal C$. By $\mathcal C$ I mean for example, the class of polynomial functions of degree $n$. If we want more precision, we can then increase $n$. I am open to different definitions of "best", but I am thinking of something like "the integral of $g(x)$ on $[a,b]$ should be the closest to that of $f(x)$ on that interval out of all possible g(x) in class $\mathcal C$".
Is there a canonical technique, similar to Taylor approximation, that satisfies these requirements? Or satisfy some of them?
The most simple approximation I can come up with is simply, $g(x)=A+Bx$ with $A,B$ such that $g(a)=f(a), g(b)=f(b)$. This determines a unique function. However, when we add a quadratic term, there are now an infinite amount of functions satisfying the boundary conditions, so which one of them is the "best"?