Dynamically Generate Terrian

If this is about how to make the terrain from functions:

This is - as far as i know - only possible by generating the images (PNMImage) and then loading them into the terrain or by making all the terrain model yourself vertex by vertex.
For the second option maybe “NURBS” could be useful for making it smooth. (for that see wikipedia and [SheetNode substitute))

If the question is about which function to use:

I’d suggest having a look at PerlinNoise (and its friends) in the reference and “Fractal landscape” as well as “perlin noise” in wikipedia.

edit:
Also in SciPy/NumPy there are tools for interpolation and such stuff eg vectorizing functions which could be useful.