Questions about debugging techniques, using the built-in debugger, and/or the Wolfram Workbench debugger.

learn more… | top users | synonyms

40
votes
2answers
2k views

Mathematica Debuggability

One of the things that I really dislike about Mathematica is its lack of debuggability compared to many other programming languages. Some of the problems arises from the functional nature of ...
26
votes
1answer
444 views

which is better, using Assert[] or manual checks on arguments and other computations?

I never used Asserts in Mathematica, but trying to see what advantage they have over just argument check and additional definitions of the function to capture unwanted input. For example, which one ...
23
votes
2answers
2k views

Debugging memory leaks

I've written my incredibly complex, incredibly elegant analysis function, that works great on small test data. But when I run it on my real (bigger) data set it keeps running out of memory. It turns ...
20
votes
1answer
203 views

Why Trace[] shows some internal warnings on a standard Plot command in V9?

For fun, I like to use Trace with option TraceInternal->True to see if I figure how some of the commands work internally. I ...
19
votes
2answers
648 views

Is it possible to Print expressions in reverse order?

Let's say I'm debugging a program step by step and want to Print some expressions (using ShowIt, for example). Is there a way to output the result of ...
17
votes
5answers
2k views

Wolfram Workbench - Mathematica Development Alternatives

Are there any alternatives (IDE or other workflow) to Wolfram Workbench for development and debugging? Elaboration: An open source alternative.
17
votes
2answers
2k views

Debugging Mathematica Code

In various integrated development environments, such as Microsoft Visual Studio, there is an integrated debugger where you can step through code sections, examine the state of variables and figure out ...
16
votes
1answer
317 views

How does the built-in debugger decide what to highlight?

How does the built-in debugger decide which definition to highlight in the notebook when Break on messages" is enabled? Here's an example to illustrate what I mean. First, enable the debugger ...
15
votes
0answers
423 views

How can I trace a functional expression's evaluation visually?

Ok, so the goal is to visualize the execution of this expression foo /@ {3 + 1, bar /@ {1 + 2, {4 + 7}}} in the following fashion using nested rectangles with ...
13
votes
1answer
540 views

A debug utility to print or extract intermediate data from a program

Is there a way to print variables using their names, or to extract the corresponding information for later analysis ?
12
votes
2answers
617 views

Debugging with Breakpoints

re: Version 9. I typically write concise code and make a real effort to refactor. As such debugging has tended to take care of itself. Recently, I've needed to assemble applications of more ...
11
votes
1answer
181 views

Inspecting non-variable state from a breakpoint in Workbench

Suppose I'm stopped at a breakpoint in Workbench, say at one of the y = ... lines in: ...
10
votes
1answer
148 views

Is there a way to find out who is importing a package?

After calling some functions, if I look into $ContextPath, I can see that JLink` is in there. Is there a way to find out what ...
9
votes
0answers
88 views

How to capture implicit fails in Plot or Show? [duplicate]

How can I make a construct similar to C++ functions: try{} catch{} I want to use it to avoid showing a lot of errors in the plot area when for example one of the ...
7
votes
1answer
72 views

How can I get TracePrint to treat certain functions as atomic?

Consider the following example: ...
5
votes
3answers
154 views

Metaquestion: how to find out why (e.g.) MatchQ[42, _?Function[x, True]] is False?

Suppose you run into a bewildering Mathematica result (which happens to me several times per Mathematica session, even after a 20-year acquaintance), such as, for example: ...
5
votes
1answer
328 views

What is missing in this Mathematica Journal Article?

So I had been looking to solve a little tiling problem and Google turned up this Mathematica Journal Article and I noticed the code was both incomplete and incorrect, so... My Question is, What is ...
5
votes
1answer
199 views

How to find the name of the current function

I would like to know the name of the current function from within that function. For example, consider the following code ...
5
votes
3answers
849 views

Solution for equation system with piece-wise defined functions

As I could swear this worked just yesterday, I am probably just doing something stupid here and I am sorry to bother you :) I am trying to find the point where a curve crosses a line. In this case, ...
5
votes
1answer
100 views

How can I execute a sequence of statements interactively?

I'm fairly new to Mathematica. Suppose I have the following function: f[x_Integer] := Module[{y, z, r}, y = 5; z = 10; r = x + y + z; r ]; and I ...
5
votes
1answer
127 views

MUnit test debug breakpoints in Workbench not working

When I create a breakpoint in Workbench 2 for an MUnit test, and run a debug build, the breakpoints are not breaking execution. The MUnit output is updated like a normal run without breakpoints. Why ...
5
votes
1answer
592 views

Catching and debugging numerical errors in compiled functions

I have a compiled function (that was created using the second method of this question). Basically it's using a compiled closure. The problem is that for some parameter values it does not evaluate. ...
5
votes
1answer
126 views

how to print stack trace when TimeConstrained times out

According to the documentation, TimeConstrained generates an interrupt which interrupts the computation. This interrupt is treated just like an abort, at least in ...
5
votes
1answer
390 views

How to Debug Missing[NotAvailable] error for Social Media Data

I get a Missing[NotAvailable] error message when trying to access Social Media Data using SocialMediaData["Facebook", "Friends"] ...
5
votes
0answers
112 views

Is there a package or canonical way for writing test harnesses in Mathematica?

I've written a complicated function foo.1 I'd now like to simplify this function's code, and later enhance it with more features. With each change, however, I'd ...
4
votes
1answer
194 views

Help with Permutations

I am currently trying to generate a list of permutations of length 2 of elements of a list of strings. For example: ...
4
votes
0answers
135 views

Syntax error for optional pattern, but only in debugger

This expression (explained here by Leonid) evaluates fine unless Evaluation->Debugger is enabled: h[x : (_Integer) : 1] := x Syntax::sntxf: "x:" cannot be ...
3
votes
1answer
218 views

Debugging graphics

All the examples I am seeing on internet are related to normal functions that carry out loops and assignments but I have not seen one example where I can see a graphics based program being debugged. ...
3
votes
1answer
70 views

local logfiles for remote kernels

I'd like remote slave kernels to produce log files on my local machine, subject to the following constraints: 1) I don't want to install a distributed filesystem or do other administrative work on ...
3
votes
0answers
112 views

Dealing with errors and resuming the code after one

How can I write my Mathematica code so that it resumes at a specific place if any Message is displayed during the execution of an expression? For example, in Visual ...
2
votes
2answers
438 views

Unexpected result of summation

I wrote small module that gives me incorrect output-set, it should be a single number! I don't understand what went wrong. This is the form of summation used: $$\frac{1}{2} (b-a) \sum_{i=1}^n ...
2
votes
1answer
4k views

How do I identify the source of a “Tag times protected” error?

I have some code that looks like Table[ a = 1; b = {2, 3} c = i;, {i, 2} ] which gives an error: Set::write: Tag Times in c {2,3} is ...
2
votes
1answer
141 views

See Local Variable at breakpoint within MODULE?

Within the debugger, can we watch local variables within a Module? As the screenshot shows, the “i” only display its global value (12) upon a message breakpoint. Is there a way to show its local ...
2
votes
0answers
59 views

Find where an error occurred in a bunch of command line scripts

I have been using my intuition to solve errors in my Mathematica scripts. But when calculations got more complex and I started getting errors involving code in more participating scripts (a script ...
2
votes
0answers
103 views

Debuging in Mathematica [duplicate]

Description I have using Mathematica to solve all kinds of problems that encountered in my study. However, the function that I define to solve specific problem is not always right, in other words, it ...
1
vote
1answer
92 views

How to know at which point of a calculation I am while using Table

If I use a code of this type: Table[foo[i], {i, 0, 10}] Mathematica won't output anything until it is done: is it possible to know at which point of the ...
1
vote
2answers
350 views

How to debug error triggered by replacement rule?

The second line below produces the errors shown: ...
1
vote
1answer
77 views

Animated gif form parametric plot

I need to create an animated gif for the following function. ...
1
vote
1answer
79 views

Cannot step into code in Wolfram Workbench [closed]

I have written a set of functions in a .m file in Mathematica 9.0 using Workbench 2.0. When I right-click the .nb and click Debug as Mathematica, The .m file loads and successfully initializes. ...
1
vote
0answers
62 views
1
vote
0answers
44 views

Is it possible to pipe the output of EvaluationMonitor to Excel?

I have an EvaluationMonitor setup to capture the points processed by NIntegrate. This is a case where the same function, integrated over the same region in cartesian coordinates yields a dramatically ...
0
votes
1answer
386 views

(N)Solve does not solve equation

I am trying to calculate where a beam hits a mirror. The mirror is described by this curve (two facing spherical mirrors): ...
0
votes
0answers
43 views

can i reach a breakpoint when i press a button and call a function?

I have a function and inside it I put a breakpoint on the first instruction in the function I made a button who calls the function and when I press the button to call the function the breakpoint is ...
0
votes
0answers
9 views

Watching variables during Notebook work session [duplicate]

One feature that I have always wanted but could not find out if it was supported and that is to actively watch variables and their values while working in a Notebook session. In fact, there are two ...
0
votes
0answers
13 views

Encountering a Tag times Protected error, but cannot find the source [duplicate]

I am very new to using mathematica, and I have seen these errors frequently. Usually I can find a solution to my issues by stumbling around, but this is my first time defining a function like sp[t_], ...
0
votes
0answers
54 views
0
votes
0answers
39 views

Path must include /TypeSystemLoader.m?

I have encountered a number of odd issues using the Wolfram Workbench 3.0 Debugger. Whenever I try to step into a Switch[] statement, I get the following error message: "Problem Occurred - Debug ...
0
votes
0answers
54 views

What are ways to debug while Mathematica is running? [duplicate]

I would like to know if we can "watch some values" during running time of Mathematica. I remember that C and Pascal compiler ...
-1
votes
0answers
36 views

Watching recursion

I enter: Clear[f]; f[n_] = n f[n - 1]; f[1] And get the response: $RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> Now, I think what happens is ...
-2
votes
2answers
200 views

Mathematica not assigning variable correctly

So I have been fiddling with this the last hour and I just can't get it to work. I have 3 matrices of the same size which contain nothing but 0's in a list, I also have 3 matrices of the same size ...