How to use function calc in TikZ? Example, my function is f(x)=x^2. I need os f(1) and f(2), \draw f(1) -- f(2);
|
|
A possibility with pgf 2.1
|
|||
|
|
|
I'm not quite sure what you want to do. If you want to plot a function, then the TikZ
The first few commands just draw the axes and the grid, the last command draws the plot. Of course the See the chapter "Plots of Functions" of the TikZ manual for details (it's chapter 19 in the 2.10 manual). EDIT: An answer to Jacques's version of the question: It probably doesn't work because the order of expansion of the macros is not right. I don’t know how to fix that directly, but pgf actually provides its own facility to create math functions:
For example, a function
Then you can write code like |
|||||||
|
|
This is not really an answer, but an attempt to make the question that I think Regis is asking more precise. If I do
I do get a figure with just 1.0 at (0,0). On the other hand if I try to use my function \square to compute coordinates, I get errors which I do not understand:
Replacing the \draw command by |
|||
|
|


