Basic python stuff in 1st/2nd year physics)

In summary: C++. In summary, if you want to learn to program, I would recommend C++. It is the most widely used language for programming physics and astrophysics.
  • #1
theneedtoknow
176
0
I have never done any programming (except very basic python stuff in 1st/2nd year physics), and I want to learn some a bit more in depth over the summer. Can anyone recommend which programming language I should learn? What's most-widely used for physics/astrophysics?
 
Technology news on Phys.org
  • #2


C or C++ are probably the most widely used, but it varies a lot by specific field. Right now IDL (a commercial programming language, so it's not free, based loosely on Fortran) is popular in astronomy and astrophysics. But the idea is to learn how to program, and then you just need to learn the syntax for a new language. So C, C++, even Perl would be fine for that, and there are a lot of good introductory books out there (and websites) to get you started.
 
  • #3


I wouldn't spend much time worrying about which language to use. You need to learn how to program. What I mean by that, is you need to focus specifically on programming techniques and practices since they translate into all languages. There is a great book titled "Code Complete" that covers all sorts of things related to the art of programming while focusing on a few popular languages (C++, C#, and JAVA are the ones I can think of right now). Definitely worth picking up if your interested in programming for hobby or career.

A link to the book: https://www.amazon.com/dp/0735619670/?tag=pfamazon01-20
 
Last edited by a moderator:
  • #4


Squeak: Learn Programming with Robots by Stéphane Ducasse
 
  • #6


Learn C. All the other languages out there fall into a spectrum with C at one end and Lisp at the other, with most on the C side. You have the intellect to get through 2nd year physics, so work your way through K&R (https://www.amazon.com/dp/0131103628/?tag=pfamazon01-20)
 
Last edited by a moderator:

Related to Basic python stuff in 1st/2nd year physics)

1. What is python and why is it useful in physics?

Python is a high-level programming language that is commonly used in scientific research, including physics. It is useful because it is relatively easy to learn, has a wide range of libraries and tools for data analysis, and allows for efficient and flexible coding. In physics, python can be used for tasks such as data analysis, simulations, and visualization.

2. How do I install python on my computer?

To install python on your computer, you can download the latest version of python from the official website and follow the installation instructions. Alternatively, you can use a code editor or integrated development environment (IDE) that supports python, such as Anaconda or PyCharm.

3. What are some basic python concepts I should know for physics?

Some important concepts to know in python for physics include data types, variables, loops, conditional statements, and functions. Understanding these concepts will allow you to write efficient and effective code for data analysis and simulations.

4. How can I plot data using python?

Python has several libraries for data visualization, such as Matplotlib and Seaborn. These libraries allow you to create various types of plots, including line plots, scatter plots, and histograms. You can also customize your plots with labels, titles, and legends to make them more informative and visually appealing.

5. Can python be used for complex physics calculations?

Yes, python can be used for complex physics calculations. There are libraries such as NumPy and SciPy that provide efficient and powerful tools for scientific computing. These libraries include functions for linear algebra, Fourier transforms, and differential equations, making it possible to perform complex calculations with ease using python.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
1
Views
800
  • Programming and Computer Science
Replies
10
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
16
Views
2K
  • STEM Career Guidance
Replies
23
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
2
Replies
56
Views
8K
  • Programming and Computer Science
Replies
1
Views
743
Back
Top