Questions tagged [debugging]

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

Filter by
Sorted by
Tagged with
3 votes
0 answers
72 views

JoinAcross Memory Leak

I believe JoinAcross may have a memory leak but would appreciate some help looking at it. It appears to be small when used just once but when iterated a lot it eventually crashes my wolframscripts. I'...
user avatar
  • 572
2 votes
0 answers
32 views

How can I see the invocation stack of functions together with their arguments after Interrupt?

I know that by pressing Alt+comma, I can interrupt a running task. This brings me to an interactive environment as if there would have been a command Interrupt[] (...
user avatar
0 votes
0 answers
54 views

How can I see, which function has stuck?

This code runs infinitely. How can I see which function exactly had stuck and potentially fix the code? ...
user avatar
  • 2,707
3 votes
1 answer
59 views

How to exit TraceDialog?

Nice question brought by my friend. myFunc[x_] := x + 1; TraceDialog[Map[myFunc, Range[100]], myFunc[___]] Assume you decide to interrupt after entering the dialog....
user avatar
4 votes
2 answers
286 views

How can I memoize the result of o[i] and at the same time force u to be incremented whenever o[i] is called?

I am working on the following code: ...
user avatar
  • 4,791
0 votes
0 answers
35 views

Piecewise[ ] for joining InterpolationFunction objects?

I want to combine InterpolationFunction objects, results of an NDSolve in a loop, into one function. This is my code: ...
user avatar
0 votes
0 answers
39 views

How to put piecewise constant control, dependant on the solution, inside NDSolve?

I am working on a Chemostat model with piecewise constant control ...
user avatar
2 votes
1 answer
60 views

NdSolveValue Freeze sensitive to initial condition

I am trying to solve the following system of non-linear differential equations: ...
user avatar
  • 21
0 votes
0 answers
47 views

If definition of elements in table

I need to define a table where the definition of the elements differs if the indices $i$ and $j$ are equal or different. In particular I have to implement the following formula $$(K_1^{(1)}(m_1,m_2))_{...
user avatar
  • 105
2 votes
2 answers
84 views

Overwrite a tensor product notation a_\[TensorProduct]b_ := KroneckerProduct[a, b]

I noticed that the definition of KroneckerProduct and For example TensorProduct[({ {0, 1}, {1, 0} }), ({ {0, 1}, {1, 0} })] Output: {{{{0,0},{0,0}}...
user avatar
  • 823
1 vote
0 answers
32 views

How to print local variable when assertion failed

Given the following code: func[i_] := Module[{k}, k = i; Assert[k > 0, k]]; func[-1] The output is: ...
user avatar
  • 149
1 vote
0 answers
44 views

Is it possible to trigger some Mathematica code when an error of the type StringTake::take happens?

I process data from various sources (databases) that are formatted very inconsistently. I would like to be able to process them finally summarized in one piece. My code consists of many cases of ...
user avatar
1 vote
0 answers
39 views

Clean startup with back up

Whenever there are bugs Wolfram Support suggests to do a clean restart by holding Ctrl + Shift during start-up (often they recommend that without even warning the user that this will delete all their ...
user avatar
  • 3,543
4 votes
1 answer
131 views

Debugger toolbar refuses to turn off in a notebook. Not sure what to try next?

In the past I had the same problem but there was an easy solution. Just turn off at the Evaluation -> Debugger in the main menu. But this time it is completely ignored. First of all I do not know ...
user avatar
  • 1,647
10 votes
2 answers
243 views

How to globally disable and re-enable Echo?

I have Echo's buried in code all over my notebook, I'd like a flag to turn them all on or off globally. Sure Unprotect[Echo];Echo=Identity would disable them, but ...
user avatar
  • 30.2k
1 vote
0 answers
24 views

How to change Echo output font size including EchoLabel within an entire Notebook?

I am creating a notebook template. I have Input and Output font size set at 10 but the Echo font size is 12. How do I change Echo to font size of 10? I cannot find a setting for this in Option ...
user avatar
  • 1,647
2 votes
1 answer
93 views

Parameter space search routine is too fast?

I wrote a small script to comb through the parameter space of a function looking for where the function satisfies a certain relation everywhere on its (co-ordinate space) domain. However, since I am ...
user avatar
  • 413
0 votes
1 answer
54 views

NDsolve on ODE returns "non-numerical value for a derivative at t == 0.`." [closed]

The input is: ...
user avatar
4 votes
0 answers
156 views

FindGeometricTransform not working properly for a simple problem

I am surprised why FindGeometricTransform is failing to automatically register or align two sets of points that are drawn from a ...
user avatar
  • 8,528
1 vote
0 answers
52 views

Can Mathematica warn you about mistyped variables?

In other dynamical programming languages like Python, mistyping a variable, e.g. mistyping var1 as bar1 in the example below, immediately results in an error. ...
user avatar
  • 489
3 votes
1 answer
132 views

What are some debugging helpers or tips/tricks in your Mathematica toolbag?

I am a novice so imagine my confusion with Mathematica's very poor error and trace messages. Debugging should be an easy thing to do even for beginning programmers but not with Mathematica. What are ...
user avatar
  • 1,647
1 vote
1 answer
78 views

help improving my code or debugging it for Galerkin method

I'm trying to plot it but I cannot, where it keeps running without giving any plots for more than 40 mins, and I'm quite sure about code... The issue that I don't know to how to debug the code at all,...
user avatar
1 vote
1 answer
36 views

Style function not working inside Print Row functions

About Watch[...] is a helper function for watching a list of variables or other functions inside a Module[...] during ...
user avatar
  • 1,647
1 vote
1 answer
59 views

Why does the mix of Exclusions and SymbolicProcessing->0 sets my integral to $0$?

I am trying to compute a $5$-dimensional integral, which may or may not be zero. I do believe it is finite though, at least for the values $\epsilon$, $\sigma$ used here. The integral is given in the ...
user avatar
  • 641
7 votes
0 answers
62 views

Logging modules in Mathematica?

Is there any logging module or functions or scripts that one can use to store all the information of what happens during executing mathematica program in Wolfram? For example, one might look up log....
user avatar
  • 1,546
6 votes
0 answers
83 views

In over my head in trying to create a debugger

Apologies for a less than ideal question, but if I could have asked a good question the answer would probably have been revealed in the process... In answer to this question @LeonidShifrin gave some -...
user avatar
  • 2,410
1 vote
0 answers
297 views

Unknown Box Name (ToBoxes) Error

I'm getting the following error in Mathematica What is going on? How do I avoid such an error? In order to roughly understand how I'm getting this error, here is a bit of context: I'm using ...
user avatar
  • 4,138
3 votes
0 answers
52 views

Package code problems with Mechanical Involute Gears

I've been playing around with with the old library archived package "Mechanical Involute Gears" The package has some broken things, namely those having to do with utf8 and a ...
user avatar
5 votes
0 answers
105 views

Visually identifying differences between two Mathematica functions

Context Let us assume we have two functions defined in Mathematica. I am interested in spotting the differences in the code for the two functions. Example ...
user avatar
  • 21.7k
1 vote
0 answers
58 views

Finding a selected expression

How can I find all expressions matching the one I am selecting? This features exists in Matlab and is quite helpful: Just trying to make my debugging easier. Thanks!
user avatar
0 votes
0 answers
47 views

After execution of simple list manipulation every expression turns dark blue and nothing is defined - how to debug

This question is related to this one in the sense that it uses the code from there. What happens is best illustrated in the video here. When I run (* part 1 *) ...
user avatar
  • 3,150
11 votes
1 answer
220 views

Why does Unevaluated applied (@@) to a held expression not work?

I do not understand why Unevaluated sometimes does not work. Consider this expression: expr = Hold[a - a] Now let's say I ...
user avatar
2 votes
0 answers
47 views

Trace reveals unexpected evaluations and internal calls for recursive function

I would like some help in identifying the problem in my implementation of the recursive function shown below. But first, a bit of background. There is a well-known solution to the problem of finding ...
user avatar
  • 4,677
5 votes
2 answers
161 views

Is there a builtin function to turn selective Echos off?

Suppose I have a code block EchoOff[CompoundExpression[ ..., Echo[...,"echo 1",f], Echo[...,"echo 2",g], ... ]] Is there a function ...
user avatar
  • 8,075
2 votes
2 answers
171 views

Assert that prints message and aborts computation?

I'd like to add asserts which check for condition, print useful message and abort computation on failure. IE, ...
user avatar
0 votes
0 answers
146 views

How to see/trace Manipulate steps?

I am relatively new in Wolfram Language. What I want to solve is tracing "manipulate" steps in one of the demonstration project example codes. In my particular example, there are nearly 20 user build ...
user avatar
3 votes
0 answers
93 views

Displaying outcome of Trace [duplicate]

Is there a better way to display Trace output? Parsing could be provided to separate blocks of the computation by an extra line. Trace produces a large chunk of unbroken output that I copy into a new ...
user avatar
  • 1,004
2 votes
2 answers
132 views

Mathematica clears all definitions or crashes with the following code, can anyone reproduce the bug? [closed]

I am working on a simple code, however Mathematica crashes or clears all definitions each time I will try to do anything with matrix B. Even when I just print it ...
user avatar
  • 2,460
2 votes
1 answer
44 views

How can I properly use Catch[] to prevent my program from quitting?

I am getting an error depicting an Uncaught Throw, with the accompanying code being returned: Hold[Throw[$Failed, CURLLink`Utilities`Exception]] I have managed ...
user avatar
  • 1,397
0 votes
1 answer
111 views

An example of symmetric, real entry matrix with non-real eigenvalues, according to Mathematica. Is this a bug?

The following matrix is symmetric and all entries are real, ...
user avatar
0 votes
1 answer
170 views

Fractional motion and SystemException["MemoryAllocationFailure"]

...
user avatar
  • 125
3 votes
1 answer
213 views

How to trace value assigned to local variable(variables in Module)?

Bug introduced in v10.1 or earlier and persists through v11.3 CASE:4240757 Here is my code: ...
user avatar
  • 145
2 votes
0 answers
211 views

Profiling - workarounds/fixes for unreliable RuntimeTools`Profile? Update added Clue

[MMA 11.0.1.0 Win 10 64-bit] I have tried using RuntimeTools`Profile manually and the most useful profile[] function provided by @Carl-Woll in this answer. Sadly, neither work reliably and the ...
user avatar
  • 2,410
0 votes
1 answer
129 views

Plotting intermediate values of an argument in a recursive function

I've read through the documentation on tuning and debugging but feel like I am missing some important concepts. Many of the examples given presume the programmer is explicitly generating ranges of ...
user avatar
4 votes
0 answers
289 views

Profiling in Mathematica

This is meant as a broad question, because I couldn't find such a discussion on this topic (the questions I found are very old and basic, e.g. the most popular one only shows where to find Mathematica'...
user avatar
  • 1,183
14 votes
1 answer
306 views

Profiling a package

I have some code that I want to profile to see how much time each step takes, for instance: ...
user avatar
  • 1,183
0 votes
0 answers
155 views

Problem with small program: Error: "Charting Private pvar"

Im in the making of a smaller self-running application. I have made a small piece of the program as it has to look in the end. However, sometimes when i change some of the input for either "demand" or ...
user avatar
  • 11
0 votes
0 answers
48 views

Define a new Front End Syntax for Function Argument Checking & Debugging

In this question I asked a basic question about how to check argument types such that there was useful output from the front end when calling functions. Based on elements of the nice answer by @j-m-is-...
user avatar
  • 2,410
3 votes
2 answers
259 views

Debugging NDSolve to see numerical values at each time-step

I wish to debug my NDSolve function and this is my first time using the Mathematica debugger. I have read around and attempted various different ways of debugging but I cannot figure it out. I want to ...
user avatar
3 votes
1 answer
195 views

Force a function to report argument type mismatches

As a relative newcomer to Mathematica, I am still frequently caught out by coding errors that, at least by default, MMA does not indicate to the front end, in particular when I define a function and ...
user avatar
  • 2,410