# looping in mathematica for using the current value as initial state of next value [closed]

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.

• If it is about Mathematica, the software, NestList is exactly what you need.
– Kuba
Apr 17, 2014 at 15:32

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]]]}

• 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, 2014 at 16:19
• yes you are right. I am looking for something this. Thank you very much
– sam
Apr 21, 2014 at 16:50