In physics, does the order of authors on a paper matter? I'm writing to inquire whether or not the order in which the names of the authors is mentioned has any bearing? Here's my case:

I started working on a project with a professor in the physics department last summer. The project is almost finalized and we're in the stage of finalizing the final draft for submission. Since I'm an undergraduate, I'm not the one who came up with the problem. The instructor suggested the problem to me (and now that I think of it, the problem seems like a very natural question to ask based on a work the said professor published last summer). He has been available for feedback all throughout the duration of the project. For instance, he helped me derive the first closed form result of the paper; he also guided me through every stage of the project -- from guiding how to approach to the problem to helping debug the code when I couldn't make it work in the initial stages. 

Having said that, the professor didn't contribute directly to the project, in addition to helping and guiding me throughout the project. I'm the one who worked through most of the results and went through all the computational tasks. In addition, I'm the one has written the final draft that we have uptil now; he simply helped me edit the template once.

When I met the professor the last time around, he was editing the template and he listed his name as the first name, and my name as the second name on the paper. Naturally, I didn't say anything.

My question is: does the order in which the names are mentioned matter? Does the answer to this question vary from discipline to discipline, even from one area of research to another area of research within the same discipline.

Here's some information that may help answer the question:

The nature of the physics-related paper can be classified using the keywords: "Quantum Dynamics," "Quantum Mechnaics," "Quantum Information" and "Open Quantum Systems." We're trying to get the paper published in Scientific Reports.

Side note: I'm an undergraduate student. Since I'm not technically affiliated with a university (I pay to attend the university, the professor is paid to be there), does this have any bearing on the answer to the question.
Physics has two broad conventions: the closer you are to high energy physics/particle physics/string theory/mathematical physics, the more likely you are to see alphabetical ordering. However, within condensed matter and biophysics, you generally see "First author = trainee primarily responsible for work." (I think astrophysics is more mixed).

There is actually some empirical data on alphabetical authorship by field here: Waltman arxiv:1206.4863 which confirms this general impression.

In quantum information, you might be at the edge of the condensed matter and "mathematical physics" conventions. Take a look at your advisor's other papers - are they alphabetical? Or are grad students and postdocs within the group usually listed as first?

Also, within fields where author order matters, the implication of "second of two authors" can be very different than, say, "second of five authors." With two authors, there is often the presumption of nearly-equal contributions. However, someone who is second of many may have, e.g., provided a figure's worth of data. 

Your description would be broadly consistent with being a first author in most fields. (This assumes that there are not other people who contributed, who you have not mentioned - sometimes undergraduates are not given the best picture of what contributions are there.)

If this does not clear things up, I think it is fine to ask your advisor why he set the author order the way he did.