i have some initial state $psi[x,t]$. I perform some operation on it and store the value in another state $pi1[x,t]$. Now on the next step i have to use $psi1[x,t]$ as initial state and perform the functions again and store in $psi2[x,t]$, Please anybody help me how to use loops for this.
Asked
Active
Viewed 137 times
0
1 Answers
1
I think you might be looking for Nest or NestList as noted by Kuba.
NestList[someOperation, psi[x,t], 2]
gives
{psi[x, t], someOperation[psi[x, t]], someOperation[someOperation[psi[x, t]]]}
pjc42
- 733
- 3
- 13
-
i am looking for $operation[operation[operation[psi(x,t)]]]$, where $psi(x,t)$ is some initial function then i store the value of $operation[psi(x,t)]$ into $psi1(x,t)$. Later I have to use $psi1(x,t)$ as initial state and perform same operation as $operation[psi1(x,t)]$. I have to do it n times. – sam Apr 17 '14 at 16:19
-
NestListis exactly what you need. – Kuba Apr 17 '14 at 15:32