Function approximation

Messaggioda Camillo » 26/05/2013, 16:22

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 $
Camillo
Avatar utente
Camillo
Moderatore globale
Moderatore globale
 
Messaggio: 6753 di 10714
Iscritto il: 31/08/2002, 21:06
Località: Milano -Italy

Re: Function approximation

Messaggioda gygabyte017 » 26/05/2013, 18:47

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 :)
gygabyte017
Average Member
Average Member
 
Messaggio: 459 di 628
Iscritto il: 09/04/2006, 17:21

Re: Function approximation

Messaggioda Camillo » 26/05/2013, 20:32

Right :D
Camillo
Avatar utente
Camillo
Moderatore globale
Moderatore globale
 
Messaggio: 6754 di 10714
Iscritto il: 31/08/2002, 21:06
Località: Milano -Italy

Re: Function approximation

Messaggioda gugo82 » 14/08/2013, 14:25

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:
Sono sempre stato, e mi ritengo ancora un dilettante. Cioè una persona che si diletta, che cerca sempre di provare piacere e di regalare il piacere agli altri, che scopre ogni volta quello che fa come se fosse la prima volta. (Freak Antoni)
Avatar utente
gugo82
Cannot live without
Cannot live without
 
Messaggio: 14695 di 44915
Iscritto il: 12/10/2007, 23:58
Località: Napoli

Re: Function approximation

Messaggioda gygabyte017 » 15/09/2013, 22:10

Thanks a lot gugo, you're right!
gygabyte017
Average Member
Average Member
 
Messaggio: 468 di 628
Iscritto il: 09/04/2006, 17:21


Torna a The English Corner

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite