Learn Computer Programming for Applied Math & Physics Majors

In summary, the conversation discusses the individual's plans to start a double major in applied math and physics, with limited availability for computer science courses. They ask for advice on where to start learning programming, and the responders suggest Python and SciPy for scientific computation, with a recommendation to also learn some assembler and C for a deeper understanding of programming principles. They also mention that a strong knowledge of algorithms is important for programming, and provide a link to a book on Python for computational science.
  • #1
KelCatrell
15
0
OK, so I know virtually nothing about computer programming, and this fall I am starting into a double major of applied math and physics. The only computer science course that is required is the University's Intro to CS course. I am thinking that, if possible, I am going to try to do the accelerated BA/MA program for Math that the university offers, and then heading off to a PhD program for Physics. That being said, I do not think I will have many openings in my schedule for any sort of programming classes, and therefore will be teaching myself, in any sort of spare time I can get.
From what I understand, a physicist ought to have a pretty decent knowledge of programming. My question is, where should I start for learning about programming. I have noticed Fortran mentioned on here a bunch. Should I try to learn that first, or is there a programming language, that, if known, makes it easier to learn other sorts of languages as needed?
Thanks in advance for your help.
Also, the names of any books that you have found to be helpful, or heard to be helpful would be greatly appreciated.
 
Physics news on Phys.org
  • #2
Depends what kind of physics you are going to be doing, the idea is to minimise the amount of programming - otherwise it will consume all your time.
If you are mostly theoretical then Mathematica or similair.
For data analysis, you can do an awful lot with Excel or python is now pretty popular. I suspect most lab classes have stopped the Fortran introduction.
But if you are going to be an experimentalist you might be dragged down into details of C, assembler, DSPs, FPGA and weird and wonderful custom hardware!
 
  • #4
I vote C++.
 
  • #5
AUMathTutor said:
I vote C++.
Sadist!
 
  • #6
So begins another pointless war.

The bottom line is this: Python and SciPy will provide an environment in which you can do more scientific computation with fewer lines of code than any other general-purpose language, on average. Does that make it the "best language?" That depends on your personal criteria.

- Warren
 
  • #7
I am not sure yet what kind of physics I will be doing as of yet.
In y'all's opinion, would it be more beneficial, in the long run, of having a firm grasp on C++, or just jumping into learning something like python, while having no other background in programming?
 
  • #8
Oh, and thanks a ton for the quick replies! And the easy links! Quite impressive
 
  • #9
I depends on whether you want a deep understanding of what the computer is doing when your programs are running, but a common trait of good programmers is that they understand the workings of a normal modern CPU. Once you do that, which requires a bit of assembler, It doesn't really matter what language you use.

So my advice would be to learn just a bit of assembler. It doesn't have to take long. Just so you get the basic principles. Then, take up some C, understand what the compiler does to generate the 'assembler' you learned. Write a few programs etc. Then take up C#, C++ or java. I'd say c# is the easiest to 'pick up', java second and if you are a sadist, become a C++ expert. Then all the script/typeless languages etc.

Then, choose your pet language and flame anybody for ever using anything else... ;)

But the point is, that by that time, you can pickup any language far easier than starting programming in say python.
 
  • #10
As a first language, especially for science I would recommend python.
http://diveintopython.org/ is a free book on python and the best into to the language.
http://greenteapress.com/thinkpython/thinkCSpy/ is a good intro to programming using python.

How much programming you want to learn is upto you. You can do all the data analysis in a physics degree just using Excel or you can end up doing a lot more programming than a CS major.
 
  • #11
FredericGos said:
I depends on whether you want a deep understanding of what the computer is doing when your programs are running, but a common trait of good programmers is that they understand the workings of a normal modern CPU. Once you do that, which requires a bit of assembler, It doesn't really matter what language you use.

I'd have to argue with all of this. A strong knowledge of algorithms, and when to apply them, is much more useful to a programmer than is any machine-specific knowledge. In practice, compilers are much better at creating fast machine code than are people. Assembly is pretty much a horrible choice for almost all programming tasks.

So my advice would be to learn just a bit of assembler. It doesn't have to take long. Just so you get the basic principles. Then, take up some C, understand what the compiler does to generate the 'assembler' you learned. Write a few programs etc. Then take up C#, C++ or java. I'd say c# is the easiest to 'pick up', java second and if you are a sadist, become a C++ expert. Then all the script/typeless languages etc.

This is the path that a computer engineer would take in learning how to design computers. The original poster is asking about using computers to solve physics problems. It would be senseless to demand that he become a computer engineer before he can begin solving physics problems.

But the point is, that by that time, you can pickup any language far easier than starting programming in say python.

Yes, four years from now, he'll be quite well prepared to learn python. Of course, he's already quite well prepared to learn python, so maybe he should just start there.

- Warren
 
  • #12
Here is Langtangen's Introduction to Computer Programming, A Python-Based Approach for Computational Science. It is used in the first semester in Norway.

http://folk.uio.no/hpl/INF1100/INF1100-ebook-Aug08.pdf
 
Last edited by a moderator:
  • #13
cool, thanks for the link to the e-book! I will be using that for sure! :)
 
  • #14
  • #15
chroot said:
I'd have to argue with all of this. A strong knowledge of algorithms, and when to apply them, is much more useful to a programmer than is any machine-specific knowledge. In practice, compilers are much better at creating fast machine code than are people. Assembly is pretty much a horrible choice for almost all programming tasks.

You completely misunderstand the point. Did I say that assembler is the most usefull for a programmer? no. And also specifically said 'if you want a deep understanding'. What I am trying to say is that, to be a truly good programmer, you need to know how CPU's do their work. The assembler part is just about lerarning how the CPU works. I never said you should use it for anything, just have a understanding of what computers are about. And since all CPU's pretty much work the same way, I can't see any 'machine specifics here'. I've seen far too many programmers falling short when problems occur just because they don't truly understand what they are doing.

Doing programming without the CPU knowledge part is like doing physics without truly understanding calculus.

Anyway, what makes you think that learning good algorithms and when to apply them would take less time? It takes far more time than learning how to program.

But yes, feel free to skip the deep understanding. All this takes time yes, but 4 years is a bit exagerated. Just use enough time to learn the basics. A couple of month should do.
 
  • #16
AUMathTutor said:
Why would you advise against c++? Is it because it's faster, offers more low-level capabilities, or is more widely used by developers worldwide
C++ is more complicated to write simple programs than python.
Consider reading some values from a file and solving a few similtaneous equations in C++ and python+scipy or numpy.

Probably Java or C# is now more widely used by developers - that doesn't mean they are better than C++ of course, as the old saying goes "eat sh*t, a billion flies can't be wrong"
 
  • #17
There is a free ebook called http://www.htdp.org/" that you should read if you are unfamiliar with programming. It is a very nice book for absolute newbies using a restricted subset of scheme, that slowly builds you up to the full version of scheme. Do not use C as your first language, you will be confused. Also stay away from Java, C++, C# as their power will give you bad programming habits.

Once you finish that book, learn a bit about low level programs in assembly and how a computer works and then learn C and C++.

Its very easy to go from a new programmer to a good programmer but hard to go from a bad programmer to a good programmer.

Either read the book that I recommended or learn python from a good book. Stay away from the more complex languages as a newbie.
 
Last edited by a moderator:

Related to Learn Computer Programming for Applied Math & Physics Majors

1. What is the importance of learning computer programming for applied math and physics majors?

Computer programming is an essential skill for applied math and physics majors as it allows them to solve complex problems and analyze large data sets. With programming, these students can develop algorithms, create simulations, and build models that can help them understand and predict real-world phenomena.

2. Do I need prior programming experience to learn computer programming for applied math and physics?

No, prior programming experience is not necessary to learn computer programming for applied math and physics. However, having a basic understanding of mathematical concepts and logical thinking can make the learning process easier.

3. Which programming languages are commonly used in applied math and physics?

The most commonly used programming languages in applied math and physics are Python, MATLAB, and R. These languages are known for their ease of use, flexibility, and extensive libraries for scientific computing.

4. How can learning computer programming benefit me as an applied math and physics major?

Learning computer programming can benefit you in many ways as an applied math and physics major. It can help you develop critical thinking and problem-solving skills, improve your data analysis and visualization abilities, and open up career opportunities in fields such as data science, engineering, and research.

5. What resources are available for learning computer programming for applied math and physics?

There are numerous resources available for learning computer programming for applied math and physics, including online courses, tutorials, textbooks, and coding bootcamps. Many universities also offer programming courses specifically designed for math and physics majors. Additionally, there are online communities and forums where you can seek help and collaborate with other learners.

Similar threads

  • STEM Academic Advising
Replies
6
Views
1K
  • STEM Academic Advising
Replies
12
Views
1K
  • STEM Academic Advising
Replies
16
Views
2K
  • STEM Academic Advising
Replies
3
Views
858
  • STEM Academic Advising
Replies
3
Views
539
Replies
6
Views
1K
  • STEM Academic Advising
Replies
4
Views
252
Replies
6
Views
170
  • STEM Academic Advising
Replies
10
Views
1K
  • STEM Academic Advising
Replies
2
Views
1K
Back
Top