Master Taj suggested using the tan function (Karma++ for that) to generate a chaldni texture, so I thought I would give it a try. It isn't as compact as the cos function but does produce some interesting textures from time to time. Note that in the tan function you will get a blank screen from time to time.
The program includes exe and source. Press 1 for tan function, 2 for cos function, esc exit.