Questions tagged [debugging]
Questions about debugging techniques, using the built-in debugger, and/or the Wolfram Workbench debugger.
193
questions
5
votes
2
answers
330
views
Is it possible in Mathematica to get a step-by-step evaluation of the following?
Is it possible in Mathematica (or WolframAlpha["...]") to get a step-by-step evaluation of the following?
...
6
votes
3
answers
227
views
Incrementing a random element of an array repeatedly
Consider this code to simulate a simple instance of the coupon collector problem. We initialize an array to {0, 0} and then keep incrementing a random element until we've incremented every element at ...
1
vote
1
answer
106
views
Trace animation of spherical and $\pi$ atomic orbital
I want to get trace animation, which forms 3D object at last.
Though I saw ring shape structural animation in the website:
https://community.wolfram.com/groups/-/m/t/1991109
also
Creating a movie of ...
1
vote
0
answers
75
views
How do I profile my own code in Mathematica? [duplicate]
Coming from the question Profiling from Mathematica and reading the example, I manage to reproduce it but I have no idea how to adjust it to profile my own code.
Given an example file:
...
0
votes
0
answers
46
views
Printing the value of a function crashes Mathematica
I define SolVm1:
...
2
votes
1
answer
63
views
How to debug `$Failed` messages
The following quits with message $Failed and no other information on Mathematica 13.2 (also on cloud), are there any debugging tricks to find the source of the ...
4
votes
3
answers
121
views
How to evaluate EXPR in a subsession of a different already running kernel and get the output?
Is there a way to evaluate some expression in a subsession of another already running kernel, collecting the output, from a Local monitoring kernel? Something like
...
2
votes
1
answer
72
views
How to remove debugging prints from my package?
I'm using my own package, partly based on Ted Ersek's RootSearch package, partly based on some posts on this portal. It has a lot of debug prints coded like this:
...
1
vote
1
answer
68
views
DSolve is producing a segmentation fault for large systems of equations
The below code runs fine for anything up to a 64^2 matrix. However, moving to 128^2 throws a segmentation fault, which, despite my best efforts to debug, I cannot find a cause for. Or, to be honest, ...
1
vote
0
answers
37
views
ParametricNDSolve computation time is sensitive to the range of independent variable
My code to solve a system of nonlinear differential equations are the following:
...
0
votes
0
answers
48
views
Line breaks cause too many empty lines in the Information box
$Version
13.0.1 for Mac OS X ARM (64-bit) (January 28, 2022)
When there are many *Values with line breaks, the ...
1
vote
1
answer
75
views
Techniques to debug large cell which crashes kernel?
Is there any technique to debug a large cell which crashes kernel? IE, perhaps some way to print each line in the cell before it gets evaluated?
The following is such an example cell, crashes both ...
5
votes
2
answers
545
views
Why the Debug .dll is work normall but the Release .dll is crash in librarylink?
The Catenate is very slow in FunctionCompile. So I want to use the librarylink to make a .dll...
6
votes
2
answers
140
views
Why is DSolve unable to solve this second order ode with initial conditions? Any workaround?
Fyi, report to WRI as suggedted. [CASE:4956902]
This ode is similar to one here but for some reason DSolve could not able to solve this. This ode is from a ...
4
votes
0
answers
97
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'...
0
votes
0
answers
208
views
Find a way to have all progressively human reading or logical steps in a symbolic calculus and improve rendering
I have the following Mathematica notebook on this link notebook link
1.First, I would like to generate in an automatically way this notebook to a Wolfram script that I can make run directly from ...
2
votes
0
answers
38
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[] (...
0
votes
0
answers
69
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?
...
3
votes
1
answer
75
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....
7
votes
2
answers
249
views
Trace works differently with different right-hand-side rules—bug?
Bug introduced in 2.1 or earlier and persisting through 13.2
UPDATE: Wolfram Support has confirmed that this is a bug.
I noticed that Trace does the following ...
6
votes
1
answer
124
views
Want to tally the arithmetic operations of a recursive computation
Say I have a recursive computation func[n], and it involves the standard arithmetic operations +, -, *, /. I want to know how many additions, subtractions, multiplications, and divisions where done in ...
4
votes
2
answers
288
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:
...
0
votes
0
answers
53
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:
...
0
votes
1
answer
100
views
See how Mathematica computed the integral
Mathematica says that the following complicated integral is infinity, which is reasonable:
...
2
votes
1
answer
82
views
NdSolveValue Freeze sensitive to initial condition
I am trying to solve the following system of non-linear differential equations:
...
1
vote
0
answers
119
views
"Show Stack Trace" option always missing from error context menu
According to the Wolfram Language documentation, there should be an option in the context menu to see the stack trace:
But I never see that option in my context menus:
Is there a specific global ...
0
votes
0
answers
52
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))_{...
2
votes
2
answers
316
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}}...
1
vote
0
answers
148
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:
...
1
vote
0
answers
46
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 ...
6
votes
1
answer
159
views
How to detect unused local variables?
I have some code (that I did not write) that has many unused local variables in Modules. I would like to clean this up. Is there any automated way to do this or to make it more clear that a local ...
1
vote
0
answers
52
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 ...
4
votes
1
answer
192
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 ...
11
votes
2
answers
272
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 ...
1
vote
0
answers
49
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 ...
2
votes
1
answer
142
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 ...
0
votes
1
answer
70
views
7
votes
0
answers
117
views
Understanding the profiler: Is pattern matching/de-structuring expensive?
I was profiling some code and I am trying to understand what the results mean. Suppose we have the very idiomatic,
...
5
votes
0
answers
219
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 ...
1
vote
0
answers
54
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.
...
3
votes
1
answer
166
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 ...
1
vote
1
answer
91
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,...
1
vote
1
answer
40
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 ...
2
votes
0
answers
41
views
Is it possible to profile Wolfram Language code without Workbench? [duplicate]
Are there any tools built into the latest version of Mathematica that would allow a user to run a profiler against packages? I have read this question, but there have been two releases since that ...
1
vote
1
answer
68
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 ...
7
votes
0
answers
85
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....
6
votes
0
answers
89
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 -...
2
votes
0
answers
529
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 ...
3
votes
0
answers
61
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 ...
5
votes
0
answers
113
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
...