Graphing sqrt function: not coming out properly

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











up vote
1
down vote

favorite












I have been looking at other posts and have modified my code accordingly, but I still can't get it to work. I think there is an issue that has not been addressed in any of the posts that I have found. However, I don't know what the issue is, so I can't make a specific inquiry.



 begintikzpicture
beginaxis[xmax = 4,ymax = 3,samples = 50]
draw[black, smooth, variable=x] plot (x,sqrt(1 - 4(x - frac12)^2);
endaxis
endtikzpicture









share|improve this question







New contributor




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















  • 1




    Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
    – marmot
    3 hours ago











  • Thanks, marmot! Are you referring to the the x within the square root function?
    – Rafael Vergnaud
    3 hours ago










  • I see. May you clarify what you mean by appropriate domain?
    – Rafael Vergnaud
    3 hours ago










  • The build is saying the following: You can an axis with empty range (in the y direction)
    – Rafael Vergnaud
    3 hours ago










  • I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
    – Rafael Vergnaud
    3 hours ago














up vote
1
down vote

favorite












I have been looking at other posts and have modified my code accordingly, but I still can't get it to work. I think there is an issue that has not been addressed in any of the posts that I have found. However, I don't know what the issue is, so I can't make a specific inquiry.



 begintikzpicture
beginaxis[xmax = 4,ymax = 3,samples = 50]
draw[black, smooth, variable=x] plot (x,sqrt(1 - 4(x - frac12)^2);
endaxis
endtikzpicture









share|improve this question







New contributor




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















  • 1




    Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
    – marmot
    3 hours ago











  • Thanks, marmot! Are you referring to the the x within the square root function?
    – Rafael Vergnaud
    3 hours ago










  • I see. May you clarify what you mean by appropriate domain?
    – Rafael Vergnaud
    3 hours ago










  • The build is saying the following: You can an axis with empty range (in the y direction)
    – Rafael Vergnaud
    3 hours ago










  • I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
    – Rafael Vergnaud
    3 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have been looking at other posts and have modified my code accordingly, but I still can't get it to work. I think there is an issue that has not been addressed in any of the posts that I have found. However, I don't know what the issue is, so I can't make a specific inquiry.



 begintikzpicture
beginaxis[xmax = 4,ymax = 3,samples = 50]
draw[black, smooth, variable=x] plot (x,sqrt(1 - 4(x - frac12)^2);
endaxis
endtikzpicture









share|improve this question







New contributor




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











I have been looking at other posts and have modified my code accordingly, but I still can't get it to work. I think there is an issue that has not been addressed in any of the posts that I have found. However, I don't know what the issue is, so I can't make a specific inquiry.



 begintikzpicture
beginaxis[xmax = 4,ymax = 3,samples = 50]
draw[black, smooth, variable=x] plot (x,sqrt(1 - 4(x - frac12)^2);
endaxis
endtikzpicture






tikz-pgf plot






share|improve this question







New contributor




Rafael Vergnaud 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




Rafael Vergnaud 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






New contributor




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









asked 3 hours ago









Rafael Vergnaud

61




61




New contributor




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





New contributor





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






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







  • 1




    Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
    – marmot
    3 hours ago











  • Thanks, marmot! Are you referring to the the x within the square root function?
    – Rafael Vergnaud
    3 hours ago










  • I see. May you clarify what you mean by appropriate domain?
    – Rafael Vergnaud
    3 hours ago










  • The build is saying the following: You can an axis with empty range (in the y direction)
    – Rafael Vergnaud
    3 hours ago










  • I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
    – Rafael Vergnaud
    3 hours ago












  • 1




    Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
    – marmot
    3 hours ago











  • Thanks, marmot! Are you referring to the the x within the square root function?
    – Rafael Vergnaud
    3 hours ago










  • I see. May you clarify what you mean by appropriate domain?
    – Rafael Vergnaud
    3 hours ago










  • The build is saying the following: You can an axis with empty range (in the y direction)
    – Rafael Vergnaud
    3 hours ago










  • I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
    – Rafael Vergnaud
    3 hours ago







1




1




Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
– marmot
3 hours ago





Welcome to TeX.SE! If you go this way, the x must be a x, i.e. draw[black, smooth, variable=x] plot (x,sqrt(1 - 4*(x - 1/2)^2);, and you may want to add an appropriate domain. However, since you seem to use pgfplots, use addplot sqrt(1-4*(x-1/2)^2);.
– marmot
3 hours ago













Thanks, marmot! Are you referring to the the x within the square root function?
– Rafael Vergnaud
3 hours ago




Thanks, marmot! Are you referring to the the x within the square root function?
– Rafael Vergnaud
3 hours ago












I see. May you clarify what you mean by appropriate domain?
– Rafael Vergnaud
3 hours ago




I see. May you clarify what you mean by appropriate domain?
– Rafael Vergnaud
3 hours ago












The build is saying the following: You can an axis with empty range (in the y direction)
– Rafael Vergnaud
3 hours ago




The build is saying the following: You can an axis with empty range (in the y direction)
– Rafael Vergnaud
3 hours ago












I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
– Rafael Vergnaud
3 hours ago




I have to say, it doesn't come out very nicely. Would you help me make a graph (sorry to be pestering, haha)?
– Rafael Vergnaud
3 hours ago










2 Answers
2






active

oldest

votes

















up vote
6
down vote













OK, this is too long for a comment. There are several issues:



  • You say variable=x but one x does not have a backslash.

  • You need to add multiplication signs.

  • You cannot use frac in an expression that is going to be parsed. frac is used to typeset fractions.

Altogether, the expression should be (I guess) sqrt(1 - 4*(x - 1/2)^2. However, as you are using an axis environment, I think you are loading pgfplots, so I'd suggest



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[xmax = 4,ymax = 3,samples = 50]
addplot[black, smooth,domain=0:1] sqrt(1 - 4*(x - 1/2)^2;
endaxis
endtikzpicture
enddocument


enter image description here






share|improve this answer




















  • Thank you very much marmot! I appreciate your help. :)
    – Rafael Vergnaud
    3 hours ago










  • My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
    – Rafael Vergnaud
    3 hours ago










  • @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
    – marmot
    3 hours ago










  • Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
    – Rafael Vergnaud
    3 hours ago










  • @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
    – marmot
    3 hours ago

















up vote
3
down vote













documentclassstandalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[xmax=10,ymax=10, samples=1000]
addplot+[mark=none,samples=200,unbounded coords=jump] sqrt(x);
endaxis
endtikzpicture
enddocument


I would suggest to do something like this
enter image description here






share|improve this answer








New contributor




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

















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



    );






    Rafael Vergnaud 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%2f458835%2fgraphing-sqrt-function-not-coming-out-properly%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote













    OK, this is too long for a comment. There are several issues:



    • You say variable=x but one x does not have a backslash.

    • You need to add multiplication signs.

    • You cannot use frac in an expression that is going to be parsed. frac is used to typeset fractions.

    Altogether, the expression should be (I guess) sqrt(1 - 4*(x - 1/2)^2. However, as you are using an axis environment, I think you are loading pgfplots, so I'd suggest



    documentclass[tikz,border=3.14mm]standalone
    usepackagepgfplots
    pgfplotssetcompat=1.16
    begindocument
    begintikzpicture
    beginaxis[xmax = 4,ymax = 3,samples = 50]
    addplot[black, smooth,domain=0:1] sqrt(1 - 4*(x - 1/2)^2;
    endaxis
    endtikzpicture
    enddocument


    enter image description here






    share|improve this answer




















    • Thank you very much marmot! I appreciate your help. :)
      – Rafael Vergnaud
      3 hours ago










    • My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
      – marmot
      3 hours ago










    • Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
      – marmot
      3 hours ago














    up vote
    6
    down vote













    OK, this is too long for a comment. There are several issues:



    • You say variable=x but one x does not have a backslash.

    • You need to add multiplication signs.

    • You cannot use frac in an expression that is going to be parsed. frac is used to typeset fractions.

    Altogether, the expression should be (I guess) sqrt(1 - 4*(x - 1/2)^2. However, as you are using an axis environment, I think you are loading pgfplots, so I'd suggest



    documentclass[tikz,border=3.14mm]standalone
    usepackagepgfplots
    pgfplotssetcompat=1.16
    begindocument
    begintikzpicture
    beginaxis[xmax = 4,ymax = 3,samples = 50]
    addplot[black, smooth,domain=0:1] sqrt(1 - 4*(x - 1/2)^2;
    endaxis
    endtikzpicture
    enddocument


    enter image description here






    share|improve this answer




















    • Thank you very much marmot! I appreciate your help. :)
      – Rafael Vergnaud
      3 hours ago










    • My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
      – marmot
      3 hours ago










    • Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
      – marmot
      3 hours ago












    up vote
    6
    down vote










    up vote
    6
    down vote









    OK, this is too long for a comment. There are several issues:



    • You say variable=x but one x does not have a backslash.

    • You need to add multiplication signs.

    • You cannot use frac in an expression that is going to be parsed. frac is used to typeset fractions.

    Altogether, the expression should be (I guess) sqrt(1 - 4*(x - 1/2)^2. However, as you are using an axis environment, I think you are loading pgfplots, so I'd suggest



    documentclass[tikz,border=3.14mm]standalone
    usepackagepgfplots
    pgfplotssetcompat=1.16
    begindocument
    begintikzpicture
    beginaxis[xmax = 4,ymax = 3,samples = 50]
    addplot[black, smooth,domain=0:1] sqrt(1 - 4*(x - 1/2)^2;
    endaxis
    endtikzpicture
    enddocument


    enter image description here






    share|improve this answer












    OK, this is too long for a comment. There are several issues:



    • You say variable=x but one x does not have a backslash.

    • You need to add multiplication signs.

    • You cannot use frac in an expression that is going to be parsed. frac is used to typeset fractions.

    Altogether, the expression should be (I guess) sqrt(1 - 4*(x - 1/2)^2. However, as you are using an axis environment, I think you are loading pgfplots, so I'd suggest



    documentclass[tikz,border=3.14mm]standalone
    usepackagepgfplots
    pgfplotssetcompat=1.16
    begindocument
    begintikzpicture
    beginaxis[xmax = 4,ymax = 3,samples = 50]
    addplot[black, smooth,domain=0:1] sqrt(1 - 4*(x - 1/2)^2;
    endaxis
    endtikzpicture
    enddocument


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 3 hours ago









    marmot

    72.4k477153




    72.4k477153











    • Thank you very much marmot! I appreciate your help. :)
      – Rafael Vergnaud
      3 hours ago










    • My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
      – marmot
      3 hours ago










    • Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
      – marmot
      3 hours ago
















    • Thank you very much marmot! I appreciate your help. :)
      – Rafael Vergnaud
      3 hours ago










    • My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
      – marmot
      3 hours ago










    • Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
      – Rafael Vergnaud
      3 hours ago










    • @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
      – marmot
      3 hours ago















    Thank you very much marmot! I appreciate your help. :)
    – Rafael Vergnaud
    3 hours ago




    Thank you very much marmot! I appreciate your help. :)
    – Rafael Vergnaud
    3 hours ago












    My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
    – Rafael Vergnaud
    3 hours ago




    My very last question, which should be brief to answer, is how do I move the plot from the left margin of the pdf to the center of pdf?
    – Rafael Vergnaud
    3 hours ago












    @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
    – marmot
    3 hours ago




    @RafaelVergnaud This is due to xmax = 4,ymax = 3,. If you drop these, the plot is centered, and also if you make xmin and so on symmetric around the center.
    – marmot
    3 hours ago












    Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
    – Rafael Vergnaud
    3 hours ago




    Hey marmot! I mean on the pdf document. I did switch ymax to 4! Adding xmin did not center the plot of the pdf! It is still on the left hand margin of the pdf. If it's a hassle, I'll just leave it. It's no big deal!
    – Rafael Vergnaud
    3 hours ago












    @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
    – marmot
    3 hours ago




    @RafaelVergnaud The above document is standalone, so I thought you want to center the curve. If you want to center the plot in a figure in an article document, say, you could use centering.
    – marmot
    3 hours ago










    up vote
    3
    down vote













    documentclassstandalone
    usepackagepgfplots
    begindocument
    begintikzpicture
    beginaxis[xmax=10,ymax=10, samples=1000]
    addplot+[mark=none,samples=200,unbounded coords=jump] sqrt(x);
    endaxis
    endtikzpicture
    enddocument


    I would suggest to do something like this
    enter image description here






    share|improve this answer








    New contributor




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





















      up vote
      3
      down vote













      documentclassstandalone
      usepackagepgfplots
      begindocument
      begintikzpicture
      beginaxis[xmax=10,ymax=10, samples=1000]
      addplot+[mark=none,samples=200,unbounded coords=jump] sqrt(x);
      endaxis
      endtikzpicture
      enddocument


      I would suggest to do something like this
      enter image description here






      share|improve this answer








      New contributor




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



















        up vote
        3
        down vote










        up vote
        3
        down vote









        documentclassstandalone
        usepackagepgfplots
        begindocument
        begintikzpicture
        beginaxis[xmax=10,ymax=10, samples=1000]
        addplot+[mark=none,samples=200,unbounded coords=jump] sqrt(x);
        endaxis
        endtikzpicture
        enddocument


        I would suggest to do something like this
        enter image description here






        share|improve this answer








        New contributor




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









        documentclassstandalone
        usepackagepgfplots
        begindocument
        begintikzpicture
        beginaxis[xmax=10,ymax=10, samples=1000]
        addplot+[mark=none,samples=200,unbounded coords=jump] sqrt(x);
        endaxis
        endtikzpicture
        enddocument


        I would suggest to do something like this
        enter image description here







        share|improve this answer








        New contributor




        user66094 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 answer



        share|improve this answer






        New contributor




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









        answered 3 hours ago









        user66094

        332




        332




        New contributor




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





        New contributor





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






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




















            Rafael Vergnaud is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Rafael Vergnaud is a new contributor. Be nice, and check out our Code of Conduct.












            Rafael Vergnaud is a new contributor. Be nice, and check out our Code of Conduct.











            Rafael Vergnaud 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%2f458835%2fgraphing-sqrt-function-not-coming-out-properly%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery