Learn C++ for Physics & Astronomy: Books & Tutorials

  • C/C++
  • Thread starter aftershock
  • Start date
  • Tags
    Teaching
In summary: But even if you only know how to write functions, that's still a huge accomplishment, and you can start learning how to design and write better functions by reading books, following online tutorials, and so on.People have yet to explain how you learn to program without *actually programming.* I am still curious as to how one does this.
  • #1
aftershock
110
0
I'm taking a computations for physics and astronomy majors course next semester and was told it'd be a guide idea to try and learn some C++ before starting the course. I have absolutely zero programming experience and plan to spend this winter break trying to learn some C++

Any recommended books or tutorial websites? Thanks.
 
Technology news on Phys.org
  • #2
Get this book:
https://www.amazon.com/dp/0672326973/?tag=pfamazon01-20

It assumes you haven't programmed before and is easy to read. Very thorough on all subjects but quite lengthy (1200 pages). You might be able to read tutorials online http://www.cplusplus.com/doc/tutorial/"e, but it might be difficult to decipher for a first time programmer.
 
Last edited by a moderator:
  • #3
You don't even need a book for this. I went through online tutorials for it, did a little extra practice, and did great in my C++ classes.

http://www.cprogramming.com/tutorial.html#c++tutorial

That's where I started. Once you have a grasp of it, do a Google search for more advanced C++ projects or check out Project Euler for more practice.
 
  • #4
I think you would be better served to spend your time learning how to program rather than one particular language.
 
  • #5
Vanadium 50 said:
I think you would be better served to spend your time learning how to program rather than one particular language.

I am always baffled by this. How does one learn how to program without starting with a particular language? You can read a book on programming in general, but how do you *practice* programming without actually programming?
 
  • #6
I agree with V50. C++ is a huge language, which can support just about every possible style of programming (including the styles that should be buried with a stake through the heart IMHO). Unless you have a map of the forest before you start, you will probably get lost somewhere among the 2^16 (or maybe 2^64) different species of trees.

You would be better first learning to how PROGRAM, in a cleaner-designed language like Python, or C# if you want something that looks more like C++.

Learning the syntax of a new programming language is no big deal, if you already know what you want to say in it. I've learned a new language every 1 or 2 years (from necessity, not personal choice) during my working life - and forgotten most of the details of at least 15 of them!
 
  • #7
I'm no expert in programming by any means, as I only have a semester's worth of doing so in Java under my belt, but it still seems to me the best thing to start programming is to start programming in a specific language. When a book has hundreds of pages, I'm pretty sure it also has introductory chapters that can serve as a welcome to all programming languages, not just the one you're learning. I mean, this might be a bad analogy, but how do you learn how to drive a car if not by driving a specific car of specific build?
 
  • #8
Rather then jump straight into object orientated programming and the nastiness of inheritance and parameter passing would strongly recommend starting with BASIC.

You cannot learn to program by reading about it you must do it.
 
  • #9
AlephZero said:
I agree with V50. C++ is a huge language, which can support just about every possible style of programming (including the styles that should be buried with a stake through the heart IMHO). Unless you have a map of the forest before you start, you will probably get lost somewhere among the 2^16 (or maybe 2^64) different species of trees.

You would be better first learning to how PROGRAM, in a cleaner-designed language like Python, or C# if you want something that looks more like C++.

Learning the syntax of a new programming language is no big deal, if you already know what you want to say in it. I've learned a new language every 1 or 2 years (from necessity, not personal choice) during my working life - and forgotten most of the details of at least 15 of them!

People have yet to explain how you learn to program without *actually programming.* I am still curious as to how one does this.
 
  • #10
Saladsamurai said:
People have yet to explain how you learn to program without *actually programming.* I am still curious as to how one does this.
You are making a red herring / straw man argument. Nobody but you has said to do what you said to do. What people have said is you should learn how to program rather than learning how to code. There is a world of difference between programming and coding. That scientists and engineers do not as a group understand the difference is illustrated by [thread=458470]this thread[/thread].
 
  • #11
To make an analogy, "coding" is to "programming" as "spelling and grammar" are to "writing a coherent and effective essay or book."

You need to learn how to code in some particular language, no doubt about that. But that's only the beginning. For example, don't just learn how to write functions, learn how to use them effectively, which involves thinking hard about how to organize your program into modular sections that exchange data in a limited and well-defined way. The general principles don't depend much on the particular language that you're using.

A lot of this comes from experience, and practice in experimenting with different ways of organizing your programs. Almost always, when I finish a non-trivial project, I can see ways that I could have done it differently and possibly better. Sometimes I actually have a chance to re-do the whole thing accordingly, which is a valuable learning experience.
 

Related to Learn C++ for Physics & Astronomy: Books & Tutorials

1. What is the best way to learn C++ for physics and astronomy?

The best way to learn C++ for physics and astronomy is by using books and tutorials specifically designed for those subjects. These resources will cover the necessary concepts and applications of C++, with a focus on its use in the fields of physics and astronomy.

2. Do I need prior programming experience to learn C++ for physics and astronomy?

While having prior programming experience can be helpful, it is not necessary to learn C++ for physics and astronomy. As long as you have a basic understanding of math and physics concepts, you can learn C++ through dedicated resources and practice.

3. Are there any online resources available for learning C++ for physics and astronomy?

Yes, there are many online resources available for learning C++ for physics and astronomy. These include tutorials, video lectures, and forums where you can ask questions and interact with other learners. It is also recommended to check out online courses on platforms such as Coursera or edX.

4. How long does it take to learn C++ for physics and astronomy?

The time it takes to learn C++ for physics and astronomy varies depending on your prior knowledge and dedication to learning. However, with consistent practice and dedication, it is possible to gain a good understanding of C++ within a few months.

5. Can learning C++ for physics and astronomy benefit my career?

Yes, learning C++ for physics and astronomy can benefit your career in several ways. It can make you a more competitive candidate for jobs in the fields of physics and astronomy, as many research projects and simulations use C++. Additionally, having a strong understanding of C++ can also open up opportunities for software development in other industries.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
2
Replies
69
Views
4K
  • Programming and Computer Science
Replies
8
Views
939
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
9
Views
1K
  • STEM Academic Advising
Replies
1
Views
994
Back
Top