MATLAB Answers

Daniel Shub
3

Bad homework problems

Asked by Daniel Shub
on 28 Sep 2011
What possess teachers to ask students to program something in MATLAB (or any language) and then tell them they cannot use certain functions? What is so wrong with using the built in functions for sorting and summing? What exactly are the teachers trying to teach? Most importantly, how can we answer these types of question so that the teachers learn not to ask them?

  1 Comment

Jan
on 28 Sep 2011
This has become an interesting discusion. +1

Sign in to comment.

7 Answers

Answer by John D'Errico
on 28 Sep 2011

There is absolutely nothing wrong with telling a student to write a sort routine as a homework problem. If you don't teach your students how algorithms work, then they will never learn to choose one algorithm over another. They need to understand the tools to know how to use them. And the best way to understand a tool is to write it yourself - ONCE.

  5 Comments

Jan
on 30 Sep 2011
+1: I have a different _opinion_, but your argument is comprehensible and correct. Everything, which can be learned about the quicksort *algorithm*, can be learned by writing it in Matlab.
In opposite to that, an efficient quicksort *implementation* must consider the runtime and stack size, e.g. by limiting the recursion depth. It is much easier to control this in a low-level language.
Therefore a professional programmer has to learn: "Do not implement quicksort in Matlab!" Later a frustrating large number of users will answer: "Why not, our professor told us to do so..."
I notice the notorious usage of CLEAR('all') -even inside functions!-, EVAL, ASSIGNIN and "save FileName". I see that a lot of students learn their algorithms and data structure lessons, but there is a limited education for using Matlab specifically. My Matlab lesson has been: "Matlab is slow because of the FOR loops and because everything complicated must be expressed by EVAL. Good luck."
Summary:
Good: Learn implementing fundamental algorithms by using Matlab.
Bad: Learn using Matlab by implementing fundamental algorithms.
Good points by Jan here.
I don't think it is good to lean how to implement fundamental algorithms by using MATLAB. The high level nature of the MATLAB language offers few benefits for such activities and can get in the way. Maybe it is not so bad if you are willing to write mex functions, but then I think students would be better just using C.
I also don't believe questions about sort functions and magic squares are generally from CS type classes, but tend to come from more general science and engineering classes where they are trying to teach students to use MATLAB.

Sign in to comment.


Answer by Walter Roberson
on 28 Sep 2011

Who expects that sorting and summing would be understood by the time MATLAB is started? It might be the case in some establishments, but it is not the case in other establishments. I have seen more than one student indicate that in their degree, using MATLAB was their first programming course; those were primarily engineering students, as I recall.
If people already understood sorting and summing by the time they started using MATLAB, we would not have so many students encountering basic difficulties in implementing these things. We can pontificate that the students "should" already have dealt with such matters in previous courses, but it is clear from the questions that we get that many many students have not had that previous instruction. I don't recall any students yet indicating that they had taken sorts in a previous course but hadn't understood them in that course. It is not our place to tell universities how to run their degree programs. We can grumble, and we can individually choose not to respond, but solving the problems of educational systems in other countries is beyond the influence of anyone I have seen post here.
In some countries, especially those with many more people than available jobs, it is policy in the upper-echelon universities to "throw students off of the deep end" -- to deliberately push students beyond "reasonable" limits and without "reasonable" background, with some courses designed to fail most students. This selects for the "cream" of the students, the ones who do not give in to pressure, who get the tasks done and on time (whether through technical ability or by "learning how to work the system", such as learning who to bribe, or how to cheat without getting caught.) The system is somewhat similar to that used for medical students in Canada and the USA, with their very strenuous "residencies", which at least has the excuse of selecting students who will be able to work through hardships disasters.
I know of at least one well-known US university that uses (or used) this kind of technique for Computer Science, with the first and second year courses explicitly designed to impersonally weed large classes down to much much smaller numbers, with the real teaching reserved for third and fourth year students. (But even that university was no-where near as harsh as what I observe in some countries.)
Yes, "Each problem/class/unit will have a set of aims and objectives". Unfortunately a lot of the time, the instructor fails to make those aims and objectives clear... or even to mention them at all. I know someone who has been researching these issues, and who teaches workshops to university classes to make students aware of these issues, to help the student recognize the need for clarifications and to "negotiate" with the instructor about the requirements. This person spends part of their time operating a research help desk at a university; they have indicated to me that first and second year students almost never have any idea what the purposes of any given assignment are, and that third year students are usually fairly weak in this area, with it being uncommon (but not unknown) for anyone below masters level to ask a "good" question.
It could be that perhaps the "best" question I asked in university was "Why is learning COBOL mandatory for first term computer students? Since the first language they learn is going to provide the foundation for all future learning, why would you want to weigh them down with so many decades of bad programming?". (Unfortunately, the answer was "So that they can get summer jobs with industry.")

  1 Comment

I have made very similar and terrible observations about "design to fail", "weeding out", etc. One theorry I have is, that there may be a connection between how the studies are paid. If the tax payers finance the system, there might be a lower motivation to treat students as customers, compared to systems where the students directly pay for their education.
Certainly, there are good reasons to avoid only kids of wealthy parents can study. It is actually a pitty that in some coutries like currently Germany, some aspects of the US system are implemented (like student fees), but on the other hand large scale scholarship programs are not implemented.

Sign in to comment.


Answer by Fangjun Jiang on 28 Sep 2011

I think the professor has a good intention and a good point. I would not want grade school math teacher to teach my kids to use the calculator, before teaching them about multiplication and division.

  8 Comments

Many of the clay tablets were only preserved by accident! http://en.wikipedia.org/wiki/Clay_tablet
Absolutely, it is indeed amazing what archaeologists have managed to puzzle together from bits and pieces, that appeared to have passed something corresponding to a paper shredder!
Jan
on 30 Sep 2011
I'm going to plug some clay in my DVD burner and see, if I can create a long-term backup for thousands of years. What a great combination of the technologies of different ages!
I picture the commercials: "Floppy disk -> Zip -> CD -> DVD -> BD -> CoC (Clumb of Clay)... the evolution cannot be stopped".

Sign in to comment.


Answer by Oleg Komarov on 28 Sep 2011

I think that the instructor asks to accomplish a task but leaves the student the choice of the language to use.
However, if the instructor asks the student to implement e.g. a sorting algorithm, MATLAB will impede the student from learning the concept if the sort function is used. Thus, the need for the limitations.

  1 Comment

Isn't this the difference between teaching semantics and syntax? If you are trying to teach syntax, then you can't leave the choice of language open. If you are trying to teach semantics, I am not even sure you need a language (and it definitely isn't going to be MATLAB).

Sign in to comment.


Answer by UJJWAL
on 28 Sep 2011

Hey Come on
It is correct that you need to know the internal multiplication and division . But by the time you start using MATLAB, it is expected that you have an idea of sorting and summing so that you do not need to take a course in them.
Moreover MATLAB is built for analysis and not for hardcore C/C++ type programming. though both of them are programming languages but still, the purposes are very different and hence it is bullshit to place such restrictions.
There are a whole lot of MATRIX Computations that the teachers can teach a student , like efficient ways to store matrices and manipulate them etc.. But This kind of attitude taken by teachers destroys one's perspective of using MATLAB properly and instead of enjoying it , people start looking upon it as a painful programming language

  2 Comments

Assume all students have other programming language background or skills and this is a class teaching MATLAB programming, it is still valuable to teach from the basics, such as using for-loop to do the summation. It's a homework assignment. Do whatever it's required to do!
How is MATLAB really different from a C/C++ implementation that includes a math library (and therefore a sort function)? I'll tell you how: 1. the syntax is generally simpler, and 2. the interpreter allows you to try your algorithm without compiling. Maybe the exercise should require the students to program in MATLAB and C/C++ to show them how much LESS painful MATLAB is!

Sign in to comment.


Answer by Malcolm Lidierth on 28 Sep 2011

Each problem/class/unit will have a set of aims and objectives. Those will be tailored to the audience, as will the choice of programming language. Most students do not list the objectives for the problem on these posts. If they did, the instructor's logic would, hopefully, be apparent.
My first serious programming as a student was done on a DEC PDP11/34 minicomputer. It had FORTRAN and MACRO-11 assembler available and 32 kB of memory. Everything had to be coded from scratch. That experience remains useful today. One advantage was that it was ~7kW and fan-cooled - ideal for drying laundry on a student budget.

  0 Comments

Sign in to comment.


Answer by Jan
on 28 Sep 2011

I do not like these homework questions also. The worst was CSSM: 20 Nov, 2010:
I'm supposed to write a code that will round any values to a specified
numeric placement, such as the tens, hundredths, etc.
...
3. At any point in this code you shouldn’t use any built-in functions
(such as: round, ceil, floor, fix, max, min, etc.).
4. You can ONLY use (length, size, relational operators {< > ~=},
logical operators {|, &}, if, for, while and switch).
Of course this was ridiculous, because the teacher had obvioulsy no deeper insight in MATLAB: E.g. FOR is useless without HORZCAT or COLON, which are both built-in operators...
Anhow, it is very easy to create a homework question for teaching standard algorithms by using elementary and MATLAB functions:
a) Do it by elementary functions
b) Do it with MATLAB's builtin/toolbox functions
c) Use TIC/TOC to compare the results
d) For advanced users: estimate the memory consumption
Then the pupils learn something about fundamental numerics and the about the usage of high level languages.
But as long, as the questions stay at a) only, I ignore the important and usually best strategy not to answer homework questions. I post working, but goofy solutions. I was enlightened by a an answer (I do not know the author anymore) to the question "Find max(x) without using MAX" => "-min(-x)".

  0 Comments

Sign in to comment.