The differences amongst f[x_], f[x__], and f[x___]What are the use cases for different scoping constructs?Open and search Documentation-CenterWhat is the difference between Reduce and Solve?Functions that remember their valuesWays to access lists inside listsWhy is the Spherical Bessel Function acting strangely at this point?What is the relationship between Thread and MapThreadBad performance of Integrate (and WolframAlpha) for an Integral of Bessel function of the first kind: Version 11 edit

IEEE 754 square root with Newton-Raphson

How big would the ice ball have to be to deliver all the water at once?

How do my husband and I get over our fear of having another difficult baby?

Knights and Knaves: What does C say?

Can I pay some of the cost of an activated ability lots of times to get more out of the effect?

How does Monks' Improved Unarmored Movement work out of combat?

How to add the real hostname in the beginning of Linux cli command

A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?

Is it good to engage in exceptional cases where it is permissible to do a typically forbidden action to which one has a taivah for

How to compare integers in TeX?

As a team leader is it appropriate to bring in fundraiser candy?

Was the ruling that prorogation was unlawful only possible because of the creation of a separate supreme court?

Why does it seem the best way to make a living is to invest in real estate?

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

Phonetic distortion when words are borrowed among languages

Why isn't there armor to protect from spells in the Potterverse?

Delete n lines skip 1 line script

Fix Ethernet 10/100 PoE cable with 7 out of 8 wires alive

Beyond Futuristic Technology for an Alien Warship?

How to bring home documents from work?

The differences amongst f[x_], f[x__], and f[x___]

Did Tolkien ever write about a Heaven or Hell for Men?

Creating specific options in `Manipulate[]`

Writing a program that will filter the integer solutions



The differences amongst f[x_], f[x__], and f[x___]


What are the use cases for different scoping constructs?Open and search Documentation-CenterWhat is the difference between Reduce and Solve?Functions that remember their valuesWays to access lists inside listsWhy is the Spherical Bessel Function acting strangely at this point?What is the relationship between Thread and MapThreadBad performance of Integrate (and WolframAlpha) for an Integral of Bessel function of the first kind: Version 11 edit






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5












$begingroup$


This is probably very elementary but I have not used the following and I cannot find anything online, and I was unable to find something here.



Can someone explain to me the differences amongst



f[x_]:=, f[x__]:=, f[x___]:=


and maybe give some practical examples so I can see the differences?










share|improve this question









$endgroup$









  • 4




    $begingroup$
    Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
    $endgroup$
    – Konstantinos
    7 hours ago






  • 3




    $begingroup$
    Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
    $endgroup$
    – kglr
    7 hours ago







  • 1




    $begingroup$
    ... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
    $endgroup$
    – kglr
    7 hours ago











  • $begingroup$
    Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
    $endgroup$
    – Konstantinos
    7 hours ago

















5












$begingroup$


This is probably very elementary but I have not used the following and I cannot find anything online, and I was unable to find something here.



Can someone explain to me the differences amongst



f[x_]:=, f[x__]:=, f[x___]:=


and maybe give some practical examples so I can see the differences?










share|improve this question









$endgroup$









  • 4




    $begingroup$
    Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
    $endgroup$
    – Konstantinos
    7 hours ago






  • 3




    $begingroup$
    Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
    $endgroup$
    – kglr
    7 hours ago







  • 1




    $begingroup$
    ... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
    $endgroup$
    – kglr
    7 hours ago











  • $begingroup$
    Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
    $endgroup$
    – Konstantinos
    7 hours ago













5












5








5


1



$begingroup$


This is probably very elementary but I have not used the following and I cannot find anything online, and I was unable to find something here.



Can someone explain to me the differences amongst



f[x_]:=, f[x__]:=, f[x___]:=


and maybe give some practical examples so I can see the differences?










share|improve this question









$endgroup$




This is probably very elementary but I have not used the following and I cannot find anything online, and I was unable to find something here.



Can someone explain to me the differences amongst



f[x_]:=, f[x__]:=, f[x___]:=


and maybe give some practical examples so I can see the differences?







functions special-functions documentation






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









KonstantinosKonstantinos

8631 gold badge5 silver badges14 bronze badges




8631 gold badge5 silver badges14 bronze badges










  • 4




    $begingroup$
    Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
    $endgroup$
    – Konstantinos
    7 hours ago






  • 3




    $begingroup$
    Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
    $endgroup$
    – kglr
    7 hours ago







  • 1




    $begingroup$
    ... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
    $endgroup$
    – kglr
    7 hours ago











  • $begingroup$
    Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
    $endgroup$
    – Konstantinos
    7 hours ago












  • 4




    $begingroup$
    Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
    $endgroup$
    – Konstantinos
    7 hours ago






  • 3




    $begingroup$
    Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
    $endgroup$
    – kglr
    7 hours ago







  • 1




    $begingroup$
    ... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
    $endgroup$
    – kglr
    7 hours ago











  • $begingroup$
    Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
    $endgroup$
    – Konstantinos
    7 hours ago







4




4




$begingroup$
Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
$endgroup$
– kglr
8 hours ago





$begingroup$
Consider g1[x_]:= x, g2[x__]:= x, and g3[x___]:=x and compare g1[], g1[5] and g1[5,6] (similarly for g2 and g3).
$endgroup$
– kglr
8 hours ago













$begingroup$
Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
$endgroup$
– Konstantinos
7 hours ago




$begingroup$
Thank you for the comment. Some more questions. When I tried g3[5, 6, 7] it gave me 5,6,7 which is what I expected from the general pattern. However, g2[5, 6, 7] also gives the same result, so I am not sure what's the difference. Also g1[], g2[], just give back the same while g3[] gives back . Could you explain a bit more thoroughly? Am I missing something?
$endgroup$
– Konstantinos
7 hours ago




3




3




$begingroup$
Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
$endgroup$
– kglr
7 hours ago





$begingroup$
Konstantinos, see Blank (_), BlankSequence (__) and BlankNullSequence (___) in the docs for more details. g1 requires a single argument; so g1[] and g1[2,3] both return unevaluated. g2 requires 1 or more arguments so g2[] returns g2[]; and ...
$endgroup$
– kglr
7 hours ago





1




1




$begingroup$
... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
$endgroup$
– kglr
7 hours ago





$begingroup$
... g3 expects 0 or more arguments so g3[] evaluates to , g3[1,2,3] gives 1,2,3and g3[1,2,3] (one argument which is the list 1,2,3) gives 1,2,3 etc.
$endgroup$
– kglr
7 hours ago













$begingroup$
Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
$endgroup$
– Konstantinos
7 hours ago




$begingroup$
Thanks a lot once more. I did not know how to find these online. I was trying something like f[__] Mathematica and nothing was popping up.
$endgroup$
– Konstantinos
7 hours ago










1 Answer
1






active

oldest

votes


















7














$begingroup$

_ matches one thing.



__ matches one or more things.



___ matches zero or more things.






share|improve this answer









$endgroup$

















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f206799%2fthe-differences-amongst-fx-fx-and-fx%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    $begingroup$

    _ matches one thing.



    __ matches one or more things.



    ___ matches zero or more things.






    share|improve this answer









    $endgroup$



















      7














      $begingroup$

      _ matches one thing.



      __ matches one or more things.



      ___ matches zero or more things.






      share|improve this answer









      $endgroup$

















        7














        7










        7







        $begingroup$

        _ matches one thing.



        __ matches one or more things.



        ___ matches zero or more things.






        share|improve this answer









        $endgroup$



        _ matches one thing.



        __ matches one or more things.



        ___ matches zero or more things.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 7 hours ago









        John DotyJohn Doty

        8,9361 gold badge14 silver badges27 bronze badges




        8,9361 gold badge14 silver badges27 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f206799%2fthe-differences-amongst-fx-fx-and-fx%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單