Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to define new functions in tkz-fct and use them to plot using \tkzFct?

share|improve this question
    
Sorry but my english is not very fine, you want define new functions or new macros ? If you want new mathematic functions, you need to create them like with tikz. In the cvs version of Tikz I create some new functions for arithmetics integers. If you can complete your question, I give you a more complete answer. –  Alain Matthes May 24 '11 at 17:56
    
Yes I want new mathematical functions –  student May 24 '11 at 18:21
    
What kind of functions ? –  Alain Matthes May 24 '11 at 21:11

2 Answers 2

You can define new functions using \pgfmathdeclarefunction. For example, the following defines a gaussian function that can be used in TikZ:

\documentclass{article}
\usepackage{tikz}

\pgfmathdeclarefunction{gauss}{3}{%
      \pgfmathparse{1/(#3*sqrt(2*pi))*exp(-((#1-#2)^2)/(2*#3^2))}%
    }

\begin{document}
\begin{tikzpicture}
\draw [help lines] (-2,0) grid [step=0.5] (2,1);
\draw plot [domain=-2:2,samples=40] (\x,{gauss(\x,0,0.5)});
\end{tikzpicture}
\end{document}

gaussian function

share|improve this answer

You need to read the pgfmanual. 66 Customizing the Mathematical Engine

You can also read the code of pgf . For example, I contribute for pgfmathfunctions.integerarithmetics.code.tex and the code is not very complex .

share|improve this answer

Your Answer

 
discard

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.