Fail to invoke g(f(x))











up vote
7
down vote

favorite












I want to invoke g(f(x)) which is equal to x actually. However the following does not compile in PostScript stage (I think). Could you fix it? I am not asking how to plot y=x but how to invoke the composition function g(f(x)).



MWE



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{5}{g(f(x))}
end{pspicture}
end{document}









share|improve this question


















  • 2




    Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
    – moewe
    yesterday








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    yesterday

















up vote
7
down vote

favorite












I want to invoke g(f(x)) which is equal to x actually. However the following does not compile in PostScript stage (I think). Could you fix it? I am not asking how to plot y=x but how to invoke the composition function g(f(x)).



MWE



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{5}{g(f(x))}
end{pspicture}
end{document}









share|improve this question


















  • 2




    Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
    – moewe
    yesterday








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    yesterday















up vote
7
down vote

favorite









up vote
7
down vote

favorite











I want to invoke g(f(x)) which is equal to x actually. However the following does not compile in PostScript stage (I think). Could you fix it? I am not asking how to plot y=x but how to invoke the composition function g(f(x)).



MWE



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{5}{g(f(x))}
end{pspicture}
end{document}









share|improve this question













I want to invoke g(f(x)) which is equal to x actually. However the following does not compile in PostScript stage (I think). Could you fix it? I am not asking how to plot y=x but how to invoke the composition function g(f(x)).



MWE



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

begin{document}
begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{5}{g(f(x))}
end{pspicture}
end{document}






pstricks






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









Artificial Stupidity

4,4121832




4,4121832








  • 2




    Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
    – moewe
    yesterday








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    yesterday
















  • 2




    Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
    – moewe
    yesterday








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    yesterday










2




2




Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
– moewe
yesterday






Use deff#1{((#1-2)/(2*(#1)+1))} defg#1{((2+#1)/(1-2*(#1)))} and psplot{-4}{5}{g{f{x}}}, i.e. the usual curly braces instead of round ones. When you use deff(#1) you are using delimited arguments which have problems when you nest calls (like the [ and ] of optional arguments)
– moewe
yesterday






1




1




It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
– Herbert
yesterday






It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
– Herbert
yesterday












1 Answer
1






active

oldest

votes

















up vote
10
down vote



accepted










The use of similar parameter text for f and g is what causes the problem here. The first occurrence of a (...) pair is used to extract the arguments. So, in



g(f(<x>))


passes the incomplete f(<x> as the argument to g. To get around this, brace the argument to avoid confusion:



enter image description here



documentclass{article}

usepackage{pst-plot}

deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

begin{document}

begin{pspicture}[algebraic](-4,-4)(6,6)
psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
psset{linecolor=blue,linewidth=2pt}
psplot{-4}{5}{g({f(x)})}
end{pspicture}

end{document}





share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    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',
    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/3.0/"u003ecc by-sa 3.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%2ftex.stackexchange.com%2fquestions%2f460544%2ffail-to-invoke-g-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








    up vote
    10
    down vote



    accepted










    The use of similar parameter text for f and g is what causes the problem here. The first occurrence of a (...) pair is used to extract the arguments. So, in



    g(f(<x>))


    passes the incomplete f(<x> as the argument to g. To get around this, brace the argument to avoid confusion:



    enter image description here



    documentclass{article}

    usepackage{pst-plot}

    deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
    defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

    begin{document}

    begin{pspicture}[algebraic](-4,-4)(6,6)
    psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
    psset{linecolor=blue,linewidth=2pt}
    psplot{-4}{5}{g({f(x)})}
    end{pspicture}

    end{document}





    share|improve this answer

























      up vote
      10
      down vote



      accepted










      The use of similar parameter text for f and g is what causes the problem here. The first occurrence of a (...) pair is used to extract the arguments. So, in



      g(f(<x>))


      passes the incomplete f(<x> as the argument to g. To get around this, brace the argument to avoid confusion:



      enter image description here



      documentclass{article}

      usepackage{pst-plot}

      deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
      defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

      begin{document}

      begin{pspicture}[algebraic](-4,-4)(6,6)
      psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
      psset{linecolor=blue,linewidth=2pt}
      psplot{-4}{5}{g({f(x)})}
      end{pspicture}

      end{document}





      share|improve this answer























        up vote
        10
        down vote



        accepted







        up vote
        10
        down vote



        accepted






        The use of similar parameter text for f and g is what causes the problem here. The first occurrence of a (...) pair is used to extract the arguments. So, in



        g(f(<x>))


        passes the incomplete f(<x> as the argument to g. To get around this, brace the argument to avoid confusion:



        enter image description here



        documentclass{article}

        usepackage{pst-plot}

        deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
        defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

        begin{document}

        begin{pspicture}[algebraic](-4,-4)(6,6)
        psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
        psset{linecolor=blue,linewidth=2pt}
        psplot{-4}{5}{g({f(x)})}
        end{pspicture}

        end{document}





        share|improve this answer












        The use of similar parameter text for f and g is what causes the problem here. The first occurrence of a (...) pair is used to extract the arguments. So, in



        g(f(<x>))


        passes the incomplete f(<x> as the argument to g. To get around this, brace the argument to avoid confusion:



        enter image description here



        documentclass{article}

        usepackage{pst-plot}

        deff(#1){((#1-2)/(2*(#1)+1))}% y=f(x)
        defg(#1){((2+#1)/(1-2*(#1)))}% y=g(x) in which g is the inverse of f.

        begin{document}

        begin{pspicture}[algebraic](-4,-4)(6,6)
        psaxes{->}(0,0)(-4,-4)(5.5,5.5)[$x$,0][$y$,90]
        psset{linecolor=blue,linewidth=2pt}
        psplot{-4}{5}{g({f(x)})}
        end{pspicture}

        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Werner

        430k599481624




        430k599481624






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460544%2ffail-to-invoke-g-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

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido