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

What is ___ vs _ in Mathematica ?

  1. Jan 15, 2010 #1
    Hi guys ,

    I have the next declaration in Mathematica :

    myfunc [lis_list]

    and myfync [x_,y___]

    what does "lis_list" means ? I know that when I want to declare a variable of a function
    I must write myfunc[SomeVar_] with one _
    but what are 3 times _ (meaning ___)

    I hope I'm no asking a stupid question :)

    thanks !
  2. jcsd
  3. Jan 16, 2010 #2


    User Avatar
    Gold Member

    I don't think it does anything? Testing it, it seems to have no effect.
  4. Jan 16, 2010 #3


    Staff: Mentor

    _ is a pattern which can stand for any single expression, whereas ___ is a pattern that can stand for any sequence of 0 or more expressions. There is also __ which is a pattern that can stand for any sequence of 1 or more expressions.
  5. Jan 16, 2010 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    It means that "lis" is only allowed to match a list, methinks. Mathematica's help system has a section on pattern matching -- it might be useful to go read it.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Mathematica Date
Mathematica Cannot do the integral of the Hyper-geometric function? Mar 11, 2018
Mathematica Cannot Plot This Function in Mathematica Feb 26, 2018
Mathematica While Loop in Mathematica Feb 25, 2018
Mathematica Mathematica Real Part Feb 24, 2018
Mathematica Polynomial expansion from Python to Mathematica Feb 20, 2018