I am trying to create a Mathematica function that basically splits up a continuous function (in this case a physical potential) into steps (strips as it were) and returns the value of the function at that step (i.e., the potential at respective strip boundary). This is used to calculate a transmission coefficient (it's just some function) at every point in that potential.
I have tried to use the in-built function RecurrenceTable
, but did not work out (i.e. I get a relation but it's wrong and gives me errors.). I have not fully quit on it, but it would take me too long to explain the inner workings.
Either way, my recurrence relation for some Z
is:
Zinput[i] == Z0[i]*((Zinput[i + 1] Cosh[k[i] l]) - (Z0[i] Sinh[k[i] l])) /
((Z0[i] Cosh[k[i] l]) - (Zinput[i + 1] Sinh[k[i] l]))
I want to plug this into a Do
or For
loop so that each value depends on the previous one. This should be easy to achieve, but I have no idea how to set the function to do this.
Just for clarification, the dependence on i
is defined as follows:
k[i_] := (Sqrt[2. m (V[i] - En)]/hbar);
Z0[i_] := (- I h k[i])/m
V[i_] := potential[( i/100.)];
potential[x_] := Piecewise[{{((V0/2. )*(Cos[(2. Pi / λ) (x - λ/2)] + 1)),
0 <= x <= M λ}}];
Where h
, V0
, λ
, and M
are constants defined by me (basically they scale the potential).
I have attempted to use the nest list function
b[c_] := NestList[Z0[i]*((Zinput[i + 1]Cosh[k[i]l])-(Z0[i]Sinh[k[i]l]))/
((Z0[i] Cosh[k[i] l]) - (Zinput[i + 1] Sinh[k[i] l])), Zinput[i], c]
However, this does not give me something I can plot. I am trying to apply the formula for Zinput
(the big long $\sinh$ and $\cosh$ thing) to be the next input while Z0
is the initial value to start with. I also should've mentioned the splitting of the potential is done from right to left (and this is something I cannot change).
i
depends on input at timei+1
?? Normal recurrence is where future values depends on past values, this way the system can be initialized correctly. $\endgroup$