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.
1 Answer
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]]]}
-
$\begingroup$ 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. $\endgroup$– samApr 17, 2014 at 16:19
-
$\begingroup$ yes you are right. I am looking for something this. Thank you very much $\endgroup$– samApr 21, 2014 at 16:50
NestList
is exactly what you need. $\endgroup$