A family of functions is known as $\left(\varphi_{0}, \varphi_{1}, \cdots, \varphi_{n}\right)$.
I'd like to know how to express their inner product conveniently as follows:
$$\left(\begin{array}{cccc} \left(\varphi_{0}, \varphi_{0}\right) & \left(\varphi_{0}, \varphi_{1}\right) & \cdots & \left(\varphi_{0}, \varphi_{n}\right) \\ \left(\varphi_{1}, \varphi_{0}\right) & \left(\varphi_{1}, \varphi_{1}\right) & \cdots & \left(\varphi_{1}, \varphi_{n}\right) \\ \vdots & \vdots & & \vdots \\ \left(\varphi_{n}, \varphi_{0}\right) & \left(\varphi_{n}, \varphi_{1}\right) & \cdots & \left(\varphi_{n}, \varphi_{n}\right) \end{array}\right)$$
Where $(f(x), g(x))$ is the inner product: $(f(x), g(x))=\int_{a}^{b} f(x) g(x) \mathrm{d} x$
We can take $\{1,x,x^2,x^3,x^4\}$ and $\{a=-1,b=1\}$ as an example to realize the above requirements.
Outer[Integrate[#1*#2, {x, -1, 1}] &, {1, x, x^2, x^3}, {1, x, x^2, x^3}]
I wonder if there are any other ways to achieve this?
Outer
? Or am I missing something?With[{fns = Array[\[Phi], 3, 0]}, Outer[Integrate[#1[x]*#2[x], {x, a, b}] &, fns, fns]]
- in your concrete caseWith[{fns = Array[Power[x, #] &, 5, 0]}, Outer[Integrate[#1*#2, {x, -1, 1}] &, fns, fns]]
giving result{{2, 0, 2/3, 0, 2/5}, {0, 2/3, 0, 2/5, 0}, {2/3, 0, 2/5, 0, 2/7}, {0, 2/5, 0, 2/7, 0}, {2/5, 0, 2/7, 0, 2/9}}
$\endgroup$