Questions tagged [error-tracking]
The error-tracking tag has no usage guidance.
96
questions
62
votes
2
answers
4k
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 ...
36
votes
2
answers
1k
views
How do I disable the stack tracing feature in Mathematica 11?
Bug was introduced in 11.0 and persisting through 11.1
It looks like the Mathematica 11 stack tracing feature (see red ellipsis in front of any warning message) prevents the garbage collector from ...
27
votes
5
answers
3k
views
How to catch complete error message information, including the message text as it would be printed?
If I evaluate this expression:
Module[{}, 1/0;0^0]; msg = $MessageList
I get:
...
22
votes
2
answers
641
views
MathKernel doesn't return all Messages
In Mathematica I run this command:
Plot[Sin[x], {x, 1, 15}, GridLines -> error]
It generates a Plot with this error message:
A GridLines specification ...
21
votes
1
answer
262
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
2
answers
262
views
Would it be a good idea to use Failure and FailureQ in own code
Since version 10 (at least 10.0.2 but I think 10.0.0) there is Failure and since version 10.2 there is also FailureQ. As often ...
13
votes
1
answer
366
views
Unit tests for Graphics or FE boxes
Consider the following expression with bad syntax:
Graphics[{foo}]
How can I detect the error and retrieve the error message programmatically, so I can check for ...
12
votes
2
answers
281
views
What is the simplest way to determine which call to a superfunction has generated a Message?
I have a complicated function which contains many calls to NIntegrate, NSolve, FindRoot and ...
12
votes
1
answer
232
views
Adding Trace produces error messages
This is very strange. As I was trying to debug this problem, I noticed when I add Trace then I get lots of internal errors generated. This also happens the first ...
11
votes
3
answers
542
views
How to write a function-defining function which stores the function arguments in a stack?
I have a function-defining function
SetAttributes[DefFn, HoldAll];
DefFn[f_[args___], body_] :=
f[args] := body;
I am trying to modify this function to record ...
11
votes
4
answers
230
views
How to detect errors that happen in the FrontEnd? [duplicate]
Some errors only seem to be produced at the point of typesetting, making it very difficult to detect them early. For example:
...
9
votes
2
answers
5k
views
Histogram with Error bars
I have a dataset for which Mathematica easily creates a Histogram. However I also need Mathematica to show error bars corresponding to 3 standard deviations for ...
7
votes
1
answer
80
views
Check applied to list is not the same as list of Check
My question is in two parts. First, I want to know why
Check[#, "Failed"] &@{0^0, 1^1}
evaluates to
...
6
votes
1
answer
22k
views
How do I troubleshoot when I get a Part::partd or a Part::partw error?
Mathematica has produced the following error message:
Part::partd: Part specification ... is longer than depth of object?
What is partd?
I think I may have ...
6
votes
2
answers
182
views
How to Quiet[] only the first argument of Check[]?
I have a Check of the form
Check[expr,failexpr, {NIntegrate::slwcon}]
If expr throws slwcon, I would like to redo the calculation with higher precision by ...
5
votes
1
answer
129
views
Strange Tilt on error notification
I was testing the source code of the answers to this question.
And when I tried this response and maxed out most of the manipulators, this is what I got.
What went wrong that the errors are tilted. ...
5
votes
2
answers
887
views
Solution of a System of Equations Using `Solve`
Part 1
I am trying to solve a simple system of equations as follows
Solve[{A x^B == f, A y^B == g}, {A, B}]
But I just get the error
Solve::nsmet: This ...
5
votes
1
answer
274
views
Raise Warning/Error on invalid Matrix Addition and Multiplication
Consider the following code:
DiagonalMatrix[{1, 1, 1}] - 1
Mathematica interprets it in the way, that it substracts 1 from every matrix field while ...
5
votes
1
answer
1k
views
Why these (error) messages?
Testing this answer I used:
stream = OpenWrite["A:\\out.txt"];
Block[{$Messages = stream},
Mod[1, 2, 3, 4, 5]
]
and I was surprised to find that the contents ...
5
votes
2
answers
455
views
Automatically detect largest interval over which NDSolve can find a solution
Question: Consider the following numerical resolution:
NDSolve[eqn, {x1[t], x2[t], y[t]}, {t, tmin, tmax}
where eqn, ...
5
votes
1
answer
268
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 ...
5
votes
1
answer
104
views
Ignore message in `Check` without silencing
Check[expr,failexpr,checkedMessages] will evaluate expr and if it encounters any of the messages in ...
4
votes
5
answers
212
views
How to get a list of indices at which errors occur during iteration
I have been looking at some of the questions regarding error handling but i think my problem is unique.
I am running a Do-loop. I get errors only for certain values of the loop variable due to the ...
4
votes
2
answers
264
views
Why do I get number with Precision larger than error estimate?
I'm trying to integrate a large function like this
...
4
votes
4
answers
186
views
Error when placing legends
Consider the following plot
plot = ListLinePlot[{{{0, 0}, {1, 1}}, {{0, 0}, {1, .8}}}, PlotLegends -> Placed[{"1", "2"}, {.8, .4}]]
When I ...
4
votes
1
answer
285
views
How to disable roundoff error tracking in arbitrary precision arithmetic?
In my calculations I need some larger precision. But due to the fact that I iteratively refine the results to compensate for rounding errors accumulated in previous iteration, Mathematica's arbitraty ...
4
votes
1
answer
254
views
Goal optimization: finding the best combination of capacitors and resistors resulting in given properties
I want to edit @MarcoB answers (because the code he gave doesn't answer the question appropriately)->(the function that need to be optimised is not implemented as asked)
But it seems like I am having ...
4
votes
2
answers
146
views
Mathematica flips the sign of a Maclaurin series
I have the following Mathematica code:
...
4
votes
2
answers
6k
views
SystemException["MemoryAllocationFailure", ...] with NMaximize
I have a complicated analytical expression that needs to be maximized with respect to a parameter t:
...
4
votes
1
answer
126
views
Why is there an error about division by 0?
I'm converting all of my old Mathematica 7.0 codes to my new Mathematica 13.2, and I'm struggling with some issues I didn't encounter with version 7.0. The following code is giving me a headache, ...
4
votes
1
answer
148
views
Show error messages from collapsed sections
I've got a fairly long notebook. I like to have most of the sections collapsed. If I evaluate the entire notebook I don't see errors in the collapsed sections unless I expand them. I did see that I ...
4
votes
0
answers
209
views
Adding an attribute crashes the system?
At some point I noticed the following errors just in the documentation:
And not only this one, this is not only for Manipulate, there were many others. Also the ...
4
votes
0
answers
256
views
How can you link Parallel Mapping and Error tracking
Following this question and the comments made, together with the information in this question, the following code allows error tracking and debugging very nicely.
...
3
votes
1
answer
148
views
Saving a log file if an error occurs
I am running a program that adds a message to a list after each completed cycle (about 5k cycles). Upon completion, the program saves the list to disk so I can review it.
However, if the program ...
3
votes
2
answers
167
views
How to track accumulated error?
If Im not wrong when we use the command N we are using float point numbers in machine precision, right? And the machine precision depends on the bits of the CPU ...
3
votes
1
answer
832
views
How to plot a function whose constant parameters have associated uncertainties in Mathematica 8.0?
Let's assume I want to plot the function $f(x)=a + bx+ cx^{2}$, where experimentally known values of parameters $a, b$ and, $c$ are as follows:
$a=1.01 \pm 0.18$
$b=0.92 \pm 0.11$
$c=2.2 \pm 0.2$
...
3
votes
1
answer
404
views
Printing a success message if no errors have yet been thrown in the current session
I plan to run a lengthy Mathematica script on a Linux terminal (by "a Linux terminal," I mean that I have text output only -- no GUI), using the program math. To ...
3
votes
1
answer
220
views
Large residual error when solving a 2D BVP with NDSolve and Finite Element Method
I'm trying to solve a simple PDE (an inhomogeneous Helmholtz equation) in a disk domain with center at $(1,0)$ and radius 0.5 using the following commands
...
2
votes
2
answers
694
views
DSolve running forever
I have no idea how to speed this up. Does maple do a better job at solving this?
2
votes
2
answers
29k
views
How to fix this error : SetDelayed::write: Tag Plus in (<<1>>)[x_] is Protected.? [duplicate]
I don't get the meaning of the sign <<>> and also from which line the error is coming as I have a program of more than 30 lines with many defined functions without using "Module" . Is not there ...
2
votes
1
answer
51
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 ...
2
votes
1
answer
143
views
How to catch error messages from parallel kernels
Doing something that throws out an error (warning):
ParallelTable[NIntegrate[1/Sin[10 t], {t, 0, W}], {W, 0, 10, 1}]
In parallel somehow limits a possiblity to ...
2
votes
1
answer
91
views
Trouble Finding the period of a function [closed]
I want to use Mathematica to compute the period of the function $F(t)=\cos t - \exp \left( - \sum_{k=1}^{50} \frac{\sin (kt) }{k} \right) -\sum_{k=1}^{50} \frac{\cos (kt)}{k}$, so here's my code
...
2
votes
1
answer
94
views
Plotting function containing NIntegrate: trace the values of convergence problems
Suppose you are plotting a function
Plot[f[x],{x,0,10}]
Where
f[x]=NIntegrate[g[x,t],{t,Tmin,Tmax}].
and when plotting, ...
2
votes
1
answer
225
views
Mathlink works strangely
I have problem when using mathlink, the source code is quite simple:
...
2
votes
0
answers
63
views
Error when exporting
Imagine I have a list of plots, call it frames, and I rasterize them in order to have a smoother exported video, like so
...
2
votes
1
answer
633
views
How to implement an "if an error occurs"-condition in Mathematica programming?
In general Mathematica may return a value even if NDSolve has run into error.
A simple example is
...
2
votes
0
answers
89
views
Issues with symbolic integration
I am trying to do the following indefinite integral,
...
2
votes
0
answers
125
views
How to find discretezation error of NDSolve
Is there a way to find out how large the truncation, round-off, and other errors that occur from discretizing a differential equation are while using the default settings in NDSolve? Or would I have ...
2
votes
0
answers
87
views
Finding and interpreting errors [duplicate]
This sounds like a fairly trivial question, but I can't think of any way to solve it. I am doing an extensive parameter sampling where a set of ODEs is used together with ...