Re: Re: my wish list for Mathematica next major version
- To: mathgroup at smc.vnet.net
- Subject: [mg60077] Re: [mg60064] Re: my wish list for Mathematica next major version
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 1 Sep 2005 02:13:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
It is interesting to hear what things bother students because that is important information. I'm not certain that a debugger is the best solution. Rather, I suspect that students have not learned well enough how to use Mathematica. Specifically they should learn that it is an interpreted language and not a low level, compiled language like C. There are certain prices to pay in having an interpreted language, but there are also certain benefits and easy development of routines and calculations is one of them. When users get into trouble they are often trying to do too much at once. I usually develop a calculation one step at a time and look at the output. It is not always what I was expecting. One can put a number of steps together in ONE cell, each step on a separate line. Then examine the output, make corrections and reevaluate. If I'm satisfied that certain steps are working correctly I suppress the intermediate output with a semicolon. When that works I usually construct a routine. If I have trouble with a routine, usually in the form of a Module, I insert Print statements to print a location and values of variables at that location. If I want to stop at a location I insert Print[...]; Abort[]. However, your posting roused me to further investigate the debugging facilities of Mathematica. I discovered there is something very close to the debugger that you want. It's called Dialog. It allows you to stop at a given point, look at the values of various variables, and continue on. Here is a simple example: foo[x_] := Module[{y, z}, y = x^2Mod[3, x]; z = Sin[y]; Dialog[DialogSymbols :> {xx = x, yy = y, zz = z, xmod = Mod[3, x]}]; y + z] Evaluating foo[5] 75 + Sin[75] opened a Dialog, but the result was not yet present. (This is just a horizontal line in the notebook where you can type commands. You could open a new blank notebook and type the commands there.) Then entering {xmod, xx, yy, zz} {3, 5, 75, Sin[75]} Entering Return exits the Dialog and completes the evaluation of foo[5], which appears after the foo[5] Input cell. If you have several debugging dialogs you can use the option DialogProlog :> Print["point1"] to print the location of the particular Dialog. So, why isn't that a fairly good debugger? David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: carlos at colorado.edu [mailto:carlos at colorado.edu] To: mathgroup at smc.vnet.net I fully agree with the first item. Each year I normally teach 3 engineering courses (2 graduate, 1 undergraduate) that use Mathematica as one of the tools for problem solving. Typical undergraduate enrollment: 80-100, graduate: 35-50, so it is not a tiny sample. By far the 3 biggest complaints heard year after year: 1) Incomprehensible and untraceable error messages. 2) Lack of a simple debugger. Doesnt have to be GUI or incremental. Anything is better than nothing. 3) Lack of effective interrupts. If user commands a stop, stop instantly, wherever you are in a cell, and tell user exactly where it did. These are largely beginner users, not difficult to please. For 1) they would be ecstatic with a low-tech device called a line number. In[] and Out[] baffle beginners since they are dynamic. Since they serve no useful purpose, as a teacher I would be very happy to see that 1980's anachronism removed, and replaced by invariant markers.
- Follow-Ups:
- Re: Re: Re: my wish list for Mathematica next major version
- From: Pratik Desai <pdesai1@umbc.edu>
- Re: Re: Re: my wish list for Mathematica next major version
- From: János <janos.lobb@yale.edu>
- Re: Re: Re: my wish list for Mathematica next major version