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
    Nov 18 at 5:53








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    Nov 18 at 8:47












  • @Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
    – Artificial Stupidity
    Nov 21 at 19:20






  • 1




    tx@Dict begin Rand end
    – Herbert
    Nov 21 at 21:07










  • @Herbert: Th anks.
    – Artificial Stupidity
    Nov 22 at 6:17















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
    Nov 18 at 5:53








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    Nov 18 at 8:47












  • @Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
    – Artificial Stupidity
    Nov 21 at 19:20






  • 1




    tx@Dict begin Rand end
    – Herbert
    Nov 21 at 21:07










  • @Herbert: Th anks.
    – Artificial Stupidity
    Nov 22 at 6:17













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 Nov 18 at 5:39









Artificial Stupidity

4,8731833




4,8731833








  • 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
    Nov 18 at 5:53








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    Nov 18 at 8:47












  • @Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
    – Artificial Stupidity
    Nov 21 at 19:20






  • 1




    tx@Dict begin Rand end
    – Herbert
    Nov 21 at 21:07










  • @Herbert: Th anks.
    – Artificial Stupidity
    Nov 22 at 6:17














  • 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
    Nov 18 at 5:53








  • 1




    It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
    – Herbert
    Nov 18 at 8:47












  • @Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
    – Artificial Stupidity
    Nov 21 at 19:20






  • 1




    tx@Dict begin Rand end
    – Herbert
    Nov 21 at 21:07










  • @Herbert: Th anks.
    – Artificial Stupidity
    Nov 22 at 6:17








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
Nov 18 at 5:53






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
Nov 18 at 5:53






1




1




It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
– Herbert
Nov 18 at 8:47






It is the same situation as for begin{lstlisting}[language={[LaTeX]TeX}]. The inner [...] have to be braced.
– Herbert
Nov 18 at 8:47














@Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
– Artificial Stupidity
Nov 21 at 19:20




@Herbert: I found a bug in pstTriangle. It cannot accept Rand. For example: pstTriangle(0,0){A}(3,4){B}(!.5 Rand sub 10 mul 3){C} does not compile.
– Artificial Stupidity
Nov 21 at 19:20




1




1




tx@Dict begin Rand end
– Herbert
Nov 21 at 21:07




tx@Dict begin Rand end
– Herbert
Nov 21 at 21:07












@Herbert: Th anks.
– Artificial Stupidity
Nov 22 at 6:17




@Herbert: Th anks.
– Artificial Stupidity
Nov 22 at 6:17










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 Nov 18 at 5:58









        Werner

        432k609511632




        432k609511632






























             

            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

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei