Forgot your password?
typodupeerror
Programming Education IT Technology Science

Programming As a Part of a Science Education? 508

Posted by Soulskill
from the part-and-parcel-of-the-information-age dept.
An anonymous reader writes "I'm a fairly new physics professor at a well-ranked undergraduate university. When I arrived, I was surprised to discover there were no computer programming requirements for our majors. This has led to a series of fairly animated faculty curriculum conversations, driven by the question: to what extent should computer programming be a part of an undergraduate science education (in particular, physics)? This is a surprising line of questioning to me because in my career (dominated by research), I've never seriously even questioned the need. If you are a physics major, you learn to program. The exact language isn't so important as is flow control, file handling, basic methods/technique, basic resource management, and troubleshooting. The methods learned in any language can then be ported over to just about any numerical or scientific computational problem. Read on for the rest of the reader's questions and his experiences dealing with faculty who have their own ideas.
The reader continues, "I'm discovering the faculty are somewhat divided on the topic. There is even a bizarre camp that actually acknowledges the need for computer programming, but turns my 'any language' argument on its head to advocate the students do 'scientific programming' using Excel because it is 'easy,' ubiquitous, and students are familiar with it. They argue Excel is 'surprisingly powerful' with flow control and allows you to focus on the science rather than syntax. I must admit that when I hear such arguments I cannot have a rational discussion and my blood nearly boils. In principle, as a spreadsheet with simple flow control in combination with visual basic capabilities, Excel can do many things at the cartoon level we care about scientifically. But I'm not interested in giving students toys rather than tools. As a scientist raised on a heavy diet of open source software and computational physics, I'll hang my head in shame if our majors start proudly putting Excel down on their resumes. However, in the scientific spirit, perhaps I'm missing something. So I ask Slashdot, to what extent do you feel computer programming should be a part of an undergraduate science education? As a follow-up, if computing is important, what languages and software would best serve the student? If there are physics majors out there, what computing/programming requirements does your department have? My university is in the US, but how is this handled in other parts of the world?"
This discussion has been archived. No new comments can be posted.

Programming As a Part of a Science Education?

Comments Filter:
  • CMU (Score:5, Interesting)

    by allanw (842185) on Thursday May 29, 2008 @08:01PM (#23594163)
    The introductory physics classes at Carnegie Mellon use VPython [vpython.org] to run some simulations. It's pretty simple to use and intuitive. The textbook [ncsu.edu] makes use of it too.
    • Re: (Score:3, Informative)

      by kaufmanmoore (930593)
      I was in the class taught by the authors of the textbook mentioned above. We had to write the code to model simulations of such things as magnetism and inertia/momentum. I enjoyed the labs that involved the programming, but I'm not sure what effect it had on other people who aren't as into computers.
    • Re:CMU (Score:5, Interesting)

      by cashman73 (855518) on Thursday May 29, 2008 @08:32PM (#23594459) Journal
      I'm currently working in the computational biology department at the school across the street from CMU [pitt.edu],... A lot of people don't think of "programming" and "biology" in the same sentence, and most biology programs are the last science programs that would even think of requiring programming as a prerequisite for graduation. However, once you get into the more specific structural and molecular biology fields, you almost can't escape programming. Almost on a daily basis, I use perl. Most of our software is probably coded in C or C++, and some of the older software is coded in Fortran, though that's not as common anymore. Some people in our department have been doing some stuff with Python, too, though I personally haven't. There's also quite a few genomic and database applications where SQL will come in handy for the database work, and an increasing amount of computational biology projects are coming online with web interfaces, so PHP could be useful.
      • by tsm_sf (545316)
        Not being able to manipulate data seems like it would be such a huge hole in someone's education.
    • by DancesWithBlowTorch (809750) on Thursday May 29, 2008 @08:58PM (#23594677)

      My university is in the US, but how is this handled in other parts of the world?"
      I studied physics in Heidelberg, Germany [uni-heidelberg.de]. During the first half of my first year (about 6 years ago), we had introductory courses in C (they liked to call it C++, but it really was glorified C). In the second half of the first year, there was a "technical informatics" (read: Hardware design) course, which involved every student designing a little 16bit chip which could decipher the DCF long-wave time signal. That part used mostly C, but had some bits were we had to gnaw through Assembler.

      That was my formal introduction to computing. Later on in my course, I mostly used MatLab, and occasionally C. Sometimes I had to reverse-engineer old Fortran code. I wrote my Master's thesis in MatLab (even though it was a rather computationally expensive application. In scientific applications, the time saved during design time often easily makes up for the loss in computational efficiency).

      Since I started my PhD, I've tried a lot of different languages, from MatLab to Java, C# Python and, recently, F#. Even though I was brought up with OSS (my laptop runs Debian next to Windows), I have come to value the rapid development capabilities of .NET (I know, it sounds crazy. Please try it out before you flame. Visual Studio is certainly the best (maybe the only good) piece of software Microsoft ever made). But I'm a theoretician, so my focus is on being able to rapidly change my code to incorporate new ideas. Experimentalists, who mostly just want to control their machinery, need to know more about Fortran, C, and on the high-level side, LabView and MatLab

      I think my point is: It's probably a good idea to start with powerful low-level languages like C first, but don't overdo it. It's good if your students know about the existence of Assembler and Fortran, but the important point is that they lose their fear of computers. Nowadays, teenagers grow up with computers, but they never get to see behind the web 2.0 surface. Our generation grew up with text editors and batch files. They grow up with facebook. So it's important to give them a look behind the curtains. Let them feel the power of being able to control memory adresses. Once they have lost their fear of pointers, they can move on to use high-level languages that safe loads of design time, while being able to descend down into the architecture when it really counts.
    • Re:CMU (Score:5, Insightful)

      by stephanruby (542433) on Thursday May 29, 2008 @10:22PM (#23595333)

      With one of my professors, it was "You can use any language you want as long as it can do the job it's required to do and your TA is willing to accept it". That approach worked really well for us. The TAs were very flexible. In fact, I would tend to think the job of grading projects was much more interesting because of all the variations in the student's work. Remember, you've said it yourself, this is not supposed to be a class on syntax. At my school at least, they didn't teach us the languages, they taught us the concepts (and you were supposed to learn the computer languages on your own, and of course, every Professor had their favorite pet language they had been developing/using for the last twenty years).

      For the lecture itself, I think the choice should be left to the Professor teaching the class in question. If the Professor is an expert in Logo, let him use that -- if that's what he wants. If the Professor is an expert in pseudo-code and wants to use that -- let him use that. If the Professor is an Expert in VBA, let him use that if that's what he wants to use. Hopefully, your faculty is made up of smart people. If they're smart, just let them use the tool of their choice -- they'll probably do a far better job with them (than giving them some pre-assigned tool). An chances are, the students will gravitate toward the common tools already used in the industry.

      The thing is, VBA may not be considered a grown-up language to you, but I can almost guarantee that if you run into a Physics Professor who's an expert in VBA -- he/she will be able to do things in it that you couldn't even dream was possible. So I would advise you against going down that road of trying to prove them wrong, I'm pretty sure you won't be able to. So let that Professor teach in VBA if he wants to, but don't let him force you to teach in a tool you don't want to teach in.

      • Re:CMU (Score:5, Interesting)

        by somersault (912633) on Friday May 30, 2008 @03:46AM (#23596911) Homepage Journal
        Yep - one of the engineers at our company used to work for Rolls Royce in the 70s, and at some point was a professor at Aberdeen University. He used to use FORTRAN, possibly some other languages too, but basically at the moment he does most things in excel (I think he likes Matlab too but the stuff I've seen him do mostly involves Excel). It seems to be pretty powerful, and good for easily graphing results from large datasets, etc. I've been doing work converting a couple of the engineer's hydraulic simulation spreadsheets over to Delphi (so that people other than the engineers can use the calculations, and can't see or change what's going on behind the scenes, since these spreadsheets are simulating what the tools we build can do, and they don't want our competitors getting too much information). I can definitely see the attraction of doing calculations on large datasets the Excel way - or rather, the 'spreadsheet' way, since Excel isn't the only spreadsheet system, just the most common..
        • Re: (Score:3, Interesting)

          by Jellybob (597204)

          I can definitely see the attraction of doing calculations on large datasets the Excel way - or rather, the 'spreadsheet' way, since Excel isn't the only spreadsheet system, just the most common..


          I once heard Excel described as the world's most popular functional programming language, which if you take away the GUI, it effectively is.

          Once you start looking at it that way, rather then "fucking Excel" it starts to be quite a lot more powerful.
          • Re:CMU (Score:5, Interesting)

            by TapeCutter (624760) * on Friday May 30, 2008 @06:51AM (#23597605) Journal
            My kids are both gorwn now but back in the early nineties one of my kids had a high school maths teacher who taught kids the basics of both algebra and programming using Excel.

            The same teacher also taught my older kid in programing using Pascal, my son came home from his class early in the year with a single sheet of paper. He gave me the sheet and said mockingly "the teacer reckons that assignment will take all year" (he already knew how to set up a BBS and I was teaching C lab classes at uni, so he thought he knew something). When I read the sheet I found it was a very clear requirements spec for a toy database that would indeed take him through all the common programming tasks like file handling, common data structures, sorting and searching, input parsing, relational data storage, resource management, display, etc. The project was broken into four phases that were worth 25% of the final mark. Only met the guy once or twice but his techniques rank him as one of the best programming teachers I've come across at any institution.
    • Re: (Score:3, Informative)

      by caramelcarrot (778148)
      Physicists here at Cambridge, UK use Excel in first year for a mathematical methods exercise, and then in second year we use excel again for another mathematical methods exercise and C++ (formerly Fortran) for a programming in physics course. I personally think Excel IS useful for seeing the flow of iterated algorithms, numerical integration and so on - but learning a proper language is important to if you want people to mature into programming at all. Plus programming seems so important in research environ
  • Teach them Python (Score:3, Informative)

    by Anonymous Coward on Thursday May 29, 2008 @08:05PM (#23594183)
    While a lot of computational physics requires speed, I find myself on a daily basis needing to write simple programs to collect, filter, transform and plot data. I have found no better language for writing these quickie tools in than Python.

    Once they know Python, then they can pick up C++ or Java as context requires it. And if they never have to deal with really huge amounts of computation, then Python + Scipy might get them by for most everything. (And if not, Python has bindings for everything, practically.)
  • Necessary Tool (Score:5, Interesting)

    by MicktheMech (697533) on Thursday May 29, 2008 @08:06PM (#23594203) Homepage
    Physics requires number crunching. It's that simple. It's not much use learning differential equations if you're incapable of solving anything useful. Any physics or engineering major should learn at least basic numerical methods and how to implement them. For me, we did it with C, nothing fancy. As far as using Excel for scientific computing, some of my classmates tried to pull this in a heat transfer class. It's a joke, it'll work for something really simple, but it's no good for any serious work.
    • by Odder (1288958) on Thursday May 29, 2008 @08:18PM (#23594321)

      The GSL [gnu.org] is mostly C. It's useful for students to take a numerical methods class and recreate the basics and to understand the limitations. Once they know, they can use libraries like GSL to get real work done.

      Excel is not only a joke for real problems, it's a real problem to grade.

      • Re: (Score:2, Insightful)

        by willyhill (965620)
        Excel is not only a joke for real problems

        Scientific problems, sure. It's not designed for that any more than GNUCash is. But let's not generalize, twitter. It's actually one of Microsoft's better products.

        For complex charting and plotting I really like GNUPlot [gnuplot.info].

        • by s4m7 (519684) on Thursday May 29, 2008 @10:12PM (#23595259) Homepage

          It's actually one of Microsoft's better products.
          I'll grant that Excel is really quite simple and flexible. However it has some serious drawbacks when compared with something like SPSS [spss.com] when it comes to the management (and analysis) of actual data. like how sorting can be limited to one column and botch all your data. Like how data types aren't strictly enforced. Like how a single sheet can be only 256 columns wide or some such nonsense. (maybe they've fixed that since?) Excel is a toy when it comes to serious manipulation of data, and if you don't agree, you haven't actually done any. I was a data processor at a market research firm, and they seriously expected me to combine and normalize 20 different international datasets (60k+ records with ~350 fields) in Excel. Were it not for SPSS, I would have lost the scant scraps of sanity I have remaining.
    • Re:Necessary Tool (Score:5, Insightful)

      by the eric conspiracy (20178) * on Thursday May 29, 2008 @08:41PM (#23594545)
      I think you have made the case for an applied math course in numerical analysis that contains about 2 hours of class lecture time in computer applications.

      As far as requiring physics majors to take a programming course, I think that is ridiculous. I went through a PhD level applied physics program including writing a simulation of chemical reactions occurring on the surface of space shuttle heat shield tiles during re-entry and never found anything more than spending a few hours here and there reading language syntax. The applied maths literature is full of pidgin code for the algorithms that is easily translatable into the language of your choice. The courses in algorithm analysis and numerical methods are the rest if what you need. A formal course would have been both a terrible bore and a waste of time that should be spent on something more useful like quantum electrodynamics.

    • Physics requires number crunching. It's that simple. It's not much use learning differential equations if you're incapable of solving anything useful. Any physics or engineering major should learn at least basic numerical methods and how to implement them. For me, we did it with C, nothing fancy. As far as using Excel for scientific computing, some of my classmates tried to pull this in a heat transfer class. It's a joke, it'll work for something really simple, but it's no good for any serious work.

      I know a couple people who did the computational work that earned their professors a Nobel prize who used Excel to do it all. It took a couple years to run simulations that probably could otherwise have been done in a month, but while they waited for the computer they were busy doing other projects, and if they really wanted they could have used more than one computer at a time.

    • by davros-too (987732) on Thursday May 29, 2008 @09:01PM (#23594703) Homepage
      Every physics graduate should have a grounding in numerical methods. This requires some programming, but the critical point is that the numerical methods drives programming not the other way around.

      Every physics graduate should have the ability to find and use Numerical Recipes by Abramowitz and Stegun. Doesn't matter if they're using the C version, Fortran or whatever. This means you need to teach some programming, but more importantly the skills to understand the recipes.
      • by khb (266593) on Thursday May 29, 2008 @11:49PM (#23595937)
        The best single document would be the classic Goldberg paper on "What Every Computer Scientist should Know about Floating Point Arithmetic" http://docs.sun.com/source/806-3568/ncg_goldberg.html [sun.com] (originally published as an ACM paper; kindly corrected and republished by the Sun Floating Point Group (Goldberg worked at Xerox). It should be required reading.

        Beyond understanding the differences between conventional mathematical arithmetic and what computers actually do, the student really should have a formal introduction to data structures.

        Lastly, and why I hung the comment on this one, Numerical Recipes is well known to not be a good numerical choice. Making it the foundation of a class would be a real crime against computing.
      • Re: (Score:3, Informative)

        Abramovitz and Stegun are the Table People [wikipedia.org]! The numerical recipes people are Press et al.
    • Re: (Score:3, Interesting)

      by kestasjk (933987)
      At the uni I attend Computer Science and Physics can be bundled into a single 4 year course (CS or Phys individually would be 3 years), and I find the two complement each other very nicely. They almost feel like two sides of the same coin, somehow.
    • FORTRAN? (Score:5, Insightful)

      by EmbeddedJanitor (597831) on Thursday May 29, 2008 @10:44PM (#23595493)
      Want to crunch numbers, then Fortran is better than C. Even Java is better since it gives stronger type checking. Python is probably good too (but maybe a touch slow).

      Just like they say "Don't give a programmer a soldering iron", giving physicists something like C is probably giving them more than they need for most number crunching.

      • Forgot to mention... there's a reason you shouldn't give us programmers soldering irons. Did you know those things are really, really freakin' hot?! I never did get that firmware working again after that...
  • by smolloy (1250188) on Thursday May 29, 2008 @08:09PM (#23594245)
    As someone with a physics doctorate, I am appalled to hear physicists suggesting the use of Excel for real scientific studies. What are those physicists going to do when faced with (for example) particle physics data stored in C++ objects? Or face a control system dominated by Matlab? Or are handed a simulation package built in Fortran?

    I'm not suggesting that all physics students must learn C++ and Matlab, but they should be taught a grown-up computer language so that they at least understand the concept of C++ objects, or how to begin solving the problem of communicating with a machine via a Matlab environment.

    My examples are very specific, but you get the idea. Physicists need to be aware of certain computer programming concepts (which cannot be gleaned from experience with spreadsheets) otherwise they will fall flat on their face when faced with a real research environment.

    The specific language is not very important, but physics tends to be dominated by C/C++ and Fortran, so these would definitely be a good place to start.

    Even BASIC is better than Excel.....

    • I assume that Physics majors at your university are required to take some level of math classes.

      Excel is not sufficient instruction in programming any more than Algebra is sufficient instruction in math. So if someone suggests that all students need to learn is Excel, you may ask why the students are required to take more advanced math classes.
    • by paradoxSpirit (1172919) on Thursday May 29, 2008 @08:43PM (#23594559)
      If I had mod points ...

      I cannot agree more. After a master in high energy physics where I learned C++/matlab(or octave)/gnuplot/latex/... I decided to continue my career in medical physics.

      I was shocked by the omnipresence of Word and Excel. I am sorry, but there should be corporeal punishment for people publishing scientific papers with figures made by Excel.

      Now, with a good undergrad training in programmation we would avoid such abberations
    • by Anonymous Coward on Thursday May 29, 2008 @09:42PM (#23595051)
      I know Matlab has really low (or no) cost for educational use, but could you guys please switch over to GNU Octave (matlab clone) or SciLab/SciCos (similar but different & has a Simulink equivalent)? That way, after school people can keep using low cost tools in industry. My department spends a ton of money for those tools simply because the people who make decisions don't know about good/cheap alternatives. And guess where these guys learned Matlab. Yep - back in school.
      • by udippel (562132) on Thursday May 29, 2008 @10:26PM (#23595357)
        I know Matlab has really low (or no) cost for educational use

        Usually I don't feed ACs, but here I am astonished and ask for clarifications, because we, as educational institution with a 'university' in its name, have to pay horrendous sums for the licenses of Matlab. One single seat license is close to the campus license price of Microsoft.
    • by hubie (108345) on Thursday May 29, 2008 @10:06PM (#23595229)

      There are whole classes of problems that Excel is well suited to solve. Linear propagation models, optical ray tracing for instance, is one. I remember back in the early 80's spreadsheets in general were touted as a good way to solve complicated 2-D boundary value problems via iteration because you are given a nice cell grid to start (I have foggy memories of doing this myself on whatever preceded Excel). I have seen some very impressive models built out of spreadsheets; it wouldn't have been my tool of choice, but the people putting them together could really do some impressive things.

      At the undergraduate level I don't know what to say. I don't know how much programming I would force on the physics major. I am a very strong advocate of teaching mathematical methods for the major, as I had been. My professor spent some time having us learn FORTRAN, but I wouldn't say it was very productive because we were learning it for the sake of knowing it, not because we had a task to use it for (and so it really didn't set in). I didn't do any serious programming until graduate school, where I ended up becoming a FORTRAN expert after all.

      I do agree that Excel can't handle real data sets, especially with the limitations of plotting 32k data points and only holding 64k in a column. On the other hand, not too much data handling you do at the undergraduate level deals with that much data.

      I wouldn't say the students would be at a major handicap having only used Excel at the undergraduate level. If they are handed that particle data set in C++ objects, they'd do what I would have to do: learn C++. Between undergraduate and graduate school I made a conscience decision to learn either C or FORTRAN, since those were the languages of physics. I settled on C, picked up some books and started teaching myself. When I got to graduate school, the research I inherited was all FORTRAN, so I ended up betting on the wrong horse (at first, at least). When I got out of graduate school, I ended up learning C for the job I was doing at the time (I've since drifted into the IDL/Matlab world and now I find I'm rusty in all of them!).

      You also have to be careful what you consider a grown-up language. By the time I got out of graduate school, C++ was all the rage and I kept hearing how they couldn't believe that any serious programmer would program in a non-object-oriented language unless they were either old or a Luddite.

    • Re: (Score:3, Informative)

      by syousef (465911)
      I agree that Excel isn't enough, but don't dismiss Excel as a tool.

      For doing some of the basic astrophysics in my Astronomy masters it was invaluable. Now I did this masters for my own learning and wasn't intending to use it professionally. To put it in perspective the course I took would make an okay stepping stone to teaching highschool physics/astronomy or first year university Astronomy but it was more an educator's course than a professional Astronomer's course. So much so that we were permitted to ski
  • C and FORTRAN (Score:4, Informative)

    by Odder (1288958) on Thursday May 29, 2008 @08:11PM (#23594265)

    All of the libraries and programs of interest are in C and FORTRAN. C++ is interesting and used but the other two still dominate. If you had to chose between the two for teaching people to program, take C. For utility, the two are about equal.

  • by sirwired (27582) on Thursday May 29, 2008 @08:11PM (#23594267)
    It depends on what you feel they MUST learn.

    Certainly Excel can be a powerful, and useful, tool in data analysis. But I agree, I would never call it programming.

    For simulation, however, I would expect you need something a bit more powerful. Perhaps you can teach all the students how to use Excel to analyze experimental data, and design a separate course for simulation design, which would, in turn, use a far more featured language/toolset.

    The big danger with trying to teach a "real" language is that you spend the whole semester teaching students with no aptitude for the work the basics of structured programming and they still won't have time for the numerical analysis that is important to them as scientists. Structured programming is as natural as breathing to a geek, but it would be a bit more of a struggle to somebody without the right mindset. I don't see any way of forcing two required semesters of programming on every student. Just not room in the schedule for it.

    However, keep in mind that the purpose of college is not to get those students employed, it is to teach them to think. Your brighter students are going to figure out that as a practical skill, most of them will need to know how to program, and would possibly sign up for "Programming for Theoretical Science Majors" as an elective The not-so-bright students... well... they will struggle in the real world, just as they always have.

    SirWired
    • Excel is unacceptable for numerical analysis. It is WAY too slow, and doesn't teach use of algorithms.
      • Re: (Score:3, Insightful)

        by PitaBred (632671)
        Not only that, but Excel "interprets" all kinds of things about numbers that you may not mean for it to (I run into this ALL the time). incorrectly [joelonsoftware.com].
    • "Perhaps you can teach all the students how to use Excel to analyze experimental data,"

      I seem to recall from the MSOOXML debacle that some of the numerical routines in Excel are based on incorrect definitions. I don't think I would suggest it for analysis of experimental data without some testing of the routines to be used.

  • by goofballs (585077) on Thursday May 29, 2008 @08:11PM (#23594273)
    learning to program in excel / vba DOES do what you CLAIM to want (flow control, file handling, basic methods / techniques, troubleshooting), so why is your blood boiling? preconceived notions? and yes, excel IS surprisingly powerful (those who don't think so aren't leveraging its capabilities). someone who can PROGRAM in excel / vba (versus just manipulate a spreadsheet) will be perfectly capable of programming in perl / python / fortran with very little additional work if the need arises.

    (i'm an aerospace engineer, and for work, i program in c, fortran, java, vb, and yes, excel / vba,depending on the need)

    • by thealsir (927362)
      Word. I've used it and with combined with VBA with access to pull datasets from a database, it can be quite powerful, and do exactly what you need it to. In my case, it was handling scheduling for a 40,000+ student university. The datasets pulled easily ran into the millions of records.
      • by PitaBred (632671)
        Scheduling isn't scientific data. Excel doesn't have near the precision or consistency that's needed to really work with it. I have numerous examples from my work with just product data of Excel screwing up interpretations of data. I really wouldn't trust it with significant data.
    • so why is your blood boiling

      It gives the students the skill of pointing at pictures in Excel 2003 (or whatever release they use) which translates poorly into pointing at pictures in other versions of the same application and gives them no concepts they can carry to other applications or programming languages. Everything else forces the student to consider each action in such a way that it can be presented in several ways.

      A good teacher could use macros to teach programming concepts but I suspect most stud

    • by Genda (560240) <mariet@@@got...net> on Thursday May 29, 2008 @08:56PM (#23594663) Journal

      I once had a friend who built an instantiation of LIFE in Excel. Using macros and stored VB code in each cell, he was able to have every cell look up the context of every other adjoining cell during each generation, and the cells would turn on and off accordingly.

      ...Of course it took forever to run a generation.

      ...And it was insanely complicated and wierdly convoluted.

      ...But he was able to demonstrate his mental capacity for having been able to visualize this arcane solution in the first place...

      I'm not saying it can't be done in Excel. I'm saying just because you're versed in Excel, doesn't mean it's an expedient, or even appropriate tool for managing complex data structures, critical physical concepts, or large multidimensional problem sets.

      For straight forward engineering and archtectual applications, it might well prove to be an excellent resource. It just seems a little like going next door via the polar route to try ways of making problems fit an inappropriate tool, vs finding an optimal tool in the first place and having it available for problems requiring greater flexibility, and less application related operational overhead.

      Of course, when what you have is a hammer...

  • by overshoot (39700) on Thursday May 29, 2008 @08:14PM (#23594285)
    Preface: I started out on a physics degree almost forty years ago but ended up with a CS. Meanwhile I have two children majoring in physics, and when I retire I plan to go back for the MS physics just for the Hell of it.

    Bottom line: IMHO no special effort to add programming to a physics curriculum should be necessary. However, there are obviously classes where programming is essential to the physics content and for those you would horribly disserve your students by candy-coating the computational aspects.

    Require programming as a pre-requisite where the class requires it, and if that means that none of the reasonable degree tracks are possible without it then you have your answer.

  • by Average (648) on Thursday May 29, 2008 @08:16PM (#23594303)
    Back in undergrad, I helped my AtmoSci Masters' roommate out with several projects. At least in his case, the problems involved a lot of comma or space separated text files and mostly just limited data manipulation. Students had all been taught FORTRAN, weakly, and most classmates were trying to do it in FORTRAN. Several times, we created 20 line not-terribly-obfuscated Perl programs that worked much better than pages of FORTRAN for the task at hand.

    Probably Python would be the 'cooler' kit these days. But, my former roommate, now with the National Weather Service, says it's all command-line Perl scripts there and working with me to learn Perl was one of the best things he got in college.
    • Re: (Score:3, Insightful)

      by CastrTroy (595695)
      I remember trying to help some chemical engineers out with their third year programming assignments for numerical analysis. I didn't understand any of the numerical analysis aspects, and they didn't understand any of the programming aspects. Made for a really frustrating time. Trying to explain to someone how to program something you which you don't understand how it works is very complicated. I don't think I ended up being much help on the assignment, even though I am quite a good programmer. Programmi
  • The exact language isn't so important as is flow control, file handling, basic methods/technique, basic resource management, and troubleshooting.

    A solid understanding of the nature of floating point numbers wouldn't hurt either. For example, something like David Goldberg's What Every Computer Scientist Should Know About Floating-Point Arithmetic [sun.com].

    As to the language not being important, I don't know that that's entirely true. Each language offers a choice of types and some sets of choices are more instructive than others. I personally think Lisp or Scheme are good teaching candidates because they offer arbitrary precision integers and rational numbers in addition to basic floating point number types so that it's easy to see side-by-side the trade-offs being made between correctness on one hand and space/speed on the other hand that go along with choices in this regard.

    Plus, if you go the Scheme route, you get teaching materials focusing on good abstraction like Sussman and Wisdom's Structure and Interpretation of Classical Mechanics [mit.edu], the proper companion to Abelson and Sussman's popular CS text Structure and Interpretation of Computer Programs [mit.edu]!

  • by uniquename72 (1169497) on Thursday May 29, 2008 @08:19PM (#23594333)
    ...one might expect, given the ubiquity of computers, that everyone (not just science majors) have some basic understanding of programming, even if it's just -- err --- BASIC.

    I'll go even further and suggest that this isn't appropriate for college, but would fit nicely into 6th and 7th grade algebra.
    • by overshoot (39700) on Thursday May 29, 2008 @08:38PM (#23594509)

      In a modern, educated nation one might expect, given the ubiquity of computers, that everyone (not just science majors) have some basic understanding of programming, even if it's just -- err --- BASIC.
      However, I believe that we're discussing the United States.
    • ...one might expect, given the ubiquity of computers, that everyone (not just science majors) have some basic understanding of programming, even if it's just -- err --- BASIC.

      One might, but they'd be wrong. And if from what I typically read on Slashdot is any indication, people like it that way.

      I think the questioner's statement that "Excel can do many things at the cartoon level we care about scientifically. But I'm not interested in giving students toys rather than tools." accurately (and depressingly) s
    • Re: (Score:2, Insightful)

      by Anonymous Coward
      And perhaps we should also discuss how to replace the driveshaft in driver's ed, and teach our band students how to make flutes. In order to use a car, I don't necessarily need to know exactly how it was constructed and in order to use a computer I don't necessarily need to know how to program it.

      Just because computers are so prevalent doesn't mean that everyone needs to know how to program. Effective programming is very analytical and structured and some people just don't work that way, and that's fine- w
  • Matlab (Score:5, Interesting)

    by KalvinB (205500) on Thursday May 29, 2008 @08:21PM (#23594355) Homepage
    What good reason is there that would make Matlab insufficient for a physics major? What amount of programming does a physicist do on a given day at the job?

    If a physics major wants to learn more about programming than is required to compute complex formulas in Matlab then they should probably minor or double major in Comp Sci.

    I majored in Math and the only programming I did as part of my degree was in Matlab. And that was in applied classes. I was taught just enough Matlab to do the assignments.

    C/Java courses would have been a waste of time. A physics major's time is best spent learning how to use existing tools rather than wasting time learning low level languages so they can reinvent Matlab functionality.
  • Matlab/octave (Score:5, Insightful)

    by drolli (522659) on Thursday May 29, 2008 @08:21PM (#23594363) Journal
    I am a experimental physics postdoc. Nearly everybody i know uses Matlab/Octave (theoreticians Mathematica). For simple (not heavy number crunching), matlab/octave is the de-facto way to exchange numerical programs. You get without much trouble results and a plot within a few minutes. And your students will learn what vectorization is, if they use matlab long enough. (if you can write you operation in a vectorized form, you can also do heavy number crunching). The documentation of matlab is excellent, and there are a lot of toolboxes which actually solve detail work (they have their price). You can use instrument control and DAQ toolboxes to control experiments directly. The matlab support is responsive and not arrogant at all (reporting bug is more a "thank you, we'll look at it" experience instead of a "what the fuck are you doing to trigger this bug? dont do it."). One big problem about matlab is that it spoils the programming style a little bit, but after all, these are physicists. The ones who can not program when they enter university will never learn it fully.
    • I just want to second this. Both universities that I have attended have had a Numerical Methods class taught in Matlab, and that class is fantastic for scientists and engineers. On one hand they learn all the fundamental, theoretical issues related to approximating calculations on computers, and on the other they learn a practical, industry-standard tool that they will use for the rest of their careers.

      During my undergraduate I had issues with them teaching a proprietary language, but with the phenomenal p
    • Re: (Score:2, Interesting)

      by 32Na (894547)
      Off on a tangent... You mentioned Mathematica, I've found at my University that many students got their first introduction to programming there, and continue to use it in research, in tasks it is arguably not well suited for. Mathematica is a good way to visualize math, and perhaps a decent intro to programming, but I'm very surprised to frequently find it used for extensive Monte Carlo simulations where floating-point calculations would be much faster and sufficiently precise.
  • When I was an undergraduate at Portland State University (Oregon USA) in the late 1970s, a semester of programming was required for us. In Fortran. Using punch cards. One card per line of code.

    I managed to take the course about three times (like most classes outside my major) before passing. The first time was with a Chinese Grad student teacher. We didn't even have a textbook. He recommended that we buy the Donald Knuth series of books at about the cost of fifty hours of minimum wage w
  • ... for physics majors to be required to learn programming. Programming is simple for physics majors, and they'll pick it up just fine on their own.
  • by billstewart (78916) on Thursday May 29, 2008 @08:26PM (#23594399) Journal
    There's a certain extent to which students need to learn basic tools - I'm surprised to hear an assertion that they're already familiar with Excel but they should learn to use spreadsheets, because they're really convenient for many kinds of problems, just as (ahem) slide rules were when I was in college (and calculators were beginning to be, and PDP-11s were.)


    But scientists are going to need to do increasing amounts of computer use as computers pervade and inform the sciences, and that means doing their own programming, including writing real programs and writing scripts to bash input or output data for other programs. So they not only need to learn some syntax, and some scripting languages, they need to learn basic data structures, efficiency issues, debugging, and one of the most important lessons from my CS100 days - "Never trust input" "Ever" . That means they need at least two semesters of programming.

    As scientists, even if they don't ever end up doing much more programming than feeding input to other packages and interpreting the output, they need to be able to do it in ways that will run in finite amounts of time and produce correct output - and learning not to trust input is as basic as learning not to connect the 110volt power to a 5 volt device or use fire near flammable liquids.

  • I have mixed feelings on this topic.

    With a BS and MS in physics I find programming to get in the way of what the physics is about.

    On the other hand I have spent 40 years programming and find it forces one to clarify the ideas behind any area.

    I was taught Algol-60 at Stanford from the computer science department. At that time the physics department did not require any programming.

    The experience of Algol lead to SAIL (Stanford AI Language) and then MAINSAIL (Machine Independent SAIL) and late
  • I'd like to make the point that physics majors are going to come in with VASTLY different levels of programming skill-- much more variation than in mathematical background. Some will have never programmed at all, while others may have programmed professionally. Any requirements you set up should take this into account: a placement exam of some sort is what I have in mind, although it could be relatively simple: "Have you programmed before? Do you know what a loop is?" etc. Even the simplest programming s
  • If they need to program to do their work, they need to learn to program. If they don't, well then, they don't.

    If they need to know the conceptual basis, they can get that from math (which physics students get plenty of) or in a more explicit form, from a course in logic. These prepare one for programming by teaching those concepts and so already serve the purposes of background material. If the students needs training in the thinking process, these should do, or else they're not doing their jobs.

    Teaching th
  • I'm a physics undergraduate and my research is computational, so of course I think programming proficiency is a wonderful thing to have. But many physics students and professional physicists never use it. I've found C++ to be the most useful, though a grasp of at least one common computer algebra system is also necessary. Avoid Maple. Also, many professional physicists have a terrible grasp of computer science. I can tell this even though I'm mostly self taught. Many physicists still think FORTRAN is
  • Given the vagaries of university curricula, not to mention the ever-present inter-departmental fighting and politics, I'm not surprised that would be a lot of science departments that would not require a programming class of some kind.

    Which is not to say that they shouldn't. I note that my own alma mater (Brigham Young University) has a required course in 'Computational Physics' for all Physics majors, but that is primarily solving integrals and differential equations using MAPLE. ..bruce..
  • I did a Physics undergrad in the UK about 10 years ago, so I can give you one overseas data point.

    They made us learn FORTRAN77 (shudder) for one semester, but it honestly wasn't used much in the curriculum beyond that class. I did a bunch of programming outside of that because my senior (third year...same thing) projects were entirely theoretical, but that was entirely self-taught...there was little to no formal system for getting students into serious programming.

    For an undergrad curriculum, I'm not sure
  • I wasn't a physics major myself, but I did know several in college (graduated five years ago), and they all had to do some amount of programming; if not for actual coursework, then for their summer research assistant jobs. As I recall, Fortran, Matlab, and IDL were all used, probably C as well. I don't think actual CS courses were a requirement, but I know that many of them took at least an intro CS course anyway. My take from this is that while it may not be necessary to require students to learn progra
  • Critical Thinking (Score:3, Interesting)

    by Genda (560240) <mariet@@@got...net> on Thursday May 29, 2008 @08:38PM (#23594511) Journal

    I'm surprised this is even a question. There is a meaningful use for computers and information technology at virtually every level and function of Physics, save possibly the imagining part.

    And even there, the mental muscles you acquire, solving puzzles, constructing semantic connections, seeing the big picture while managing the minutiae, all help to make you a better scientist, to see your problem newly. In fact a great physicist would want to try on at least two or three significantly different world views, just so they have the freedom to Grok their specific field in new and powerful ways. In my experience, getting mired in a narrow way of seeing things is the kiss of death for someone dancing on the fuzzy edge of unraveling the mysteries of existence and trying to see all in a meaningful and relevant way.

    Additionally, the language of choice is clearly Vpython. Great for simulations, rich set of programmatic tools, quick prototyping, high level, easy to learn, tons of documentation, and huge user community with tons of ready made chunks of code available for the asking. Excel is a kiddie car. Forgive me, but trying to graphically express a tensor field in excel would be like trying to figure out how jerry-rig a Big Wheel to compete in the Indy 500. You're not going to achieve anything interesting in Excel, and it's a pitiful tool for expressing higher order concepts or visualizations. It's just not made for that for that purpose.

    If you're looking to get a really sweet pie chart showing the distribution of funds for your next research grant, by all means, use Excel. If on the other hand you want to do a graphical simluation of branes colliding and view a number of possible outcomes, given by a select range of values for the simulations initial parameters, use Vpython. Let the tool fit the need.

  • What is most needed by physics students? Here are my thoughts.

    First, equation solving. This means numerical integration, root finding, and so on.

    Second, spectral methods.

    Third, numerical error. What does it mean for a numerical calculation to be ill-conditioned?

    If they start out without the skills needed to write a trivial program, the physics department should not have to teach them. Don't people learn that much in high school?

    The most important thing is the hardest to teach in a course of limite

  • As a computational physicist my answer is probably biased, but I see programming as a fundamental tool one has to learn in the Physics curriculum.

    As an undergraduate (in Spain) I had two courses devoted to numerical methods, with practicals in Fortran 77, and at least two more where coding was part of an optional practical. Then I had a PhD-oriented course about Fortran 90. At times I wish I had been introduced to C/C++, but switching languages is very easy compared to learning the first one. I did my PhD (
  • I don't see a correlation between a Science degree and programming. I don't see Biology, Chemistry, or Physics majors needing or necessarily gaining anything beyond an understanding of logic. Engineering and Math majors might be good candidates, or any other science type that saw a potential job in Information Technology and the degree as a way in. OTOH I have known several people with degrees in Physics, undergrad and grad that work as programmers. That said, unless a person KNOWS that they will not be
  • by pdq332 (849982)
    If Excel and Word are conceivably viable alternatives with VBA, why not Emacs? You could get lots of obscureness points for it being based on LISP, and you could write a grant proposal to develop it into something serious in, oh say, 20 years? (That's the way academia works, isn't it? ;-)
  • Well, in my engineering physics classes we were put through lots of different programming regimes, ranging from: Excel, Matlab, and also NI Labview and C for collecting and processing data directly from sensors. They were all very different, but the emphasis was always to be able to graphically plot and present your data repeatably and consistently to others. If your students won't be able to do this, they will have to rely on others that can... and frankly you don't want to put them in that position. An
  • In my first year at the University of York, we had to learn Maple and had an optional FORTRAN 90 course.

    Computer science students seem to think that FORTRAN is funny in some way...
  • Our university taught Matlab. It simple enough to learn, has good library support.
  • I'll preface this with saying that I'm currently at the AGU Joint Assembly [agu.org] -- but I'm not a scientist. (I'm in information science, not physical sciences) I'd actually say that we're getting to the point where I could actually see that it's quite possible that future scientists might not need to learn how to program.

    Now, there are going to need to be scientists who can program, but there were plenty of scientists in the past who couldn't program -- coming up with the theories and thinking about their give
  • I think the bigger issue may not be what language is taught but whether the teaching is applicable to actual scientific uses. As an undergrad astro major I took two CS programming classes, Fortran and PL/1.

    While Fortran was the standard when I went into graduate school doing particle physics, it was not as helpful as one might think because of how it was used - learning how to do bubble sorts is nice, but not when you needed to interact with actual hardware, like NIM and Camac crates.

    Similarly, when we wer
  • by starvo (33598)
    So long as its not fortran, you're in good hands.

    So long as its not fortran, you're in good hands.
  • I don't agree with the assertion that a physics major should be required to take a programming class.

    There is little doubt that knowledge of computer programming would be valuable to any science or technology major. But it's one tool among many and depend on what they do with their degree, it's a tool that might go to waste.

    As a CS major, my time an energy in college was wasted with several math courses that I hated and have never, I repeat never used. Had I gone in to a different kind of software developme
  • Here's my take, as a trained computer scientist who has taught college-level students in both computer science and other sciences, and collaborated with scientists at various times: From a practical and pedagogical standpoint, the Excel work you describe sounds like a toy. Training that includes work in a conventional programming language is more likely to prepare these students for several paths:
    1. Being able to work closely with specialists, i.e. computer scientists and/or computational scientists, as colla
  • I have a bachelor's in physics from Berkeley (1987) and a PhD in physics from Yale (1994). There was never any formal requirement that I take a programming course. I happened to have been interested in programming since I was a teenager, and I used it sometimes in my PhD research, but I could have done just fine without it. In fact, it might have been better for me if I hadn't known how to program, because I would have wasted less time on coding that wasn't strictly necessary in order to get my research don

  • by Anonymous Coward
    There are those that don't know how to program. They generally respect those who do.

    There are those that study programming and are respected by others who know what they are doing.

    And there are those (probably managers) who have one course in programming and have written a 50 line program (probably in Basic). They think they know programming. Those people are dangerous.
  • There's everyday tasks like plots and statistics, and then there's specialized tools that are specific to fields and, er, specialties.

    For simple plotting and statistics, I'd look into Scientific Python [scipy.org], or Matlab/Octave/Gnuplot.

    For programming concepts in general, I advocate taking a course from the CS department, preferably one of the ones that are based on SICP (Berkeley CS61A, MIT 6.001). Then supplement that with some sort of imperative language, and you'll be set for life (cough).

    In High Energy Physics
  • I graduated from Vanderbilt in '07 with double major in math and physics. I'd say about half of the majors had some level of programming experience, or were taking those CS courses in addition to the physics.

    My programming was limited to one class on MATLAB. Learning to program was a common debate and conversation between the professors and management and the students.

    The major issue with knowing how to program was for people who intended to goto grad school. It's definitely a huge plus for graduate wor

  • I'm a physics student at the University of Bayreuth, Germany, working on my diploma thesis, and what follows is my perception of the situation at said university:

    There are no strictly mandatory courses that teach programming. Even though, hearing a lecture on a programming language is recommended as is hearing a lecture on numerical computation which touches on numerical accuracy issues as well as basic numeric algorithms (interpolation, equation solving, splines...). Most students choose to follow that rec

  • by frank_adrian314159 (469671) on Thursday May 29, 2008 @10:00PM (#23595189) Homepage
    Back in 1974-78, all students in the University of Illinois' College of Engineering were required to take at least a semester of introductory programming. That included the Physics majors because the Physics department was under the aegis of the College of Engineering (unlike Chemistry, Biology, etc.). That this particular science was placed in the engineering school always seemed like a really weird, but good placement.
  • Resume Buzzwords (Score:3, Interesting)

    by fm6 (162816) on Thursday May 29, 2008 @10:24PM (#23595347) Homepage Journal

    As a scientist raised on a heavy diet of open source software and computational physics, I'll hang my head in shame if our majors start proudly putting Excel down on their resumes.
    And why is it better for a physicist to be able to put "C++" on their resume? Anybody of average intelligence can stumble their way through an elementary programming course. Doesn't make them an expert scientific programmer. That can only come through applying programming techniques as part of a larger study.

    I was once in a moderately prestigious science undergrad program. There were no programming classes as part of the curriculum. And no, this wasn't an oversight on the part of the people who designed the program. Because this was a computer science program.

    (Full disclosure: I didn't make it through. Had to admit that in case any of the profs who flunked me out read this.)

    That's not uncommon. MIT probably rates as the leading computer science school in the country, maybe the world. I don't know much about their program as a whole, but I do know their key freshman course [mit.edu] spends almost no time describing any programming language. Of course, it helps that they do all their actually programs in Scheme [wikipedia.org], a language whose syntax you can write on the back of an envelope.

    Which is not to say that Scheme is a trivial language. Quite the contrary. But I doubt that anybody who makes it through SICP puts "Scheme" on their resume. No, they talk about their newfound knowledge of algorithmics and data structures.

    If you want to make your students skilled scientific programmers, don't make them take programming classes. Create physics classes where programming is a key element. Programming is just a tool, and do you have a class for every tool your budding physicists might use?
  • by CyberLife (63954) on Thursday May 29, 2008 @11:10PM (#23595655)
    I'm a programmer that worked in the software industry professionally for a good 13-years or so before switching to science. I personally find that I'm always writing little scripts and other programs to carry out all manner of tasks. Everything from gathering data to organizing it, analyzing it, charting it, reporting it, sharing it ... you name it I do it. Now I cannot say whether this is a truly necessary function or whether it's due to my background. I am, if you will, a biased sample. It is a valuable skill, nonetheless. It saves a tremendous amount of time.
  • I'm with you (Score:3, Informative)

    by Goldsmith (561202) on Friday May 30, 2008 @01:08PM (#23601697)
    As a physicist, I agree that programming is absolutely necessary to an undergraduate degree. Most of the institutions I've been at have included programming with the mathematical methods courses (usually using Mathematica, and making "real" programs, not just one line math). This has been by far the most effective tool for getting the "masses" of physics students to learn some programming. I have used this mathematica toolset [mathematicahandbook.com] and really liked it.


    I have also had programming (not math methods) classes in Java and IDL from a physics department. While I enjoyed them, most of the students who did not have prior programming experience found those classes difficult and uninteresting. Most physics students aren't interested in learning the details of why or how a programming language works, simply what they can do with it. The students who had taken a math methods/programming course found "regular" programming courses much more useful.


    I've also had (and taught) classes with LabView. While theorists find LabView totally useless, it is by far the most common programming tool used in experimental labs. You can learn structure and flow with labview, but it's not a very useful learning "language". However, it can (and should!) be taught in advanced lab classes to make things like temperature controllers, timed electronic measurements, instrument control etc. The people who say experimentalists don't need to program are dead wrong. If you can't rig up a simple temperature controller, basic e-beam writing system or digital oscilloscope in software, you're going to be wasting money on hardware you didn't need to buy.


    I've had to teach lab classes where the students were forced to present the data in Excel, and that was bad enough. Good luck finding a graduate student in a physics department who's willing to teach VBA and Excel well enough to do anything useful. Use of Excel as a programming platform is not as common as your peers think. I would try very hard to get them to move to something like Origin or Igor, which are much more powerful, produce better graphs and actually ubiquitous.

Parts that positively cannot be assembled in improper order will be.

Working...