I am trying to compose three functions in the following manner:

    Adx[z_] = (z[x + dx, t] + z[x, t])/2
    Ddt[z_] = (z[x, t + dt] - z[x, t])/dt
    Ddt[Adx[z]]

I get the following output:

    1/2 (z[x, t] + z[dx + x, t])
    (-z[x, t] + z[x, dt + t])/dt
    (-(1/2 (z[x, t] + z[dx + x, t]))[x, t] + (1/2 (z[x, t] + z[dx + x, t]))[x, dt + t])/dt
I was expecting

    (-(1/2 (z[x, t] + z[dx + x, t])) + (1/2 (z[x, dt+ t] + z[dx + x, dt+ t])))/dt

I want to be able to compose the two functions `Adx` and `Ddt`in any order I want and get the answer as in the last line of code.

I have also looked at [this question][1], it, too, suffers from the same problem.


  [1]: http://mathematica.stackexchange.com/questions/87464/how-to-write-an-operator-that-acts-on-pure-function-to-give-another-pure-functi