Energy band plotting

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











up vote
3
down vote

favorite












Is there some way in which I could plot energy bands using Mathematica in a manner that is given in the image below? I have $E$ as a function of $k_x$ and $k_y$. How can the plot given below be made with these specific points on the $(k_x,k_y)$ axis?



enter image description here



My function for the energy $E$ is:



energy[kx_,ky_]:=Sqrt[1-(Cos[kx/2]Cos[ky/2])^2]


and I can plot parts of the graph with something like:



Plot[energy[kx,0],kx,0,Pi]
Plot[energy[kx,0],kx,Pi,2 Pi]


How do I stitch these together?










share|improve this question









New contributor




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















  • 3




    Please add some functions you have defined and code you have tried.
    – Edmund
    4 hours ago










  • Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
    – rhermans
    3 hours ago










  • I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
    – Theorist
    3 hours ago










  • Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
    – rhermans
    3 hours ago










  • Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
    – rcollyer
    3 hours ago














up vote
3
down vote

favorite












Is there some way in which I could plot energy bands using Mathematica in a manner that is given in the image below? I have $E$ as a function of $k_x$ and $k_y$. How can the plot given below be made with these specific points on the $(k_x,k_y)$ axis?



enter image description here



My function for the energy $E$ is:



energy[kx_,ky_]:=Sqrt[1-(Cos[kx/2]Cos[ky/2])^2]


and I can plot parts of the graph with something like:



Plot[energy[kx,0],kx,0,Pi]
Plot[energy[kx,0],kx,Pi,2 Pi]


How do I stitch these together?










share|improve this question









New contributor




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















  • 3




    Please add some functions you have defined and code you have tried.
    – Edmund
    4 hours ago










  • Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
    – rhermans
    3 hours ago










  • I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
    – Theorist
    3 hours ago










  • Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
    – rhermans
    3 hours ago










  • Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
    – rcollyer
    3 hours ago












up vote
3
down vote

favorite









up vote
3
down vote

favorite











Is there some way in which I could plot energy bands using Mathematica in a manner that is given in the image below? I have $E$ as a function of $k_x$ and $k_y$. How can the plot given below be made with these specific points on the $(k_x,k_y)$ axis?



enter image description here



My function for the energy $E$ is:



energy[kx_,ky_]:=Sqrt[1-(Cos[kx/2]Cos[ky/2])^2]


and I can plot parts of the graph with something like:



Plot[energy[kx,0],kx,0,Pi]
Plot[energy[kx,0],kx,Pi,2 Pi]


How do I stitch these together?










share|improve this question









New contributor




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











Is there some way in which I could plot energy bands using Mathematica in a manner that is given in the image below? I have $E$ as a function of $k_x$ and $k_y$. How can the plot given below be made with these specific points on the $(k_x,k_y)$ axis?



enter image description here



My function for the energy $E$ is:



energy[kx_,ky_]:=Sqrt[1-(Cos[kx/2]Cos[ky/2])^2]


and I can plot parts of the graph with something like:



Plot[energy[kx,0],kx,0,Pi]
Plot[energy[kx,0],kx,Pi,2 Pi]


How do I stitch these together?







plotting






share|improve this question









New contributor




Theorist 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




Theorist 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 3 hours ago









Carl Woll

58.9k276150




58.9k276150






New contributor




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









asked 4 hours ago









Theorist

304




304




New contributor




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





New contributor





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






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







  • 3




    Please add some functions you have defined and code you have tried.
    – Edmund
    4 hours ago










  • Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
    – rhermans
    3 hours ago










  • I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
    – Theorist
    3 hours ago










  • Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
    – rhermans
    3 hours ago










  • Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
    – rcollyer
    3 hours ago












  • 3




    Please add some functions you have defined and code you have tried.
    – Edmund
    4 hours ago










  • Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
    – rhermans
    3 hours ago










  • I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
    – Theorist
    3 hours ago










  • Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
    – rhermans
    3 hours ago










  • Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
    – rcollyer
    3 hours ago







3




3




Please add some functions you have defined and code you have tried.
– Edmund
4 hours ago




Please add some functions you have defined and code you have tried.
– Edmund
4 hours ago












Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
– rhermans
3 hours ago




Don't forget to take the tour now and learning about asking and what's on-topic. There you will learn why you should edit your question to show due diligence, give brief context that is meaningful for non-physicist, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. Not doing that risks getting you question closed as off-topic.
– rhermans
3 hours ago












I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
– Theorist
3 hours ago




I have tried setting ky=0, and then Plot[E[kx,0],kx,0,Pi], and I get one branch of that whole graph. Is there a way to concatenate all these parts with one plotting?
– Theorist
3 hours ago












Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
– rhermans
3 hours ago




Please follow the advise in the comments, it's not fair to ask us to guess your functions and write code you already have. Sharing what you have makes it more likely for somebody to decide to commit effort to solve your problem. You should definitely share your code in formatted form so people can Copy&Paste it. Help us to help you.
– rhermans
3 hours ago












Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
– rcollyer
3 hours ago




Give me an hour or two, I have existing code for this, but it needs a little polishing to post.
– rcollyer
3 hours ago










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










Construct an Interpolation function that translates from the $x$-value to the $k_x,k_y$ coordinates:



xkData = 0,Pi,0,1,0,0,2,Pi,-Pi,3,Pi,0,4,2Pi,0;
if = Interpolation[xkData, InterpolationOrder->1];


Then, use the above interpolating function to construct the plot, and use xkData again to create the ticks:



Plot[
energy @@ if[x],
x, 0, 4,
Frame -> True,
FrameTicks->
Automatic,None,
xkData, None
,
GridLines->Range[0,4], None
]


enter image description here






share|improve this answer




















  • Thank you very much! This is really useful.
    – Theorist
    3 hours ago

















up vote
2
down vote













Compared to my old solution, Carl's is much better. But, there is a subtle flaw in it, and in the original image that the OP posted: the distances between the intervals are not identical. The correct parameterization is to use arc-length. Essentially, we need to Accumulate the arc-length between the points in k-space, as follows:



pts = π, 0, 0, 0, π, -π, π, 0, 2 π, 0;
arcs = Map[ArcLength[Line[#]] &]@
FoldList[Join[#1, #2] &, First@#, Rest@#]&@pts
(* 0, π, π + Sqrt[2] π, 2 π + Sqrt[2] π, 3 π + Sqrt[2] π *)


Then, with some modifications, we can adapt the answer:



xkData = Transpose[arcs, pts];
if = Interpolation[xkData, InterpolationOrder -> 1];
Plot[energy @@ if[x], x, arcs[[1]], arcs[[-1]],
Frame -> True,
FrameTicks -> Automatic, None, xkData, None,
GridLines -> arcs, None
]


enter image description here






share|improve this answer




















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Theorist 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%2fmathematica.stackexchange.com%2fquestions%2f182723%2fenergy-band-plotting%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
    4
    down vote



    accepted










    Construct an Interpolation function that translates from the $x$-value to the $k_x,k_y$ coordinates:



    xkData = 0,Pi,0,1,0,0,2,Pi,-Pi,3,Pi,0,4,2Pi,0;
    if = Interpolation[xkData, InterpolationOrder->1];


    Then, use the above interpolating function to construct the plot, and use xkData again to create the ticks:



    Plot[
    energy @@ if[x],
    x, 0, 4,
    Frame -> True,
    FrameTicks->
    Automatic,None,
    xkData, None
    ,
    GridLines->Range[0,4], None
    ]


    enter image description here






    share|improve this answer




















    • Thank you very much! This is really useful.
      – Theorist
      3 hours ago














    up vote
    4
    down vote



    accepted










    Construct an Interpolation function that translates from the $x$-value to the $k_x,k_y$ coordinates:



    xkData = 0,Pi,0,1,0,0,2,Pi,-Pi,3,Pi,0,4,2Pi,0;
    if = Interpolation[xkData, InterpolationOrder->1];


    Then, use the above interpolating function to construct the plot, and use xkData again to create the ticks:



    Plot[
    energy @@ if[x],
    x, 0, 4,
    Frame -> True,
    FrameTicks->
    Automatic,None,
    xkData, None
    ,
    GridLines->Range[0,4], None
    ]


    enter image description here






    share|improve this answer




















    • Thank you very much! This is really useful.
      – Theorist
      3 hours ago












    up vote
    4
    down vote



    accepted







    up vote
    4
    down vote



    accepted






    Construct an Interpolation function that translates from the $x$-value to the $k_x,k_y$ coordinates:



    xkData = 0,Pi,0,1,0,0,2,Pi,-Pi,3,Pi,0,4,2Pi,0;
    if = Interpolation[xkData, InterpolationOrder->1];


    Then, use the above interpolating function to construct the plot, and use xkData again to create the ticks:



    Plot[
    energy @@ if[x],
    x, 0, 4,
    Frame -> True,
    FrameTicks->
    Automatic,None,
    xkData, None
    ,
    GridLines->Range[0,4], None
    ]


    enter image description here






    share|improve this answer












    Construct an Interpolation function that translates from the $x$-value to the $k_x,k_y$ coordinates:



    xkData = 0,Pi,0,1,0,0,2,Pi,-Pi,3,Pi,0,4,2Pi,0;
    if = Interpolation[xkData, InterpolationOrder->1];


    Then, use the above interpolating function to construct the plot, and use xkData again to create the ticks:



    Plot[
    energy @@ if[x],
    x, 0, 4,
    Frame -> True,
    FrameTicks->
    Automatic,None,
    xkData, None
    ,
    GridLines->Range[0,4], None
    ]


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 3 hours ago









    Carl Woll

    58.9k276150




    58.9k276150











    • Thank you very much! This is really useful.
      – Theorist
      3 hours ago
















    • Thank you very much! This is really useful.
      – Theorist
      3 hours ago















    Thank you very much! This is really useful.
    – Theorist
    3 hours ago




    Thank you very much! This is really useful.
    – Theorist
    3 hours ago










    up vote
    2
    down vote













    Compared to my old solution, Carl's is much better. But, there is a subtle flaw in it, and in the original image that the OP posted: the distances between the intervals are not identical. The correct parameterization is to use arc-length. Essentially, we need to Accumulate the arc-length between the points in k-space, as follows:



    pts = π, 0, 0, 0, π, -π, π, 0, 2 π, 0;
    arcs = Map[ArcLength[Line[#]] &]@
    FoldList[Join[#1, #2] &, First@#, Rest@#]&@pts
    (* 0, π, π + Sqrt[2] π, 2 π + Sqrt[2] π, 3 π + Sqrt[2] π *)


    Then, with some modifications, we can adapt the answer:



    xkData = Transpose[arcs, pts];
    if = Interpolation[xkData, InterpolationOrder -> 1];
    Plot[energy @@ if[x], x, arcs[[1]], arcs[[-1]],
    Frame -> True,
    FrameTicks -> Automatic, None, xkData, None,
    GridLines -> arcs, None
    ]


    enter image description here






    share|improve this answer
























      up vote
      2
      down vote













      Compared to my old solution, Carl's is much better. But, there is a subtle flaw in it, and in the original image that the OP posted: the distances between the intervals are not identical. The correct parameterization is to use arc-length. Essentially, we need to Accumulate the arc-length between the points in k-space, as follows:



      pts = π, 0, 0, 0, π, -π, π, 0, 2 π, 0;
      arcs = Map[ArcLength[Line[#]] &]@
      FoldList[Join[#1, #2] &, First@#, Rest@#]&@pts
      (* 0, π, π + Sqrt[2] π, 2 π + Sqrt[2] π, 3 π + Sqrt[2] π *)


      Then, with some modifications, we can adapt the answer:



      xkData = Transpose[arcs, pts];
      if = Interpolation[xkData, InterpolationOrder -> 1];
      Plot[energy @@ if[x], x, arcs[[1]], arcs[[-1]],
      Frame -> True,
      FrameTicks -> Automatic, None, xkData, None,
      GridLines -> arcs, None
      ]


      enter image description here






      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        Compared to my old solution, Carl's is much better. But, there is a subtle flaw in it, and in the original image that the OP posted: the distances between the intervals are not identical. The correct parameterization is to use arc-length. Essentially, we need to Accumulate the arc-length between the points in k-space, as follows:



        pts = π, 0, 0, 0, π, -π, π, 0, 2 π, 0;
        arcs = Map[ArcLength[Line[#]] &]@
        FoldList[Join[#1, #2] &, First@#, Rest@#]&@pts
        (* 0, π, π + Sqrt[2] π, 2 π + Sqrt[2] π, 3 π + Sqrt[2] π *)


        Then, with some modifications, we can adapt the answer:



        xkData = Transpose[arcs, pts];
        if = Interpolation[xkData, InterpolationOrder -> 1];
        Plot[energy @@ if[x], x, arcs[[1]], arcs[[-1]],
        Frame -> True,
        FrameTicks -> Automatic, None, xkData, None,
        GridLines -> arcs, None
        ]


        enter image description here






        share|improve this answer












        Compared to my old solution, Carl's is much better. But, there is a subtle flaw in it, and in the original image that the OP posted: the distances between the intervals are not identical. The correct parameterization is to use arc-length. Essentially, we need to Accumulate the arc-length between the points in k-space, as follows:



        pts = π, 0, 0, 0, π, -π, π, 0, 2 π, 0;
        arcs = Map[ArcLength[Line[#]] &]@
        FoldList[Join[#1, #2] &, First@#, Rest@#]&@pts
        (* 0, π, π + Sqrt[2] π, 2 π + Sqrt[2] π, 3 π + Sqrt[2] π *)


        Then, with some modifications, we can adapt the answer:



        xkData = Transpose[arcs, pts];
        if = Interpolation[xkData, InterpolationOrder -> 1];
        Plot[energy @@ if[x], x, arcs[[1]], arcs[[-1]],
        Frame -> True,
        FrameTicks -> Automatic, None, xkData, None,
        GridLines -> arcs, None
        ]


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 35 mins ago









        rcollyer

        28.2k673164




        28.2k673164




















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









             

            draft saved


            draft discarded


















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












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











            Theorist 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%2fmathematica.stackexchange.com%2fquestions%2f182723%2fenergy-band-plotting%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