Plot a function of two variables equal 0












6















I would like to plot the function x2(1 − x2) − y2 = 0 in LaTeX.



I tried running following code



documentclass{article}
usepackage[margin=0.5in]{geometry}
usepackage[utf8]{inputenc}
usepackage{textcomp}

usepackage{pgfplots}
pgfplotsset{width=10cm}



begin{document}

begin{tikzpicture}
begin{axis}[
view={0}{90},
no markers,
]

addplot3+[
contour gnuplot={
levels=0,
labels=false,
}
]
{x^2(1-x^2)-y^2};

end{axis}
end{tikzpicture}


end{document}


but the output is
enter image description here



But should be



enter image description here



Thanks for helping.










share|improve this question









New contributor




Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    6















    I would like to plot the function x2(1 − x2) − y2 = 0 in LaTeX.



    I tried running following code



    documentclass{article}
    usepackage[margin=0.5in]{geometry}
    usepackage[utf8]{inputenc}
    usepackage{textcomp}

    usepackage{pgfplots}
    pgfplotsset{width=10cm}



    begin{document}

    begin{tikzpicture}
    begin{axis}[
    view={0}{90},
    no markers,
    ]

    addplot3+[
    contour gnuplot={
    levels=0,
    labels=false,
    }
    ]
    {x^2(1-x^2)-y^2};

    end{axis}
    end{tikzpicture}


    end{document}


    but the output is
    enter image description here



    But should be



    enter image description here



    Thanks for helping.










    share|improve this question









    New contributor




    Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      6












      6








      6


      0






      I would like to plot the function x2(1 − x2) − y2 = 0 in LaTeX.



      I tried running following code



      documentclass{article}
      usepackage[margin=0.5in]{geometry}
      usepackage[utf8]{inputenc}
      usepackage{textcomp}

      usepackage{pgfplots}
      pgfplotsset{width=10cm}



      begin{document}

      begin{tikzpicture}
      begin{axis}[
      view={0}{90},
      no markers,
      ]

      addplot3+[
      contour gnuplot={
      levels=0,
      labels=false,
      }
      ]
      {x^2(1-x^2)-y^2};

      end{axis}
      end{tikzpicture}


      end{document}


      but the output is
      enter image description here



      But should be



      enter image description here



      Thanks for helping.










      share|improve this question









      New contributor




      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I would like to plot the function x2(1 − x2) − y2 = 0 in LaTeX.



      I tried running following code



      documentclass{article}
      usepackage[margin=0.5in]{geometry}
      usepackage[utf8]{inputenc}
      usepackage{textcomp}

      usepackage{pgfplots}
      pgfplotsset{width=10cm}



      begin{document}

      begin{tikzpicture}
      begin{axis}[
      view={0}{90},
      no markers,
      ]

      addplot3+[
      contour gnuplot={
      levels=0,
      labels=false,
      }
      ]
      {x^2(1-x^2)-y^2};

      end{axis}
      end{tikzpicture}


      end{document}


      but the output is
      enter image description here



      But should be



      enter image description here



      Thanks for helping.







      tikz-pgf pgfplots plot gnuplot






      share|improve this question









      New contributor




      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 12 hours ago









      JouleV

      5,51121445




      5,51121445






      New contributor




      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 13 hours ago









      Aris Martin AccolaAris Martin Accola

      312




      312




      New contributor




      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Aris Martin Accola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          6














          enter image description here



          @Superuser27 is correct about the missing *. Additionally, I don't understand why you're using addplot3. Finally, that's not a function.



          documentclass{article}
          usepackage[margin=0.5in]{geometry}
          usepackage[utf8]{inputenc}
          usepackage{textcomp}

          usepackage{pgfplots}
          pgfplotsset{width=10cm}



          begin{document}

          begin{tikzpicture}
          begin{axis}[
          ]
          addplot[domain=-1:1,samples=1000]{ sqrt(x*x*(1-x*x)) * -1 };
          addplot[domain=-1:1,samples=1000]{ (x*x*(1-x*x))^0.5 * 1 };
          draw (axis cs:1,-0.07,1)--(axis cs:1,0.07);
          end{axis}
          end{tikzpicture}


          end{document}





          share|improve this answer































            2














            I had some trouble running your code (compatibility issues) but now it should work. I think the answer is simply that you missed a * in {x^2(1-x^2)-y^2};.



            enter image description here



            documentclass{article}
            usepackage[margin=0.5in]{geometry}
            usepackage[utf8]{inputenc}
            usepackage{textcomp}

            usepackage{pgfplots}
            pgfplotsset{width=10cm}
            pgfplotsset{compat=1.15}

            begin{document}
            begin{tikzpicture}
            begin{axis}[
            view={0}{90},
            no markers,
            ]
            addplot3[
            contour gnuplot={
            levels=0,
            labels = false,
            },
            domain=-2:2,
            domain y=-1.3:1.3,
            ]
            {x^2*(1-x^2)-y^2};

            end{axis}
            end{tikzpicture}
            end{document}





            share|improve this answer
























            • how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

              – Raaja
              12 hours ago








            • 2





              I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

              – Superuser27
              12 hours ago






            • 1





              Huhhh, I see. Thanks for the update!

              – Raaja
              12 hours ago






            • 2





              Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

              – John Kormylo
              12 hours ago











            • @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

              – Raaja
              12 hours ago











            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',
            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/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
            });


            }
            });






            Aris Martin Accola is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479459%2fplot-a-function-of-two-variables-equal-0%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6














            enter image description here



            @Superuser27 is correct about the missing *. Additionally, I don't understand why you're using addplot3. Finally, that's not a function.



            documentclass{article}
            usepackage[margin=0.5in]{geometry}
            usepackage[utf8]{inputenc}
            usepackage{textcomp}

            usepackage{pgfplots}
            pgfplotsset{width=10cm}



            begin{document}

            begin{tikzpicture}
            begin{axis}[
            ]
            addplot[domain=-1:1,samples=1000]{ sqrt(x*x*(1-x*x)) * -1 };
            addplot[domain=-1:1,samples=1000]{ (x*x*(1-x*x))^0.5 * 1 };
            draw (axis cs:1,-0.07,1)--(axis cs:1,0.07);
            end{axis}
            end{tikzpicture}


            end{document}





            share|improve this answer




























              6














              enter image description here



              @Superuser27 is correct about the missing *. Additionally, I don't understand why you're using addplot3. Finally, that's not a function.



              documentclass{article}
              usepackage[margin=0.5in]{geometry}
              usepackage[utf8]{inputenc}
              usepackage{textcomp}

              usepackage{pgfplots}
              pgfplotsset{width=10cm}



              begin{document}

              begin{tikzpicture}
              begin{axis}[
              ]
              addplot[domain=-1:1,samples=1000]{ sqrt(x*x*(1-x*x)) * -1 };
              addplot[domain=-1:1,samples=1000]{ (x*x*(1-x*x))^0.5 * 1 };
              draw (axis cs:1,-0.07,1)--(axis cs:1,0.07);
              end{axis}
              end{tikzpicture}


              end{document}





              share|improve this answer


























                6












                6








                6







                enter image description here



                @Superuser27 is correct about the missing *. Additionally, I don't understand why you're using addplot3. Finally, that's not a function.



                documentclass{article}
                usepackage[margin=0.5in]{geometry}
                usepackage[utf8]{inputenc}
                usepackage{textcomp}

                usepackage{pgfplots}
                pgfplotsset{width=10cm}



                begin{document}

                begin{tikzpicture}
                begin{axis}[
                ]
                addplot[domain=-1:1,samples=1000]{ sqrt(x*x*(1-x*x)) * -1 };
                addplot[domain=-1:1,samples=1000]{ (x*x*(1-x*x))^0.5 * 1 };
                draw (axis cs:1,-0.07,1)--(axis cs:1,0.07);
                end{axis}
                end{tikzpicture}


                end{document}





                share|improve this answer













                enter image description here



                @Superuser27 is correct about the missing *. Additionally, I don't understand why you're using addplot3. Finally, that's not a function.



                documentclass{article}
                usepackage[margin=0.5in]{geometry}
                usepackage[utf8]{inputenc}
                usepackage{textcomp}

                usepackage{pgfplots}
                pgfplotsset{width=10cm}



                begin{document}

                begin{tikzpicture}
                begin{axis}[
                ]
                addplot[domain=-1:1,samples=1000]{ sqrt(x*x*(1-x*x)) * -1 };
                addplot[domain=-1:1,samples=1000]{ (x*x*(1-x*x))^0.5 * 1 };
                draw (axis cs:1,-0.07,1)--(axis cs:1,0.07);
                end{axis}
                end{tikzpicture}


                end{document}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 12 hours ago









                JPiJPi

                9,81421550




                9,81421550























                    2














                    I had some trouble running your code (compatibility issues) but now it should work. I think the answer is simply that you missed a * in {x^2(1-x^2)-y^2};.



                    enter image description here



                    documentclass{article}
                    usepackage[margin=0.5in]{geometry}
                    usepackage[utf8]{inputenc}
                    usepackage{textcomp}

                    usepackage{pgfplots}
                    pgfplotsset{width=10cm}
                    pgfplotsset{compat=1.15}

                    begin{document}
                    begin{tikzpicture}
                    begin{axis}[
                    view={0}{90},
                    no markers,
                    ]
                    addplot3[
                    contour gnuplot={
                    levels=0,
                    labels = false,
                    },
                    domain=-2:2,
                    domain y=-1.3:1.3,
                    ]
                    {x^2*(1-x^2)-y^2};

                    end{axis}
                    end{tikzpicture}
                    end{document}





                    share|improve this answer
























                    • how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                      – Raaja
                      12 hours ago








                    • 2





                      I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                      – Superuser27
                      12 hours ago






                    • 1





                      Huhhh, I see. Thanks for the update!

                      – Raaja
                      12 hours ago






                    • 2





                      Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                      – John Kormylo
                      12 hours ago











                    • @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                      – Raaja
                      12 hours ago
















                    2














                    I had some trouble running your code (compatibility issues) but now it should work. I think the answer is simply that you missed a * in {x^2(1-x^2)-y^2};.



                    enter image description here



                    documentclass{article}
                    usepackage[margin=0.5in]{geometry}
                    usepackage[utf8]{inputenc}
                    usepackage{textcomp}

                    usepackage{pgfplots}
                    pgfplotsset{width=10cm}
                    pgfplotsset{compat=1.15}

                    begin{document}
                    begin{tikzpicture}
                    begin{axis}[
                    view={0}{90},
                    no markers,
                    ]
                    addplot3[
                    contour gnuplot={
                    levels=0,
                    labels = false,
                    },
                    domain=-2:2,
                    domain y=-1.3:1.3,
                    ]
                    {x^2*(1-x^2)-y^2};

                    end{axis}
                    end{tikzpicture}
                    end{document}





                    share|improve this answer
























                    • how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                      – Raaja
                      12 hours ago








                    • 2





                      I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                      – Superuser27
                      12 hours ago






                    • 1





                      Huhhh, I see. Thanks for the update!

                      – Raaja
                      12 hours ago






                    • 2





                      Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                      – John Kormylo
                      12 hours ago











                    • @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                      – Raaja
                      12 hours ago














                    2












                    2








                    2







                    I had some trouble running your code (compatibility issues) but now it should work. I think the answer is simply that you missed a * in {x^2(1-x^2)-y^2};.



                    enter image description here



                    documentclass{article}
                    usepackage[margin=0.5in]{geometry}
                    usepackage[utf8]{inputenc}
                    usepackage{textcomp}

                    usepackage{pgfplots}
                    pgfplotsset{width=10cm}
                    pgfplotsset{compat=1.15}

                    begin{document}
                    begin{tikzpicture}
                    begin{axis}[
                    view={0}{90},
                    no markers,
                    ]
                    addplot3[
                    contour gnuplot={
                    levels=0,
                    labels = false,
                    },
                    domain=-2:2,
                    domain y=-1.3:1.3,
                    ]
                    {x^2*(1-x^2)-y^2};

                    end{axis}
                    end{tikzpicture}
                    end{document}





                    share|improve this answer













                    I had some trouble running your code (compatibility issues) but now it should work. I think the answer is simply that you missed a * in {x^2(1-x^2)-y^2};.



                    enter image description here



                    documentclass{article}
                    usepackage[margin=0.5in]{geometry}
                    usepackage[utf8]{inputenc}
                    usepackage{textcomp}

                    usepackage{pgfplots}
                    pgfplotsset{width=10cm}
                    pgfplotsset{compat=1.15}

                    begin{document}
                    begin{tikzpicture}
                    begin{axis}[
                    view={0}{90},
                    no markers,
                    ]
                    addplot3[
                    contour gnuplot={
                    levels=0,
                    labels = false,
                    },
                    domain=-2:2,
                    domain y=-1.3:1.3,
                    ]
                    {x^2*(1-x^2)-y^2};

                    end{axis}
                    end{tikzpicture}
                    end{document}






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 12 hours ago









                    Superuser27Superuser27

                    61715




                    61715













                    • how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                      – Raaja
                      12 hours ago








                    • 2





                      I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                      – Superuser27
                      12 hours ago






                    • 1





                      Huhhh, I see. Thanks for the update!

                      – Raaja
                      12 hours ago






                    • 2





                      Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                      – John Kormylo
                      12 hours ago











                    • @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                      – Raaja
                      12 hours ago



















                    • how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                      – Raaja
                      12 hours ago








                    • 2





                      I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                      – Superuser27
                      12 hours ago






                    • 1





                      Huhhh, I see. Thanks for the update!

                      – Raaja
                      12 hours ago






                    • 2





                      Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                      – John Kormylo
                      12 hours ago











                    • @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                      – Raaja
                      12 hours ago

















                    how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                    – Raaja
                    12 hours ago







                    how did you manage to compile it, I am having hard-time compiling it with the error being: Package pgfplots Error: sorry, plot file{texstudio_Ml6192_contourtmp0.table} could not be opened. {x^2*(1-x^2)-y^2};. If you have some idea, let me know.

                    – Raaja
                    12 hours ago






                    2




                    2





                    I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                    – Superuser27
                    12 hours ago





                    I got the same error. I had to look around online and found that Overleaf also complains but still gives you an output. @Raaja

                    – Superuser27
                    12 hours ago




                    1




                    1





                    Huhhh, I see. Thanks for the update!

                    – Raaja
                    12 hours ago





                    Huhhh, I see. Thanks for the update!

                    – Raaja
                    12 hours ago




                    2




                    2





                    Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                    – John Kormylo
                    12 hours ago





                    Usually x^2 is implemented using exp(2*log(x)) which can't handle negative numbers.

                    – John Kormylo
                    12 hours ago













                    @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                    – Raaja
                    12 hours ago





                    @JohnKormylo Eventhough, as per your comment, I change it to x*x*(1-x*x)-y*y, I still encounter the same issue.

                    – Raaja
                    12 hours ago










                    Aris Martin Accola is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    Aris Martin Accola is a new contributor. Be nice, and check out our Code of Conduct.













                    Aris Martin Accola is a new contributor. Be nice, and check out our Code of Conduct.












                    Aris Martin Accola is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to TeX - LaTeX 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.


                    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%2ftex.stackexchange.com%2fquestions%2f479459%2fplot-a-function-of-two-variables-equal-0%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

                    數位音樂下載

                    When can things happen in Etherscan, such as the picture below?

                    格利澤436b