3

Possible Duplicate:
How can I work around this TikZ bug?

I am plotting points on function f(x)=1-x^2/2+x^4/16. Obviously f(x)=-f(x), but PGF does not think so.

rendering of the plot

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
    \tikz{
    \draw[very thin, gray] (-2,0) grid (2,2);
    \draw[->] (-2.2,0) -- (2.2,0) node[right] {$x$};
    \draw[->] (0,-.2) -- (0,2.2) node[right] {$y$};
        \def\wExpr{1-.5*(\x^2)+(1/16.)*(\x^4)}     %%%%% <<<
        \foreach\x in {-1.9,-1.3,-.8,-.2,.4,.9,1.5,2.0}{
            \fill (\x,{\wExpr}) circle (2pt);
        }
    }
\end{document}

What am I missing?

PS: I am able to work around it with abs around the exponentiation, but why does this work?

eudoxos
  • 2,973

1 Answers1

5

use it this way:

\def\wExpr{1-.5*((\x)^2)+(1/16.)*((\x)^4)}