How to know if a function can be written as a sum of other functions

93 Views Asked by At

Idea

I have an odd function, $f(x)$. I would like to write it as a sum of sine waves with different frequencies & amplitudes between $a$ & $b$.

I thought that if I do:

$$c(\lambda)=\int_a^bf(x)\sin(x\lambda)dx$$

and then:

$$g(x) = \int_{-\infty}^{\infty}c(\lambda)\sin(\lambda x) d\lambda$$

I get back $f(x)$ in the form of $g(x)$. I tried this and it turns out that I need an extra $\pi$ factor, so $f(x)=\frac{g(x)}{\pi}$.


Observation

Checking if my theory works:

enter image description here

Yes, it seems quite good.

The (Python) code:

from scipy import integrate
import numpy as np
import matplotlib.pyplot as plt
a=0
b=10
step=0.5
l=-10 # this is my minus infinity
h=10  # this is my plus infinity

def f(x):
    return np.arctan(x)

def compfunction(x,j):
    return np.sin(j*x)

def c(l):
    res, error = integrate.quad(lambda x: f(x)*compfunction(x,l),a,b)
    return res

def integrand(k,x):
    return c(k)*compfunction(x,k)

xs = np.arange(a,b+step,step)
rec = [y/np.pi for y, _ in [integrate.quad(lambda k: c(k)*compfunction(x,k),l,h) for x in xs]]

plt.plot(xs,rec,label='arctan(x)')
plt.plot(xs,[f(x) for x in xs],label='arctan(x) constructed from sine waves')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.legend()

Question

How do I know if a function can serve as a basis? ie how do I say, if, for example, I can write an (odd) function as sum of functions in the form $\frac{\sinh(\sigma x)}{\sigma x}$ on the interval between $a$ and $b$, where $\sigma$ is freely chosen for each term of the sum? (I think this question is equivalent to asking: how do I know if a function $c(\sigma)$ exists such that $\int_{-\infty}^{\infty}c(\sigma)\text{basisfunction}(\sigma x)d \sigma = \int_{-\infty}^{\infty}c(\sigma)\frac{\sinh(\sigma x)}{\sigma x} d \sigma$ .)

1

There are 1 best solutions below

0
On BEST ANSWER

This is similar to looking at a symmetric or hermitian matrix $A$, and expanding a vector in the eigenvectors of this matrix $A$. The operator $$ Lf=-f'',\;\;\; 0 \le x < \infty,\;\; f(0)=0, $$ is a self-adjoint operator on the domain consisted of all twice-absolutely continuous functions $f\in L^2[0,\infty)$ for which $f''\in L^2[0,\infty)$. The functions $\sin(\alpha x)$ serve as "continuous" basis of eigenfunctions $$L\sin(\alpha x)=\alpha^2\sin(\alpha x)$$ for $L^2[0,\infty)$ for $\alpha > 0$, allowing you to write any $f\in L^2[0,\infty)$ as a "continuous" eigenfunction expansion $$ f = \frac{1}{\pi}\int_{0}^{\infty}\left(\int_0^{\infty}f(y)\sin(\alpha y)dy\right)\sin(\alpha x)d\alpha $$ The convergence to $f$ takes place in $L^2[0,\infty)$.

A similar cosine expansion is valid for $Lf=-f'',\;\; f'(0)=0$. In this case, $$ f = \frac{1}{\pi}\int_0^{\infty}\left(\int_0^{\infty}f(y)\cos(\alpha y)dy\right)\cos(\alpha x)d\alpha $$ This is a legitimate Functional Analysis expansion in $L^2[0,\infty)$.

There are many other cases of such expansions associated with self-adjoint ordinary differential equations. Some of these expansions have mixed discrete and continuous spectrum, forcing the expansion to have both integral and discrete sum contributions. Another case for $Lf=-f''$ that involves a discrete component as well as a continuous one is found on $[0,\infty)$ with the mixed condition $$ f(0)+f'(0)=0. $$ This has an eigenfunction $e^{-x}$, and it has continuous spectrum as well.