3

I'm trying to make an animation in which increasingly small circles are drawn. I also want to draw a point of a hyperbola within each of those circles and this is where I'm having trouble. Specifically, I get the error

! Package PGF Math Error: Could not parse input '' as a floating point number,sorry. The unreadable part was near ''. (in '$25/(5-4/2').

I'm not sure what the problem is. Based on the error, my guess was that 25/3 being a floating point number what caused the issue, but trying

\addplot[only marks,red] (5-\nCoeff/2,$int(2500/(5-\nCoeff/2))/100$) node[above] {$y$};

results in essentially the same error. My MWE is the following

\documentclass{standalone}\usepackage{pgfplots, animate}\usetikzlibrary{calc}\pgfplotsset{compat = 1.17}\begin{document}   \begin{animateinline}[controls,palindrome]{1}      \multiframe{6}{nCoeff=4+-0.5}{            \begin{tikzpicture}            \begin{axis}               [               ticks=none,               axis equal,               axis x line=bottom,               axis y line=left,               xmin=0, xmax=10,               ymin=0, ymax=10,               ]              \draw[black, very thin, dashed] (5,5) circle [radius=\nCoeff];              \addplot[only marks, black] (5,5) node[above] {$x$};              \addplot[only marks,red] (5-\nCoeff/2,$25/(5-\nCoeff/2)$) node[above] {$y$};            \end{axis}         \end{tikzpicture}      }   \end{animateinline}\end{document}
jlab's user avatar
jlab
16.8k2 gold badges12 silver badges42 bronze badges
askedApr 23 at 12:56
Patricio's user avatar
1
  • 3
    You are mixing thecalc library with the simple usage ofpgfmath in coordinates. Try\addplot[only marks,red] (5-\nCoeff/2,{25/(5-\nCoeff/2)}) node[above] {$y$}; — basically change your$ mark for a group to hide the parenthesis to the coordinate parser.CommentedApr 23 at 13:02

1 Answer1

5

This has nothing to do with thecalc library (which probably mostly is for coordinate calculations, not x,y calculations)

You need to protect each coordinate with{} for it to do the calculation/parsing, aka just use

\addplot[only marks,red] ({5-\nCoeff/2},{25/(5-\nCoeff/2)}) node[above] {$y$};

then it compiles just fine. You might not need it for the x coord (as per Rmanos comment), but it does not hurt.

answeredApr 23 at 13:03
daleif's user avatar

You mustlog in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.