Suppose I have a function f:A ->A. I can plot this function in a cartesian coordinate system in tikz/pgf. Can someone explain to me how to plot for a specific point a in A and a natural number m the m-time preimage of a (meaning the point in A, that evaluates to a, if f is m times applied) ?

Is it also possible to plot the preimage of an entire subset, that consists of more than a single point, of A ?

  • 2
    Can you please give a concrete example of what you want to achive, the function etc... In general TeX is a Turing complete machine and given infinite patience and skills anything is possible, perhaps not through tikz.
    – yannisl
    Commented Apr 1, 2012 at 12:47
  • 1
    Depends on the function itself. If it is possible to be expressed as an admissible function in TikZ/PGF or better pgfplots then it might be possible through nested foreach loops.
    – percusse
    Commented Apr 1, 2012 at 13:49
  • @YiannisLazarides For example any linear function ax+b would interest me.
    – l7ll7
    Commented Apr 1, 2012 at 16:07

1 Answer 1


TikZ/pfg won't do this for you; it is not a computer algebra system. Given f and m, you need to compute the proper pre-image yourself. Then, of course, TikZ/pgf can plot the points you specify.

  • Couldn't perhaps gnuplot be used in combination with tikz ? I think I remember seeing somewhere a piece of code, where some function was actually computed in gnuplot and the plottet with tikz.
    – l7ll7
    Commented Apr 1, 2012 at 16:09
  • Probably. I wasn't thinking in those terms in my answer. I'll update my answer if I get time to think about how to send the parameter m to gnuplot.
    – GregH
    Commented Apr 3, 2012 at 12:32
  • 1
    Since some time has passed, I'm curious if you managed to come up with something...
    – l7ll7
    Commented Jul 14, 2012 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .