Physics 210: Intro Computational Physics: Course News

This document will be updated throughout the course; entries are in reverse chronological order.

Friday Dec 4, 10:00 AM

Since this matter arose at the end of yesterday's presentations, and since the description on the main course page was previously ambiguous concerning this matter, please note that you must e-mail me an electronic version of your writeup when you have completed it (PDF preferred, but .doc or one of the OpenOffice formats will also be acceptable).

Please refer to the Friday Nov 20, 1:30 PM item below for additional information concerning the writeups, what to do with your source code etc.

Good luck with the remainder of your term work, and with your final exams!

Friday Nov 27, 10:00 AM

Here are a few more announcements concerning your term projects and my availability over the next few days:

  1. As some of you have already heard, I will be in my office over the weekend for at least part of the day, both days.  As I have also told some of you, I have another commitment that, unfortunately, must take precedence over everything else during this time.  That said, I should be able, from time to time, lend some assistance in cases where you are really stuck and could use some help.  I trust, however, you will understand if I have to minimize the length of time that we interact (including e-mails).  Additionally, if you are on campus, and would like to get into Hennings to use the computer lab, you can try phoning me at my office (604)-822-2412, and assuming that I'm in, I'll be happy to come down and let you in via the east-door.

  2. I realize that for many of you, the difference between having to present on Tuesday vs Thursday is significant in terms of how complete your project will be.  I will take this into account when evaluating the presentation portion of your project.  In other words, don't panic/despair etc. etc. should your project not be as finished as you would like it to be when you present.

  3. IMPORTANT!  Those of you who intend to inlcude animations in your presentations will need to take special care to ensure that all of the files needed for your talk get to me in a timely fashion, and in a form that I can handle.

    So, for those of you who will be showing one or more animations, please note and abide by the following

    1. I have created the directory /phys210/$(LOGNAME)/tp-pres on hyper for all students

    2. When you have finished preparing your presentation, upload ALL of the files that are needed (i.e. the .ppt or .pptx itself, as well as any animation files) to that directory on hyper. If you don't know how to do this from your Windows system, now is the time to install putty on your machine (see the course Software page), and learn how to use scp from the command prompt window.

    3. Once that is done, send me an e-mail message so that I can retrieve your files, install them on my laptop, and ensure that everything is in working order.

    4. It is particularly important in this case that you bring a copy of your presentation on a USB stick, and, if possible that you show up in the lab early (I suggest no later than 1:40 PM) so that we can deal with any glitches that may arise. If you don't have a USB stick, now is a good time to get one!

Thursday Nov 26, 11:00 AM

Kasun has kindly reported that the xfpp3d was not drawing particles with different sizes per my claim in the demonstration last Tuesday, as well as the help message returned by xfpp3d -h.

I believe that I have now fixed this, and have updated xfpp3d on hyper.  Those of you who have downloaded and installed xfpp3d on your machines will need to redownload and reinstall should you wish to take advantage of the feature.

Also note that contrary to what I claimed during the demo, the particle sizes that are read are not rescaled by the minimum size in the set, nor is the displayed particle size roughly logarithmic in the size that is read.  Rather, the sizes read are used in an absolute sense, although you can still rescale them once the application has started using the Particle size slider.  Thus, for example, sizes of 0.1, 1.0 and 10.0 will result in particles drawn with one tenth the default size, the default size and 10 times the default size, respectively.

Finally, note that I have added two additional command line options to the program, -s which renders the particles as solid spheres, and -w which renders them as wireframe spheres.  However, since use of either of these will only result in further sluggishness of xfpp3d when running on the computer lab terminals, you will probably not want to use them unless you are running on your own system.

Wednesday Nov 25, 10:00 AM

Please note the following items:
  1. The dates and speaking order for your final term project presentations, along with brief guidelines and instructions are available HERE. Please e-mail me if you detect any mistakes in the speaking order etc. Please refer to the News item from Friday Nov 20, for additional information concerning the deadlines for the final report, as well as details concerning precisely what must be submitted for your term project to be considered complete. 

  2. From now until the end of classes (i.e. Friday Dec 4), I will be in the office most of the day, all days, and you are welcome to drop in to get help with  your term projects.  You can also continue to send me e-mails as well, but it is generally more efficient and effective to discuss these things in person, so I would prefer that we adopt that approach if at all possible.

  3. I've updated the course Software page with a few additional details re the installation of the visualization utilities I demoed in yesterday's lab. Again, feel free to contact me should you need any help installing something on your personal machines.

Monday Nov 23, 5:30 PM

Usage information concerning the following visualization tools that may be useful for your term projects is now available via the course Resources Page:
  • xfpp3d (useful to those doing N-body work, including charges on a sphere, Toomre problem, etc.)
  • xflat2d and xflat2d_rgb (useful to those doing cellular automata calculations)
  • xvs (advanced!) (useful to those solving PDEs in one space and one time dimension)
  • DV (advanced!) (useful to those solving PDEs in more than one space dimension, as well as N-body problems with N very large)
All of the above are installed on hyper, and should execute as regular commands for you provided that ~phys210/bin is in your path (as it should be). We will briefly demo some of these tools in tomorrow's lab, and you can contact me for additional help with their use as necessary.

Additionally, information concerning the installation of these programs on your own Linux / MAC systems is available via the course Software Page.  Please note that if you encounter any difficulties installing these on your own systems you should feel free (absolutely, totally free!) to contact me immediately about the matter, and I will do my best to help you get things going.

Friday Nov 20, 1:30 PM


As announced in yesterday's class, the lecture component of 210 is now concluded. Thus, next week do not go to Buchanan at 2:00 PM, but instead head directly to the computer lab where you can devote your full attention to your term projects.

Unless you feel very confident that you have your project under control, and that you do not require any assistance in order to complete it in a timely fashion, I urge you to take full advantage of the six scheduled hours we will have in the lab next week to get help as necessary with this crucial component of the course.

Over the weekend, I will put information online about the available visualization utilities that I have mentioned previously, as well as some guidelines for those of you who wish to install one or more of them on your own machines. You will also be able to get help using these utilities during the lab sessions.



  • Recall that the presentation order will be precisely the reverse of that used for the proposal presentations: i.e. we will start/finish with Henry/Sen on Tue Dec 1 and with Andy/Masoud on Thu Dec 3.

  • I would ask that there be no swapping of speaking order, as was allowed previously, unless it is absolutely necessary (e.g. you are ill)

  • Your presentations can be largely modelled on what you previously prepared for the Oct sessions. Thus referring to the instructions available HERE, simply replace

    • Project Timeline

    • Results
    • Conclusions

    The first 5 items in the outline can remain as is.

    Note, however, that you do not have to adhere to the suggested structure in slavish detail: if you wish to organize your presentation in some other manner that you feel more appropriate, you are free to do so.

  • We will need to keep to the 10 minutes total-time-per-talk schedule as closely as possible, so plan for a 7 minute presentation leaving 3 minutes for questions and a transition to the next speaker. Be sure that you PRACTICE. giving your talk, and time it to ensure that you CAN deliver it in the allotted time.

  • All presentations must be e-mailed to me, as an attachment, no later that 10:00 AM on the day that you are presenting. As was the case for your proposal presentation you should also ensure that a copy of your final presentation is available via your web page, and that, if possible, you come to the session with a copy on a USB stick.

  • Keep in mind that the final presentation is worth a maximum of 5% of the course grade.


  • Guidelines for your writeups are given on the main course page (scroll down to the "Term Projects" section). You will observe that I suggest a length of 10-20 pages, double spaced, including title page, figures and graphs, and references. 10 pages should be treated as the bare minimum, since 10 pages of double spaced copy with headings etc. won't allow you to describe very much. Conversely, you will NOT be penalized should your writeup exceed 20 pages!

  • I would ask that any of you who are interested in using LaTeX for their writeup, and who need some pointers as to how to go about doing that, contact me directly---if there is no demand, then I won't bother supplying the information.

  • I do NOT normally return project writeups. Once the term is done, you are welcome to ask me for feedback on the project, and if you want such feedback, I will ask that we meet in person for that purpose.


  • IMPORTANT! The writeup is by no means the only thing that I will be using in evaluating your project; i.e. in deciding how much of the available 35% of the course grade you receive for your effort.
  • You will all be writing code for your projects, and this code MUST be available to me on hyper, and MUST execute correctly (i.e. as you intend it to!) on that machine.
  • In particular, I have created the directory /phys210/$LOGNAME/tp for each of you on hyper. As part of your final submission, this directory must contain the following
    1. All of the source code that you wrote for your project.
    2. Any additional code or packages that you did not personally write, but which is needed for your code to execute.
    3. IMPORTANT! A README file that gives brief but complete instructions that will enable me to run your code for a typical case that was used to generate results described in your write up.

  • Your tp directory may also contain other files, such as data files, plots etc.


  • The official and highly recommended deadline for submission of your final project, which includes

    1. An electronic version of your writeup, e-mailed to me,
    2. All of your source code for your project, installed and operational in /phys210/$LOGNAME/tp as described above,

    is Friday Dec 4, 11:59 PM.

  • If you will not be able to make that deadline, you must inform me via e-mail of that fact as soon as possible, and request an extension.

  • Submissions after Wednesday Dec 9, 11:59 will NOT be accepted, barring sickness or an equivalent official excuse. I will leaving be Vancouver Saturday Dec 12, will have to have submitted final grades for the course by that time, and need at least two days to evaluate late projects and get the grades in.
  • Depending on the circumstances, late projects may result in a grade penalty.

Let me know immediately if you have any questions or concerns about the above information/instructions.

Friday Nov 6, 8:00 PM

1) Solutions for yesterday's lab activities are available on hyper:
2) As mentioned in yesterday's class, the third homework is being morphed into Homework 3 AND Homework 4:

i) The new---and final---version of HW 3 consists of the first three questions of the previous version.  We have now covered in class all of the background material necessary for you to complete it.

THE DUE DATE FOR THE HOMEWORK HAS BEEN EXTENDED TO FRIDAY, NOV 13, 11:59 PM, which I would ask you to treat as pretty firm, given how late in term it will be by that point, and especially given that you need time to work on your term projects.

ii) Homework 4 consists of a single question, namely the solution of the wave equation, which was previously Problem 4 of Homework 3.  We should be done with the background material for that question early in next Thu's lecture, or possibly even next Tue.

THE DUE DATE FOR HW 4 IS WEDNESDAY, NOV 18, 11:59 PM.  Once, more please take that date seriously so that you will then be able to devote your full attention (outside of lectures) to your term projects.

The homework page has been updated with the final version of HW 3 and the new HW 4 is available there as well.  I will distribute hardcopy for H4 on Tuesday, but will not give you new printouts for HW 3, since nothing has changed for problems 1 through 3.

3) I should have mentioned this previously, and have done so explicitly in the preamble for HW 4:

You are free to use code that I have written to solve other problems as templates for your implementations of functions in the two
homeworks.  However, whenever you "recycle" a program in a substantial way, then, following usual academic protocol, you should acknowledge that fact in a comment near the top of the source file.  For example
   % This code is based in part on foo.m written by M.W. Choptuik
4) All Faculty of Science Instructors have been asked to pass along the following information to you concerning what you should do should you come down with the flu (apparently any variety of the flu).  You should already have received a "communique" from UBC concerning this matter, but I'm just dutifully following instructions here!

Instead of coming to class, your students should use the new tool on the Student Service Centre to inform the university that they are isolating themselves because of the flu and will not be attending class until they are well. We understand that a communique providing  more details will be sent to students by early in the week of Oct. 26th.

Remind your students that they do not need a note from their doctors and, in fact, they should not try to get one.  On the other hand, they should report through the SSC if they wish consideration for missed labs, assignment deadlines and exams. Reporting will also help the university estimate the scale of the issue and determine what further steps might be needed to manage the situation.

The purpose of the on-line reporting system is to help students, not to penalize them. With one action, they will notify all their instructors of their absence. Remind students that when they are ready to return to school they first report back in on the SSC and then communicate directly with you in a timely manner.

I am also to provide you with following information

Communicate your policy for late or missed assignments,  labs, quizzes, and exams.

POLICY:  If you are unable to complete work by its due date because of illness of any kind, you will not be penalized.  To the extent that it is possible, you will requested to submit the work as soon as is feasible, once you are better.  If your sickness is prolonged, and completion of the missed work will pose real hardship for you, the missed work will not factor into your grade for the course.

This policy applies to your project presentations and projects themselves, as well as to the remaining two homeworks.

Let your students know what materials you (or your replacement) will be making available on the web to help them keep up while they are absent or how they will be able to catch up when they return.  Post this information on your course website or make it known to students in other ways.

POLICY: Lab activities will continue to available on-line, and if you miss one or more classes, and are unable to get notes from a fellow student, you can e-mail me and I will forward you a copy of my own notes.
If I cannot lecture due to illness, my "buddy" Prof Joerg Rottler will be assuming my lecturing and lab supervisory responsibilities for the course.

As usual, let me know should you have any questions concerning these points.

Tuesday Nov 3, 1:30 PM

I've analyzed your second attempt at generating length-10 sequences of 1's, 2's and 3's. 

Here's a table that summarizes the results of the 2 experiments

Mean Value
Student Experiment 1
Octave Pseudo-Random 1
Student Experiment 2
Octave Pseudo-Random 2


# of sequences analyzed  

Mean Value: Overall average value of numbers generated.

1, 2, ... 10: Number of sub-sequences consisting of  1, 2, ..., 10 consecutive 1's, 2's or 3's.

As you can see, there was a definite improvement in "randomness" in the second attempt: however, there was, in fact, an "overcompensation" in terms of inclusion of sub-sequences of identical consecutive digits with length > 2.

In order to get an estimate of the likelihood that the distribution produced in the second student experiment was truly generated at random, I ran 100,000 trials of "Octave Pseudo-Random 2" and from the analysis of the data found the following

1: 88
2: 16
3: 14
4: 3
5: 3

where the numbers in the second row are the % of trials that produced the specific number of length-n sub-sequences generated in the second student experiment.  In particular, you will note that the value of 88 for n=1 is quite improbable.  Here's the same analysis for the first experiment:

1: 136
2: 27
3: 0
4: 0
5: 0
6: 0
7: 0
8: 0

All told, though, it is impressive how much better the class did the second time through, including the elimination of the previous biasing of 1's vs 3's!! (i.e. the mean value was precisely 2)!

Wednesday, Oct 28, 11:45 PM

The full handout for Homework 3 is now available HERE as well as via the course Homework Page.  I will distribute hardcopy in tomorrow's lecture.

Tuesday Oct 12, 7:00 PM

There were two other bugs/typos with the second homework handout, this time in Problem 5.

The output from calc for the third-to-last and second-to-last sample invocations should be as follows:
% calc 'sin(0.2)^3' 30

% calc 'exp(3.2*cos(0.6))/5!' 50
Again, I have updated the online version of the homework, available HERE to reflect this change, and with luck that will be it for the typos! Thanks to Steven for identifying today's bugs, and Lewis for yesterday's, and, again, my apologies for any inconvenience these various bugs/typos have caused.

Monday Oct 11, 12:00 Noon

One of you has decected another bug/typo in the second homework handout, this time in Problem 4. 

In the fourth example of kinematics, namely kinematic(Time->tanh(Time), T, 0, 0, 0, 4); the x axis should be labelled T (not Time), and the caption for the acceleration plot should read tanh(T), (not tanh(Time)).  That is, the plots should always be labelled with the second argument passed to kinematics. I've updated the online version of the homework handout (available HERE), to reflect this change, and apologize for any inconvenience that this may have caused you.

Saturday October 10, 2:00 PM

Please make careful note of the following:
  1. As I've mentioned in a previous e-mail message (Sep 19), although the Hennings building is locked on weekends (including this Monday), and weekdays from about 6 PM through 7 AM, the computer lab is open 24/7, so if you can get into the building, you should be able to get into the lab. In that regard, please note that I will be in my office over the weekend as follows

    1. Today:  Until 5 PM at least
    2. Tomorrow:  From about 10 AM until about 2 PM
    3. Monday:  From about 10 AM until about 5 PM

    so, provided that you can give me a bit of advanced notice via e-mail (best to get an e-mail confirmation from me), if you want to get into the building during the above hours, you can call my office (604-822-2412), either using your cell, assuming you have one, or from the public phones in SUB, and I'll be happy to come down and let you in.

  2. The due date for the second homework has been revised to Wednesday October 14, 11:59 PM. This will give you a chance to get additional help during next Tuesday's lab, and also reflects that fact that due to midterms, you have more than the usual load of work to do! The online version of the homework (available HERE) has been revised to reflect this change.

  3. I'm pleased to report that the number of e-mail messages that I have received about term projects is now a small positive integer, so keep those messages coming!!

  4. The presentation order for your term projects (randomly generated, as promised) is now available HERE.  That page also gives the instructions/rules concerning how your proposal presentations are to be prepared and sent to me, so be sure to let me know immediately should you have any questions about the procedure.

    If you wish to try to swap your spot in the schedule with a fellow student, you are free to do so, provided that both parties agree to the swap.  This also applies to sets of more than 2 students: e.g. 3 of you can rearrange your times, provided there is mutual consent among all 3 of you, etc.  Please inform me via e-mail of any such swaps, and it would be best if I get e-mail from all involved parties to reassure me that nothing fishy is going on!

    Recall that the order for the final presentations (December 1 and 3), will be the exact opposite order of that for the proposal presentations.
Again, be sure to contact me should you have any questions about these matters.

Tuesday October 6, 8:00 PM

Just to follow up on today's rather intensive lecture/lab combo:
  • Full details concerning today's lab activities are available via the Syllabus section of the main Course Page, or directly HERE.
  • For the plotting examples that we covered in the lab, the actual worksheet as well as a printout of the worksheet in PDF form are available in the Lecture 4 section of the Maple Notes page HERE.
  • All of the procedures (fully commented), with script files that put them through their paces, and a README describing how to use the procedures/script files are available in the world-readable directory ~phys210/maplepgm on hyper.

    Note that among the procedure files is pwrsfilein, which in today's lab notes was left as an exercise for the interested, and which iilustrates how data from a text file can be input into Maple using the fscanf command.  There is also an associated driver/testing script file, tpwrsfilein, which should be read into Maple after the file output has been created by tpwrsfile.
As always, let me know should you have any questions about the material that was covered today.

Tuesday October 6, 10:45 AM

My regular office hour tomorrow (1:00 - 2:00 PM) is cancelled due to an unavoidable commitment.

Monday October 5, 2:30 PM

There was a serious typo in Problem 3.3 of the second homework handout.  The string which is passed to the error routine (see below for an additional note on error), like all Maple strings, should be enclosed in double quotes ("), not single quotes (').

In addition, as mentioned in the last lecture, the recommended way to print an error message and return from a Maple procedure is to use the error command. In older versions of Maple, one used ERROR (recall that Maple is case-sensitive), and although ERROR still works in Maple 12, I have updated the current homework so that Problem 3.3 now reads:

   If l is the null list, lprod, should call error("argument is null list").

You will not be penalized for using ERROR rather than error, but you will find that a syntax error is reported if you enclose the error message in single quotes rather than double quotes.

A corrected version of the homework handout is available from the Homework Page, as well as directly from HERE.

Thursday September 17, 9:15 AM

A new version of the Unix/Linux notes has been posted on the Course Notes page.  I will distribute hard copy in today's lecture.

Monday September 14, 9:00 PM

The first homework assignment is now available for downloading from the Homework Page.  I will distribute hard copy in tomorrow's lecture.

Friday September 4, 11:00 AM

Greetings 210 students!  Our first lecture is Thursday September 10, in Buchanan B303 at 2:00 PM.  This will be followed by our first computer lab session in Hennings 205.  Looking forward to meeting all of you!   ... Your instructor, Matt Choptuik

Maintained by Supported by CIAR, NSERC, CFI, BCKDF and UBC