I'm relatively new to using Mathematica. Previously I used Matlab, but lately I noticed that the numbers i got in both of them do not match (mostly it seems that Matlab lacks precision...).
The question is: I need a nested table defined recursively, and based on it I'll calculate what I actually need. But the code
L = RecurrenceTable[
{
a[i] == -M[[i - 1]].Inverse[Psi[[i - 1]] +
L[[i - 1]].Lambda[[i - 1]]],
a[2] == -M[[1]].Inverse[Psi[[1]]],
a[1] == {{0}};
},
a,
{i, 1, NN}
];
, where M, Psi and Lambda are nested tables themselves defined like
Psi = Table[Table[ __SOME FORMULAS__ , {i, 0, NN - n}, {j, 0, NN - n}], {n, 1, NN - 1}];
PrependTo[Psi, {{-c*P[NN]}}];
produces the following error:
Part::pspec: "Part specification -1+i is neither a machine-sized integer nor a list of machine-sized integers. "
RecurrenceTable::deqn: Equation or list of equations expected instead of Null in the first argument
Even though I did the same thing like in reference, but i got this error. And considering the performance of numeric calculations - how can I improve it for the code above?
I would really appreciate any help.
NN = N[4, 50];
p[i_, j_] = Binomial[2*NN - i + j, i + j];
Ψ =
Table[Table[\[Piecewise]p[n + i, n + j] i == j 1 True, {i, 0, 1}, {j, 0, 1}], {n, 0,
NN - 1}];
L = {{{1, 2}, {3, 4}}};
Do[AppendTo[L, Inverse[L[[i - 1]].Ψ[[i - 1]]]], {i, 2, NN}]
(*L=RecurrenceTable[{a[i]\[Equal]-M[[i-1]].Inverse[Ψ[[i-1]]+L[[i-1]].\
Λ[[i-1]]],a[2]\[Equal]-M[[1]].Inverse[Ψ[[1]]],a[1]\[Equal]{{0}}\
;},a,{i,1,NN}];*)
N[L, 5] // MatrixForm
`NN=N[4,50];
p[i_,j_]=Binomial[2*NN-i+j,i+j];
[CapitalPsi]=Table[Table[[Piecewise] p[n+i,n+j] i==j 1 True
,{i,0,1},{j,0,1}],{n,0,NN-1}];
L={{{1,2},{3,4}}}; Do[ AppendTo[ L,Inverse[L[[i-1]].[CapitalPsi][[i-1]]] ], {i,2,NN} ] (L=RecurrenceTable[ { a[i][Equal]-M[[i-1]].Inverse[[CapitalPsi][[i-1]]+L[[i-1]].[CapitalLambda][[i-1]]], a[2]==-M[[1]].Inverse[[CapitalPsi][[1]]], a[1][Equal]{{0}}; }, a, {i,1,NN} ];)
N[L,5] // MatrixForm`
How should I paste the code here?
– Andrew S. Oct 20 '14 at 18:50