I am trying to write an algorithm that will perform N-Dimensional mixed partial derivatives. I have an idea of what I need to be able to achieve, but I cannot seem to come up with the correct loops/recursion that are required to realize the N-dimensional case.
Here is the pattern for the first 4 dimensions:
| 1D wzyx | 2D | 3D | 4D |
----------------------------------------------------------
| dx (0001) | dx (0001) | dx (0001) | dx (0001) |
| | dy (0010) | dy (0010) | dy (0010) |
| | dyx (0011) | dyx (0011) | dyx (0011) |
| | | dz (0100) | dz (0100) |
| | | dzx (0101) | dzx (0101) |
| | | dzy (0110) | dzy (0110) |
| | | dzyx (0111) | dzyx (0111) |
| | | | dw (1000) |
| | | | dwx (1001) |
| | | | dwy (1010) |
| | | | dwyx (1011) |
| | | | dwz (1100) |
| | | | dwzx (1101) |
| | | | dwzy (1110) |
| | | | dxyzw (1111) |
The number of derivatives for each dimension (because it follows a binary pattern) is (2^dim)-1; e.g., 2^3 = 8 - 1 = 7.
The derivative that is dyx is the dx value of the adjacent points in the y dimension. That holds true for all of the mixed partials. So that dzyx is dyx of the adjacent points in the z dimension. I'm not sure if this paragraph is relevant information for the question, just thought I'd put here for completeness.
Any help pointers suggestions are welcome. The part in bold is the part I need to realize.
::EDIT::
I'm going to to try and be a bit more explic