I'm trying to evaluate the following expression with \pgfmathparse, but I get error messages:


Any idea why?

  • 1
    \pi is a character, not the actual value of π. Commented Mar 13, 2018 at 17:47
  • @PhelypeOleinik Thanks, I was suspecting it had something to do with that. Is there another way to pass the 'real' pi (and not just 3.14, please)?
    – Anakhand
    Commented Mar 13, 2018 at 17:50
  • My answer would be pretty much the same as Heiko's, except that I didn't know that pi was a possible value, so I would use rad(180)... Don't ask :P Commented Mar 13, 2018 at 17:54

2 Answers 2


The commands \sqrt and \pi are used to typeset a square root sign and the Greek letter pi, not for computing values.

You can use a different method:







No need to do two steps.

enter image description here

Compare with the result of the standard Unix bc program:

> echo 'sqrt(5.8186/(4*a(1)))' | bc -l

Math expressions in pgf/TikZ use a different syntax than TeX's math typesetting (sqrt instead of \sqrt, pi instead of \pi, parentheses instead of braces):



  % Rounding, three fractional digits


  • Thanks! BTW, know any way to set the desired decimal precision?
    – Anakhand
    Commented Mar 13, 2018 at 17:59
  • @Anakhand See updated answer. Commented Mar 13, 2018 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .