Pagina 1 di 1

Function approximation

MessaggioInviato: 26/05/2013, 16:22
da Camillo
I found this exercise interesting since a little unusual :

*Which constant function better approximate $f(x) = x^2 $ in $[0,1] $ ?

a) in the sense of $L^2$
b) in the sense of $ C^0 $
c) in the sense of $L^1 $

Re: Function approximation

MessaggioInviato: 26/05/2013, 18:47
da gygabyte017
I'll give it a try, even though I'm not sure of what I did!

Testo nascosto, fai click qui per vederlo
We can assume $c \in [0,1]$. Since we are dealing with positive functions, we will not discuss existence conditions where they are obvious. Moreover, since we are in a compact set, the statement is equivalent to find a $c \in [0,1]$ s.t. $||x^2-c||_X$ reaches its minimum (where $X$ is either $L^2$ or $C_0$ or $L^1$).

a) Let's begin assuming $X=L^2$. Hence:
$||x^2-c||_(L^2[0,1]) = \int_0^1 |x^2-c|^2 dx = \int_0^1 (x^2-c)^2 dx = 1/5 -2/3c +c^2 =: h_1(c)$.
Then we find a $c \in [0,1]$ such that it minimises $h_1(c)$. Being such a function a convex parabola, we immediately get $c=1/3$.

b) Let's assume $X=C_0$. Hence:
$||x^2-c||_(C_0) = \max_{x \in [0,1]} |x^2 -c| = \max {c, 1-c} =: h_2(c)$.
It immediately follows that $c=1/2$.

c) Let's assume $X=L^1$. Hence:
$||x^2-c||_(L^1[0,1]) = \int_0^1 |x^2-c|dx = \int_0^{\sqrt c} (c-x^2)dx + \int_{\sqrt c}^1 (x^2-c)dx = 1/3(1-3c+4c \sqrt c) =: h_3(c)$.

As we did in a), we compute a $c \in [0,1]$ such that it minimises $h_3(c)$. Computing the derivative of $h_3(c)$ in $(0,1]$, we find $c = 1/4$.

Please correct me if I did something wrong!


Bye :)

Re: Function approximation

MessaggioInviato: 26/05/2013, 20:32
da Camillo
Right :D

Re: Function approximation

MessaggioInviato: 14/08/2013, 14:25
da gugo82
The answer, though correct, is incomplete: in fact, gygabyte017 was assuming \(c\in [0,1]\) without justifying such an assumption.
To be more precise, while in cases (a) and (b) there is nothing to add to the given answer (because previuos computations don't really need assumption \(c\in [0,1]\) to work), there remains something to say in order to make the argument (c) complete.

Let us assume \(c\in \mathbb{R}\setminus [0,1]=]-\infty , 0[\cup ]1,\infty[\) and separate the two cases:

  • \(c<0\): in such a case we get:
    \[
    \begin{split}
    \| f-c\|_1 &= \int_0^1|x^2-c|\ \text{d} x\\
    &= \int_0^1(x^2-c)\ \text{d} x\\
    &= \frac{1}{3} - c
    \end{split}
    \]

  • \(c>1\): in this case we get:
    \[
    \begin{split}
    \| f-c\|_1 &= \int_0^1|x^2-c|\ \text{d} x\\
    &= \int_0^1(c-x^2\ \text{d} x\\
    &= c-\frac{1}{3}
    \end{split}
    \]

Therefore, in general, we get:
\[
\| f-c\|_1 = \begin{cases} \frac{1}{3} - c &\text{, if } c<0\\
\frac{1}{3} - c + \frac{4}{3}\ c\sqrt{c} &\text{, if } 0\leq c\leq 1\\
c-\frac{1}{3} &\text{, if } c>1
\end{cases}
\]
and a simple graphical representation:
        Internet Explorer richiede Adobe SVG Viewer per visualizzare il grafico


shows that the minimum is assumed in \(c=1/4\), as gygabyte017 already correctly claimed. :wink:

Re: Function approximation

MessaggioInviato: 15/09/2013, 22:10
da gygabyte017
Thanks a lot gugo, you're right!