# Creating a Matrix from Integrals

I have a table of integrals that I want to put in an nxn matrix. I tried doing it in the following way

phix[x_, n_] := Exp[-n \[Alpha] x^2/2]
phiy[y_, m_] := Exp[-m \[Beta] y^2/2]
const = {List[
Integrate[
x^2 y^2 phix[x, n1] phix[x, n2] phiy[y, m1] phiy[y, m2], {x, 0,
Infinity}, {y, 0, Infinity}], {n1, 1, 3}, {n2, 1, 3}, {m1, 1,
3}, {m2, 1, 3}]} // MatrixForm


but what I get as output is the following, instead of the matrix form.

I also tried to use Table instead of list, but still don't get the output in the matrix form. I need the output as a matrix because I would like to calculate the e-values and e-vectors.

Any help would be greatly appreciated.

• @AntonAntonov, I have added the definitions of the functions in the questions above. They are just Gaussians that are integrated. Oct 10, 2020 at 14:51

You probably want to use the option Assumptions.

Some coding suggestions:

• consider making the matrix of integrals first keeping phix and phiy undefined, and

• then provide definitions through Block or ReplaceAll.

Here is an example:

Clear[const, phix, phiy]

const = Table[
Integrate[
x^2 y^2 phix[x, n1] phix[x, n2] phiy[y, m1] phiy[y, m2], {x, 0,
Infinity}, {y, 0, Infinity},
Assumptions -> {\[Alpha] > 0, \[Beta] > 0}], {n1, 1, 3}, {n2, 1,
3}, {m1, 1, 3}, {m2, 1, 3}];
Magnify[MatrixForm[const], 0.6]

Block[{phix, phiy},
phix[x_, n_] := Exp[-n \[Alpha] x^2/2];
phiy[y_, m_] := Exp[-m \[Beta] y^2/2];
MatrixForm[const]
]


Magnify[MatrixForm[const], 0.6] /. {phix[u_, v_] :> 1/(v + u)^3,
phiy[u_, v_] :> 1/(u + v)^3}


• Thank you for your answer. I did have assumptions in my code. Just didn't post them here. I also did get the first output that you posted, but when I try to get the eigenvalues it does not work. It seems like mathematical does not recognize that as a matrix so that I can take eigenvalues. Also, I am confused by the second definition and output you have above. Oct 10, 2020 at 15:08
• "I also did get the first output that you posted, but when I try to get the eigenvalues it does not work." -- well, please, complete your question post with the actual code and difficulties you have. Oct 10, 2020 at 15:12
• If you say: const= ... // MatrixForm, Then const will look like: MatrixForm[...] what is not suited for further calculations. What can do, e.g.:(const= ...) // MatrixForm Oct 10, 2020 at 17:14
• @DanielHuber Yeah, good point. Oct 10, 2020 at 17:31