Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Error: cannot find symbol

  1. Oct 12, 2015 #1
    My program says it doesn't recognise the symbol signum(double) or sqrt(double)! I have definitely done the whole import java.lang.Math; thing. And signum and sqrt aren't symbols anyway. Is that too vague? I can post the actual code.

    It's only my second week learning java, so it's supposed to be pretty straightforward stuff.
  2. jcsd
  3. Oct 12, 2015 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Yes, the source code and imports would help.
  4. Oct 12, 2015 #3


    Staff: Mentor

    I'm guessing that when you compile your code, the compiler isn't able to find the library code. The term "symbol" is computerese for the name of a variable, function, what-have-you, not a symbol such as ##\Sigma## or ##\int##. Even if your source code has a line where you import some library, if your installation isn't set up correctly, the compiler won't be able to find the code for functions you're importing.
  5. Oct 13, 2015 #4


    Staff: Mentor

    Are you trying to use the actual symbol ##\sqrt ()## in your source code instead of Math.sqrt()?

    Java supports unicode but it doesn't support using the ##\sqrt()## symbol or +- signum as valid operators in expressions. It instead requires you to type Math.sqrt() or use + and - for a number's sign.
    Last edited: Oct 13, 2015
  6. Oct 13, 2015 #5
    You are a hero! I forgot to put Math.sqrt! I was just using sqrt. And now my code works!

    Thanks for all the replies, really appreciate it :)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook