Skip to main content

Questions tagged [debugging]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
83 views

Expand disagrees with original expression

I have a rather nasty double summation that I am doing. To check that whatever I do it is valid, I routinely substitute in numerical values. I also have checked the result of the double sum by doing a ...
3 votes
0 answers
92 views

Partial trace of a $n \times n$ square matrix

I would like to create a function to compute the partial of a general matrix. I came across to the following code for a 4x4 matrix: ...
4 votes
1 answer
209 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 ...
1 vote
1 answer
57 views

Troubleshooting NDSolveValue::rdelay Error in a Dengue Epidemic Model with Delay Differential Equations in Mathematica

I am modeling the vector dynamics of a dengue epidemic using a system of delay differential equations (DDEs) in Wolfram Mathematica. My model includes a complex interplay of host-vector interactions, ...
1 vote
0 answers
30 views

Insert function not working [closed]

...
4 votes
2 answers
349 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
239 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
125 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
51 views

Printing the value of a function crashes Mathematica

I define SolVm1: ...
7 votes
2 answers
255 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 ...
2 votes
1 answer
71 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 ...
35 votes
8 answers
6k 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.
4 votes
3 answers
126 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 ...
31 votes
5 answers
59k 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 Protected....
0 votes
1 answer
204 views

Fractional motion and SystemException["MemoryAllocationFailure"]

...
16 votes
4 answers
1k views

How to make a custom Echo

I usually check my intermediate variable by Echo.Like Table[Echo@x, {x, 10}] But when the intermediate variable have too much ...
2 votes
1 answer
77 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
69 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
76 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
646 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
146 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 ...
5 votes
0 answers
396 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 ...
4 votes
0 answers
99 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'...
25 votes
1 answer
924 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 ...
0 votes
0 answers
210 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
76 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
78 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....
6 votes
1 answer
128 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 ...
8 votes
2 answers
240 views

Is there a way to accelerate buffering to the screen?

I have an application that does a bunch of small computations, mostly Table management, and logic around loops. It takes seconds to execute. However, when I turn on debug (a variable I set for ...
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: ...
2 votes
1 answer
85 views

NdSolveValue Freeze sensitive to initial condition

I am trying to solve the following system of non-linear differential equations: ...
0 votes
0 answers
60 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
107 views

See how Mathematica computed the integral

Mathematica says that the following complicated integral is infinity, which is reasonable: ...
1 vote
0 answers
139 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
53 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
402 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
154 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: ...
2 votes
0 answers
573 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 ...
38 votes
2 answers
5k 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 ...
1 vote
0 answers
48 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 ...
5 votes
0 answers
227 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 ...
6 votes
1 answer
174 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 ...
12 votes
2 answers
280 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
53 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 ...
42 votes
4 answers
3k views

Interrogating a running evaluation

Is it possible to find the values of variables of a running Mathematica evaluation, without interrupting it? For example, suppose I do: Do[Pause[1]; a++, {50}] ...
2 votes
2 answers
236 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, ...