TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
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. – Yiannis Lazarides Apr 1 '12 at 12:47
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 Apr 1 '12 at 13:49
@YiannisLazarides For example any linear function ax+b would interest me. – user10324 Apr 1 '12 at 16:07

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.

share|improve this answer
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. – user10324 Apr 1 '12 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 Apr 3 '12 at 12:32
Since some time has passed, I'm curious if you managed to come up with something... – user10324 Jul 14 '12 at 14:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.