Best programming language for aspiring physics and engineers?

  • Thread starter basics
  • Start date
  • #1
basics
11
0
I feel that I should start learning how to program. The only thing stopping me from reading a few books and watching some videos is the whole matter of which language to choose from. There are just so many of them. My question is what would be the best and most useful programming language to start learning first. I understand that learning many of them is desired/useful, but I have to start somewhere. So where should I start? I have read that the C languages are the most common, but I think that I read a while ago on this site that (a PF user said:) Python is what most scientists and engineers are using these days. I honestly don't have a clue about this subject. Any input would be met with lots of thanks.

Thank you.
 

Answers and Replies

  • #2
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,809
1,670
This particular question has been explored at length before on PF. If you look at the Related Discussions box at the bottom of this page, you will see some related threads.
 
  • Like
Likes 1 person
  • #3
Fusiontron
108
2
Don't bother trying to learn programming on your own, it doesn't work. It suddenly you have to do work which requires some programming skill then it will become much easier to learn it then because it is necessary. If you just do random examples from some book you will forget everything the next day.
 
  • #4
basics
11
0
I'm not going to doubt the difficulty level of learning how to program on my own. However, I think that if I want an edge in life, then it would probably be best to get started as soon as possible.
 
  • #5
Dishsoap
1,017
309
Try looking into Project Euler. Once you decide what language to choose, you can use Project Euler to do useful things in it, instead of just "Playing around".

Also, as far as languages go, once you learn one language and learn how to think like a programmer, more often than not learning another one is a lot easier. Like you mentioned, you might want to try C or C++.
 
  • #6
jesse73
455
20
this has been asked more than a hundred times I am sure, given it has been asked at least 5 times in the last 3 months which given the age of PF it must be over 100. google search with site:physicsforums.com
 
  • #7
basics
11
0
Oh my, you're right. There really does seem to be hundreds of these threads. Well thanks anyway for your help, my friends. And I will definitely look at Project Euler.
 
  • #8
jtbell
Mentor
15,969
4,774
I've probably made these points in some of those bazillion other "which language" threads, but what the heck, I might as well make them again.

1. Don't stress out over which language you start with. Just pick one and go with it for a while. For a general-purpose language, C++, C, Java or Python are decent choices that come to mind. There are probably some other candidates that I've forgotten about at the moment.

I specifically exclude Fortran because it's more a "specialty" language nowadays, even though a lot of physicists and engineers use it. You can easily pick it up later as a second or third language if you need it.

2. Whatever language you pick, learn its details and idioms well. Input, output, if-statements, loops, subroutines/functions, objects (if it's an object-oriented language), etc.

3. When you get fairly comfortable with the details of your chosen language, start focusing on the overall issues of program design: how to put if-statements and loops together effectively, how to break up a large problem into smaller ones via subroutines or functions, how to lay out your data and pass it back and forth between subroutines and functions. Try different ways of doing the same thing, to get a feel for which ones feel more "elegant" or "understandable" to you.

When you learn a second or third language (or more), you'll obviously have to repeat step 2, but it will probably be easier because many languages share the same general features, just expressing them with different "spelling" (syntax). However, a lot of the work you invest in step 3 will carry over from one language to another.
 
  • #9
Yarger
5
0
I suggest starting with C or C++. After learning C, you will have no problem picking up new languages as you go. For science and engineering, you will find that a lot of people use Python or Matlab becauseyhey have a lot of built in features that can make life easy. I would pick up either one of those after you've been working with C for a while.
 

Suggested for: Best programming language for aspiring physics and engineers?

  • Last Post
Replies
20
Views
1K
Replies
16
Views
714
Replies
6
Views
264
  • Last Post
Replies
12
Views
1K
  • Last Post
Replies
2
Views
517
Replies
10
Views
746
Replies
4
Views
567
  • Last Post
Replies
4
Views
802
Top