Plot a function of two variables equal 0

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












7















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



I tried running following code



documentclassarticle
usepackage[margin=0.5in]geometry
usepackage[utf8]inputenc
usepackagetextcomp

usepackagepgfplots
pgfplotssetwidth=10cm



begindocument

begintikzpicture
beginaxis[
view=090,
no markers,
]

addplot3+[
contour gnuplot=
levels=0,
labels=false,

]
x^2(1-x^2)-y^2;

endaxis
endtikzpicture


enddocument


but the output is
enter image description here



But should be



enter image description here



Thanks for helping.










share|improve this question




























    7















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



    I tried running following code



    documentclassarticle
    usepackage[margin=0.5in]geometry
    usepackage[utf8]inputenc
    usepackagetextcomp

    usepackagepgfplots
    pgfplotssetwidth=10cm



    begindocument

    begintikzpicture
    beginaxis[
    view=090,
    no markers,
    ]

    addplot3+[
    contour gnuplot=
    levels=0,
    labels=false,

    ]
    x^2(1-x^2)-y^2;

    endaxis
    endtikzpicture


    enddocument


    but the output is
    enter image description here



    But should be



    enter image description here



    Thanks for helping.










    share|improve this question


























      7












      7








      7


      1






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



      I tried running following code



      documentclassarticle
      usepackage[margin=0.5in]geometry
      usepackage[utf8]inputenc
      usepackagetextcomp

      usepackagepgfplots
      pgfplotssetwidth=10cm



      begindocument

      begintikzpicture
      beginaxis[
      view=090,
      no markers,
      ]

      addplot3+[
      contour gnuplot=
      levels=0,
      labels=false,

      ]
      x^2(1-x^2)-y^2;

      endaxis
      endtikzpicture


      enddocument


      but the output is
      enter image description here



      But should be



      enter image description here



      Thanks for helping.










      share|improve this question
















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



      I tried running following code



      documentclassarticle
      usepackage[margin=0.5in]geometry
      usepackage[utf8]inputenc
      usepackagetextcomp

      usepackagepgfplots
      pgfplotssetwidth=10cm



      begindocument

      begintikzpicture
      beginaxis[
      view=090,
      no markers,
      ]

      addplot3+[
      contour gnuplot=
      levels=0,
      labels=false,

      ]
      x^2(1-x^2)-y^2;

      endaxis
      endtikzpicture


      enddocument


      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















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 14 at 13:08









      JouleV

      13k22663




      13k22663










      asked Mar 14 at 12:24









      Aris Martin AccolaAris Martin Accola

      363




      363




















          3 Answers
          3






          active

          oldest

          votes


















          7














          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.



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm



          begindocument

          begintikzpicture
          beginaxis[
          ]
          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);
          endaxis
          endtikzpicture


          enddocument





          share|improve this answer























          • I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

            – Aris Martin Accola
            Mar 15 at 14:44


















          5














          math



          documentclassstandalone
          usepackagepgfplots
          begindocument

          begintikzpicture
          beginaxis[
          ]
          addplot[no marks,variable=t,domain=0:360,samples=100] (cos(t), 0.5*sin(2*t));
          endaxis
          endtikzpicture

          enddocument


          demo






          share|improve this answer

























          • Best answer....

            – JPi
            Mar 17 at 21:51


















          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



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm
          pgfplotssetcompat=1.15

          begindocument
          begintikzpicture
          beginaxis[
          view=090,
          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;

          endaxis
          endtikzpicture
          enddocument





          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 filetexstudio_Ml6192_contourtmp0.table could not be opened. x^2*(1-x^2)-y^2;. If you have some idea, let me know.

            – Raaja
            Mar 14 at 13:24







          • 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
            Mar 14 at 13:27






          • 1





            Huhhh, I see. Thanks for the update!

            – Raaja
            Mar 14 at 13:28






          • 2





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

            – John Kormylo
            Mar 14 at 13:55






          • 1





            @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

            – Aris Martin Accola
            Mar 15 at 14:41











          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
          );



          );













          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

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7














          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.



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm



          begindocument

          begintikzpicture
          beginaxis[
          ]
          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);
          endaxis
          endtikzpicture


          enddocument





          share|improve this answer























          • I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

            – Aris Martin Accola
            Mar 15 at 14:44















          7














          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.



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm



          begindocument

          begintikzpicture
          beginaxis[
          ]
          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);
          endaxis
          endtikzpicture


          enddocument





          share|improve this answer























          • I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

            – Aris Martin Accola
            Mar 15 at 14:44













          7












          7








          7







          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.



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm



          begindocument

          begintikzpicture
          beginaxis[
          ]
          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);
          endaxis
          endtikzpicture


          enddocument





          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.



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm



          begindocument

          begintikzpicture
          beginaxis[
          ]
          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);
          endaxis
          endtikzpicture


          enddocument






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 14 at 13:17









          JPiJPi

          10.1k21551




          10.1k21551












          • I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

            – Aris Martin Accola
            Mar 15 at 14:44

















          • I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

            – Aris Martin Accola
            Mar 15 at 14:44
















          I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

          – Aris Martin Accola
          Mar 15 at 14:44





          I used addplot for the contour gnuplot. So i don‘t have to calculate the function equal 0 for y.

          – Aris Martin Accola
          Mar 15 at 14:44











          5














          math



          documentclassstandalone
          usepackagepgfplots
          begindocument

          begintikzpicture
          beginaxis[
          ]
          addplot[no marks,variable=t,domain=0:360,samples=100] (cos(t), 0.5*sin(2*t));
          endaxis
          endtikzpicture

          enddocument


          demo






          share|improve this answer

























          • Best answer....

            – JPi
            Mar 17 at 21:51















          5














          math



          documentclassstandalone
          usepackagepgfplots
          begindocument

          begintikzpicture
          beginaxis[
          ]
          addplot[no marks,variable=t,domain=0:360,samples=100] (cos(t), 0.5*sin(2*t));
          endaxis
          endtikzpicture

          enddocument


          demo






          share|improve this answer

























          • Best answer....

            – JPi
            Mar 17 at 21:51













          5












          5








          5







          math



          documentclassstandalone
          usepackagepgfplots
          begindocument

          begintikzpicture
          beginaxis[
          ]
          addplot[no marks,variable=t,domain=0:360,samples=100] (cos(t), 0.5*sin(2*t));
          endaxis
          endtikzpicture

          enddocument


          demo






          share|improve this answer















          math



          documentclassstandalone
          usepackagepgfplots
          begindocument

          begintikzpicture
          beginaxis[
          ]
          addplot[no marks,variable=t,domain=0:360,samples=100] (cos(t), 0.5*sin(2*t));
          endaxis
          endtikzpicture

          enddocument


          demo







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 18 at 5:40

























          answered Mar 17 at 21:46









          John KormyloJohn Kormylo

          46.7k22672




          46.7k22672












          • Best answer....

            – JPi
            Mar 17 at 21:51

















          • Best answer....

            – JPi
            Mar 17 at 21:51
















          Best answer....

          – JPi
          Mar 17 at 21:51





          Best answer....

          – JPi
          Mar 17 at 21:51











          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



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm
          pgfplotssetcompat=1.15

          begindocument
          begintikzpicture
          beginaxis[
          view=090,
          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;

          endaxis
          endtikzpicture
          enddocument





          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 filetexstudio_Ml6192_contourtmp0.table could not be opened. x^2*(1-x^2)-y^2;. If you have some idea, let me know.

            – Raaja
            Mar 14 at 13:24







          • 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
            Mar 14 at 13:27






          • 1





            Huhhh, I see. Thanks for the update!

            – Raaja
            Mar 14 at 13:28






          • 2





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

            – John Kormylo
            Mar 14 at 13:55






          • 1





            @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

            – Aris Martin Accola
            Mar 15 at 14:41















          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



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm
          pgfplotssetcompat=1.15

          begindocument
          begintikzpicture
          beginaxis[
          view=090,
          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;

          endaxis
          endtikzpicture
          enddocument





          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 filetexstudio_Ml6192_contourtmp0.table could not be opened. x^2*(1-x^2)-y^2;. If you have some idea, let me know.

            – Raaja
            Mar 14 at 13:24







          • 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
            Mar 14 at 13:27






          • 1





            Huhhh, I see. Thanks for the update!

            – Raaja
            Mar 14 at 13:28






          • 2





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

            – John Kormylo
            Mar 14 at 13:55






          • 1





            @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

            – Aris Martin Accola
            Mar 15 at 14:41













          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



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm
          pgfplotssetcompat=1.15

          begindocument
          begintikzpicture
          beginaxis[
          view=090,
          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;

          endaxis
          endtikzpicture
          enddocument





          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



          documentclassarticle
          usepackage[margin=0.5in]geometry
          usepackage[utf8]inputenc
          usepackagetextcomp

          usepackagepgfplots
          pgfplotssetwidth=10cm
          pgfplotssetcompat=1.15

          begindocument
          begintikzpicture
          beginaxis[
          view=090,
          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;

          endaxis
          endtikzpicture
          enddocument






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 14 at 13:07









          Superuser27Superuser27

          90816




          90816












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

            – Raaja
            Mar 14 at 13:24







          • 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
            Mar 14 at 13:27






          • 1





            Huhhh, I see. Thanks for the update!

            – Raaja
            Mar 14 at 13:28






          • 2





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

            – John Kormylo
            Mar 14 at 13:55






          • 1





            @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

            – Aris Martin Accola
            Mar 15 at 14:41

















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

            – Raaja
            Mar 14 at 13:24







          • 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
            Mar 14 at 13:27






          • 1





            Huhhh, I see. Thanks for the update!

            – Raaja
            Mar 14 at 13:28






          • 2





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

            – John Kormylo
            Mar 14 at 13:55






          • 1





            @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

            – Aris Martin Accola
            Mar 15 at 14:41
















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

          – Raaja
          Mar 14 at 13:24






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

          – Raaja
          Mar 14 at 13:24





          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
          Mar 14 at 13:27





          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
          Mar 14 at 13:27




          1




          1





          Huhhh, I see. Thanks for the update!

          – Raaja
          Mar 14 at 13:28





          Huhhh, I see. Thanks for the update!

          – Raaja
          Mar 14 at 13:28




          2




          2





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

          – John Kormylo
          Mar 14 at 13:55





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

          – John Kormylo
          Mar 14 at 13:55




          1




          1





          @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

          – Aris Martin Accola
          Mar 15 at 14:41





          @Raaja I had the same problem first compiling it on my computer. So make sure you have installed gnuplot on your computer and then you need to add it to your path so that the program can find gnuplot. You also need to enable —shell-escape.

          – Aris Martin Accola
          Mar 15 at 14:41

















          draft saved

          draft discarded
















































          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

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?