# list manipulation – Forming a matrix using a recurrence relation

I would like to form a matrix using a recurrence relation whereby the first element of the matrix is defined, and subsequent elements are calculated using the recurrence relation I have made. I am able to make a list doing this using the Table function with i running from 0 to z, however I am unsure how to apply the relation correctly to this list to form the j elements of the matrix. Also, if possible, I would like to make the ((i,j)) elements equal to the ((j,i)) elements to save on computation time when the matrices get large. Below is my current code, thanks in advance.

``````z = 5;

R(q_) := R(q) = q/(q + 5.18);

a(q_, Α_) :=
a(q, Α) = (R(q) - 1)^2/(2*Α^2 + 0.4^2);

r(n_) := r(n) = n^2/(2*n);

b(n_, Β_) := b(n, Β) = 2*n - Β;

U(q_, Α_, d_, t_, n_, Β_) :=
U(q, Α, d, t, n, Β) = (d + 1/2)!/(
2*b(n, Β)^t)*(2*r(n)*b(n, Β))^(d + 3/2)*
HypergeometricU(d + 3/2, -t + d + 5/2,
4*a(q, Α)*r(n)*b(n, Β));

S(q_, Α_) :=
S(q, Α) = (-8*Α^(
3/2)*(2*R(q)*Α^2 + 0.4^2))/(
Sqrt(3)*(2*Α^2 + 0.4^2)^(5/2));

Reccurence(0, 0, Α_, Β_) :=
Recurrence(0, 0, Α, Β) =
2*S(0.33, Α)^2*
U(0.33, Α, 1, 1, 5.3134, Β) +
0.6*S(0.55, Α)^2*
U(0.55, Α, 1, 1, 5.40327, Β);

Recurrence(i_, k_, Α_, Β_) :=
Recurrence(i, k, Α, Β) =
1/(i*(i + k + 0.5))^0.5*Α*
D(Recurrence(i - 1,
k, Α, Β), Α) + (((i -
1)*(i + k + 0.5))/(i*(i + k + 0.5)))^0.5*
Recurrence(i - 2, k, Α, Β);

Recurrence(1, k_, Α_, Β_) :=
Recurrence(1, k, Α, Β) =
1/(k + 1.5)^0.5*Α*
D(Recurrence(0,
k, Α, Β), Α);

list(Β_) :=
N(Table(Recurrence(i,
0, Α, Β) /. Α ->
0.5, {i, 0, z});
``````