Register to reply

Computer science for physics

by bjnartowt
Tags: physics, science
Share this thread:
bjnartowt
#1
Nov20-09, 02:56 PM
P: 273
Hi everyone, I was wondering: is there a book out there that can show an aspiring-physicist how to become proficient with a computer? Namely: learning about file-types, how to get programs to "talk" to one another, using data-analysis "things" (?) like ROOT (the one that's C++ based), etc.?

I use the Windows operating-system, but I'm thinking of relying solely on Linux (when I get around to surmounting the learning-curve).
Phys.Org News Partner Science news on Phys.org
Wildfires and other burns play bigger role in climate change, professor finds
SR Labs research to expose BadUSB next week in Vegas
New study advances 'DNA revolution,' tells butterflies' evolutionary history
chiro
#2
Nov20-09, 04:22 PM
P: 4,572
Quote Quote by bjnartowt View Post
Hi everyone, I was wondering: is there a book out there that can show an aspiring-physicist how to become proficient with a computer? Namely: learning about file-types, how to get programs to "talk" to one another, using data-analysis "things" (?) like ROOT (the one that's C++ based), etc.?

I use the Windows operating-system, but I'm thinking of relying solely on Linux (when I get around to surmounting the learning-curve).
I'm not sure about linux but I'll share with you what I know about windows.

As far as getting programs to "talk" to each other there are a few technologies that allow this:

1) Object Linking and Embedding

This allows generic objects to be embedded from one software program to another program. Its like when you take a spreadsheet and embed it in a word document. Theres a whole standard on this and it will introduce you to a general framework of getting objects from one program and using them in another.

2) Component Object Model

This came after OLE and it can be fairly complicated but through its use of dynamic
interfaces and object definitions it allows software to be used like an object where more or less the software becomes like a "service" where its functionality can be access through the standard.

The newer platform which is .NET has standardized libraries and interfaces that allow fairly high level procedures to be written more quickly that can allow any program written in the .NET platform to respond and act to messages and events and due to the fact that software can be written to be compiled "Just In Time" or JIT you can get the same sort of advantages that Java offers by being compiled on the fly if need be.

There are actually quite a few ways of getting software to communicate to each other.

If you are going to learn about computer science you should take a course in Operating Systems. In this you should learn about processes and threads and its here where you will learn about how you can get two or more processes to share data. One way is using a pipe, another way is using a shared file but most boil down to using some location in memory which is process independent. The way processes are setup in operating systems is that they have their own address space that is reserved for them. Processes typically can't access other processes memory. However threads can typically access other threads memory in the same process.

If you're going to commit to learning C++ I would learn as much as you can about everything thats involved with programming including Operating Systems, Data Structures, Procedural Programming, Version control, as well as any applied programming that will help you get going from say the theory of signal processing or say solving an ODE or PDE to an implementation of Runge-Kutta solution to an ODE. If you're a physicist I will see you typically working on something more along those lines like say calculating FFT's than doing another Facebook clone. Typically many applied math courses have some form of programming but its typically not done in C++ usually a pre-existing package and framework is used that allows one to get results a lot quicker than having to write your own library up.

Also getting programs to "talk" to one another involves a great deal of attention to modern design techniques. Windows for example has a heap of examples where programs are talking to each other all the time. Even if you don't want to program in Windows I strongly recommend that you get a book on standards that have been introduced that talk about software being formed as a "generic service".

Theres just so much to learn but hopefully you can explore the surface and dig deeper when it becomes necessary. Good luck!
diazona
#3
Nov23-09, 01:58 AM
HW Helper
P: 2,155
chiro has some good advice but I'll add a few points:

-YES definitely get your programming experience with Linux. It's easier to learn more different types of programming on Linux, plus it's cheaper (i.e. free), plus you will feel right at home when you're given access to a shared computer cluster which will almost certainly be running Linux or some UNIX-like operating system. And besides, the main tool that scientists use for writing papers, LaTeX, is developed on Linux and is far easier to set up and to use on Linux than on Windows.

-As far as getting programs to talk to one another, all the methods chiro mentioned are Windows-only. In Linux & friends, the primary method of interprocess communication (IPC) is the pipe, which simply takes whatever text is printed by one program and feeds it into another. (It can also handle binary data as well as text) The UNIX philosophy, "do one thing and do it well," basically means that each individual program should be focused on one task, and when you want to do something complicated, you do it by chaining together whatever small programs you need using pipes. If this seems rather clunky... just trust me, it's not. It's simple and powerful, it just takes some getting used to.

-If you use pipes for IPC, you don't really need to understand the internals of the operating system. If you're using other methods, like shared memory, then knowing how an OS works would be somewhat helpful. I generally recommend that anyone who is going to be doing frequent programming take a class in operating systems, because even if you're not going to be doing the kind of low-level programming that actually goes into an operating system, it's still helpful to see how things work "under the hood." In particular, it helps you make your programs more efficient, and when you're writing scientific programs, efficiency is often a major concern because the computations involved can be rather lengthy. Of course, before you take an OS course, you'll need to have a solid grounding in data structures and basic sorting and searching algorithms, and at least some exposure to assembly language and C.

-Things you're likely to run into when doing scientific programming that they don't usually teach you in a computer science class are numerical algorithms, like numerical integration and differentiation. For these kinds of things, I'd recommend having a look at the book Numerical Recipes (there's a website for it which you can search for). It's a large book with a lot of information, and it's intended as a reference, so don't expect to just read through it in a few months; better to get a copy to keep on your bookshelf to use as necessary. You can skim through it in your free time to familiarize yourself with the contents, and when you see an algorithm that interests you, try writing a program to give yourself practice with it.

-Regarding programming languages: don't worry about it too much, because generally once you learn the basic concepts of programming (including, but not limited to, the basic data structures and sorting/searching algorithms I mentioned earlier) in any one language, it's going to be fairly easy to pick up another language. The same concepts apply. The languages used most often these days in scientific computing are Python, C++, and Fortran (Fortran is perhaps on its way out, albeit slowly) so you might want to start with those; conveniently, Python is widely regarded as a good language to first learn programming with. Once you are comfortable with object-oriented programming in Python, it won't be a huge leap to C++.

-Addendum to the previous point: there is also shell scripting, learning to use the Linux command prompt effectively. Now, using the command prompt at a basic level is pretty simple: you type the name of a program, and the computer runs it. But there are lots of fancier things you can do with the command prompt, and it's worth your while to learn at least some of the basics (like input/output redirection and pipes) if you're going to be using Linux.


Register to reply

Related Discussions
Physics to Computer Science Academic Guidance 8
MSc in physics or computer science Academic Guidance 1
Physics or Computer Science? Academic Guidance 10
Computer Science Physics Academic Guidance 3
Physics and Computer Science General Physics 18