Ron Ho (evil parents?) has a great tutorial on gnuplot. Don't use recursive functions in gnuplot, it's not lisp. Convert the function in order to avoid the memory issues that arise.