Lost in translation March 18, 2013Posted by mareserinitatis in computers, research.
Tags: fortran, matlab, programming
add a comment
I took my first class in Fortran in the fall semester of 1992, while I was still in high school. I was taking some classes at the university as an early entry student, and the teacher of the course was a grad student. He was trying to explain something and kept getting the syntax wrong. I was getting horribly frustrated, as were the rest of us. He probably noticed as his response was to say, “I know three operating systems, which means I’ve become completely useless in all of them.”
I didn’t understand how he could confuse things like that as I was taking German and Spanish simultaneously and never seemed to have a problem with mixing things. I had no idea how different it was to learn spoken language versus coding language. That was before I’d learned to use a handful of programming languages and started using matlab commands in my fortran code. Debugging is even more of a pain because it looks right…and it is, but for another language.
The calm before the storm November 25, 2012Posted by mareserinitatis in computers, engineering, teaching.
Tags: office hours, programming, students, teaching
add a comment
I teach on Tuesdays and Thursdays. This past week was Thanksgiving, so I obviously had a bit of a dilemma. I don’t like getting the classes out of synch because that means I have two different preps to complete. The obvious solution, therefore, is to just cancel class during the week of Thanksgiving, and that is exactly what I did.
However, I’ve changed one of the assignments in the class from optional to required. You may remember that last year, I talked about Engineers Who Don’t Like to Program. I discovered that the majority of my students would rather do a presentation than learn how to program. I decided this year to change that. Instead of having two optional programming assignments, I moved some things around so that there is one assignment, very scaled back from what I had expected last year, and it was required to pass the class.
I had a lot of intimidated students, but I think cutting the length back significantly made them less afraid. I chose to have two weeks in the computer lab to work on the assignment. They ended up being the week before Thanksgiving and the week after. In the meantime, I decided to add an extra office hour during one of the cancelled classes so that students could come and ask me questions.
Not surprisingly, no one showed up. I’ll have to remind them of this when I have an flurry of requests from students needing extra help right before the assignment is due.
thinking work June 10, 2012Posted by mareserinitatis in grad school, research, solar physics.
Tags: grad school, productivity, programming, solar physics
add a comment
I have to give a presentation next week and older son took off for the summer, so between getting slides together and getting stuff and people shuttled to the airport, it was a rather busy weekend. There was some code I wanted to work on but didn’t have the chance.
It’s funny, though, because I was still thinking about it, and I actually think I made good progress on a plan of action. I realized I had three options: fix it, rewrite it, or throw my hands up in despair and give up. (Okay…last one is very low on the list of possibilities, but I can’t say it’s non-existent…there have been days.) I’m not sure I can fix it, but I have an idea of how to go about doing it. It’s a piece of code without commenting, but I know what it’s supposed to do, and I have an awesome ‘cookbook’ of numerical algorithms that explains it. (Need a spline written in a jiffy….I’m your woman!) I also suspect that in the process of trying to fix it, I’ll figure out a way to rewrite it a bit more efficiently, likely with less effort than fixing it will take. And I planned out how I can verify everything, as well.
While I didn’t have much time to work on it directly, I got my resources together and know what I’m going to do so I can hit it first thing after work tomorrow. I wonder if I made more progress by spending my ‘off’ time thinking about it than if I’d just dived in. I guess I should know in a couple days. But it’s funny how stepping away from something and letting your mind idle on it can result in something worthwhile.
I have converted January 9, 2012Posted by mareserinitatis in computers, research, science, solar physics.
Tags: igloo, matlab, programming, scilab
Because of the vagaries of my status at UMN (that is, I am an enrolled student, but I don’t pay tuition and therefore do not get some of the perks), I found out that I could no longer get access to Matlab. This is a bummer because, well, I need it for my thesis.
I’m trying to prove out some code and it’s easier to see what’s going on in Matlab because of the plotting functions. The idea is that I would like to write it up in there, see what’s going on, and then translate it to the dreaded Fortran.
Alas, I guess I’m having to break up with Matlab. Instead, I’m learning Scilab. I find this somewhat funny given how I was explaining to my engineering students last semester that once you know a computer language, it’s often easier to learn another. (Sadly, most chose not to learn a first one.) This is doubly so moving from Matlab to Scilab (or, I imagine, the reverse order) because they are so similar.
I like Scilab because it seems to me like a cleaned up version of Matlab. I don’t consider myself a master in the art of Matlab Kung Fu, but I’m passable. I have written a small program to solve the Boltzmann equation in the presence of an electromagnetic field and later solved the intractable igloo problem. However, there are some of the subtleties of matrix operations in Matlab which have always proved problematic for me, mostly dealing with conditional statements to indicate matrix indices, leaving me to fall back on loops. Not efficient, but it works. So far, it appears that these operations are more straightforward in Scilab. I also like the use of the % to indicate prenamed variables. I am all too guilty of using i as a counter and then being frustrated because it wouldn’t work as an imaginary value later in the program. And of course, I really like the price tag.
I haven’t yet gotten to some of the plotting I need, however, and as I understand it, that is where Matlab excels. We shall see.
Have you used both programs? If so, how do you think they compare?
Forgetting how to be inexperienced November 8, 2011Posted by mareserinitatis in computers, engineering, teaching.
Tags: matlab, programming, teaching
I learned to program when I was 9. My grandmother gave us an old TI-35 console that hooked up to a TV and a tape deck to record the programs. (Yes, as in cassette tapes…) She failed to get any games or other programs to run, so in order to get anything useful out of it, I had to learn to program.
It was a huge disappointment for me: I’d really wanted an Apple IIc so I could play Oregon trail on the phosphorescent green screen like I did at school. On the other than, with 25+ years of knowledge and experience, I think it was the best gift I could’ve ever gotten. I can make a living programming…but I can’t playing Oregon Trail.
My goal this week was to pass on some of that appreciation of programming to my students. (I guess I can almost say next generation since my own son is just a couple years behind my students. That’s sad.) My informal polling in class has made me realize that only about a quarter of my students have ever programmed in any language ever.
I could have understood this when I was in college…not everyone had access to computers. It seems like the ubiquity of computers doesn’t necessarily mean one will necessarily have experience using them other than at an apps level.
So I decided they should probably get at least a cursory knowledge of a useful programming language. Matlab seemed like a good choice because I know several of the upper-level classes use it. And let’s face it…once you learn to program in one language, it’s easier to go to another.
I found an excellent tutorial. I liked it because it went through things in a fairly basic manor, which I was sure my students could understand. It also had exercises.
Unfortunately, my mistake was thinking my students would be able to read, do the examples, and get a decent understanding of how matlab worked. That’s more or less how I learned it.
Of course…I had already learned other languages when I decided I should learn Matlab. (It wasn’t around when I was 9, you see…)
I was very surprised to find that the most difficult concept for the students to get was how to write an m-file. That is, they didn’t understand that you could write a series of commands in the file and then execute the whole file simply by typing the m-file name in the command window. They wanted to print out the command window or copy and paste their results into the m-file from the command window.
I have to admit that I was impressed with their creativity…but confounded by all the strange things they were attempting.
Finally, I went through a five-minute explanation of the differences between the command window and an m-file, and how the two work. That seemed to clarify what needed to be done for many of the students. When I took this approach with my second class, they seemed very calm and significantly less frustrated than the first class.
I really hoped this would be a positive introduction to programming for the students, but I can tell I’ve managed to make it frustrating for one group. I guess it’s really hard to put myself in their place and figure out where they’re going to have problems. It’s only when I throw some of them in and see how they react that I can change my approach to fit their needs.
Teaching any class for the first time is a frustrating experience.
Bad encounters with programming guides May 5, 2011Posted by mareserinitatis in computers, engineering, research, science.
Tags: commenting, programming
Like almost everyone who has experience writing code, I’ve been guilty of doing a crappy commenting job. I write a piece of code and go back months or years later to realize that I have NO idea what I did and nor does anyone else. Thus, I am now at the opposite end of the spectrum. There’s a loop of some sort, there’s a comment explaining what it does. If there’s an equation I’m solving, the equation is in my comments. If I pulled material, such as an algorithm from a book, information on the book, including the page numbers involved, are added to my code.
As you may guess, I now hold everyone to those standards…and their code almost never holds up. However, there are different levels of crappy code. Specifically, there are three of them.
The least offensive level of crappy code is that which is reasonably well-commented but has stupid variable names like Fred, Wilma, Betty, and Barney, i.e. names that have no bearing on what the variable actually does. I almost never see this.
The second level omits these useless variable names, choosing instead to use names that actually relate to their functions. However, comments are sparse, at best. If you have good familiarity with the algorithm, there’s a chance you might understand it…maybe. This is actually most of what I see.
The third and most egregiously awful level combines both of the worst aspects of the coding errors mentioned above: no commenting and nonsensical variable names. When you ask the person how other people are supposed to keep track of their code, you’re told you simply need to know how it works. I’m not normally a violent person, but it is infuriorating enough to make me want to throw my favorite software engineering text at them.
So please – if you’re writing code, please do an adequate job of coding AND use appropriate variable names. I’m too short on books to lose too many.
Fresh (programming) blood December 4, 2010Posted by mareserinitatis in education, poll.
Tags: computer, programming
For those of you who spend any amount of time programming, I have three questions. Please leave a response with your answer in the comments.
1 – What age were you when you first started programming?
2 – What caused you to learn to program?
3 – What was the first language you learned to program in? (I am fine if this language is visual, such as LabView. I’m looking for an ability to give a computer a sequential set of commands.)
I’ll probably write a follow up to this, but I am extremely curious.