Tag Info

Hot answers tagged

16

A bit of historic background Before Mathematica version 6 graphics were produced as a side-effect much as Print works now. In fact you can load this old system using: << Version5`Graphics` Now you get this behavior: Note that the output is - Graphics - and the plot itself is handled like Print. Since there was often little value in having - ...


15

To access the errors, you need to invoke the Front End directly from the kernel. In effect, you end up telling the kernel to tell the FE to tell the kernel to do something, so that the FE can report any errors it finds. The method I use is SetAttributes[getFrontEndErrors, HoldAll]; getFrontEndErrors[gexpr_] := Module[{nb}, ...


12

You can do the analytic integral in Mathematica too, by telling it to perform the upper integration limit as follows: With[ { i = Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, r] }, Simplify[ Limit[i, r -> Infinity] - i /. r -> 2 ] ] (* ==> 23/64 + Pi/(3 Sqrt[3]) - 2 (-(1/7))^(1/3) Hypergeometric2F1[1/3, 1/3, 4/3, ...


12

It's not a syntax mistake. Consider it a suggestion, FrontEnd tells you: "maybe you want to plot it as it has no much sense now". Of course it may have sense, it's just a suggestion. If you take a closer look you will find that storing such Plot makes more sense for FE:


10

Believe the numerical one. Mathematica simply could not do the symbolic integration. Symbolic integration will travel via a different code path. Here the symbolic integration done using Maple, and it agrees with the numerical solution given by Mathematica's NIntegrate The analytical answer is (7/18)*hypergeom([-1/3, 1, 1], [2, 2], ...


9

The pink box shows a formatting error. You can disable highlighting of formatting errors for a specific object using Style: Style[ Graphics[{Disk[], garbage}], AutoStyleOptions -> {"HighlightFormattingErrors" -> False}] You can also change the setting globally using the Preferences dialog (Edit - Preferences - Messages - Formatting error ...


8

The number 2045 is suspicious. Add three to it to include stdin, stdout, and stderr, and you get 2048, which I suspect is total number of file descriptors available to you. I conclude your problem is caused by eating up all the available file descriptors. This is usually caused by doing too many file opens without doing any file closings to return some file ...


8

The problem has nothing to do with OpenWrite. You never Close the stream you open in your call to Read. Read, unlike ReadList, does not automatically close a stream (file, pipe, etc.) that's given as its first argument string. (That's because the purpose of Read is to be able to read from the same source in pieces, unlike ReadList which does it all at ...


7

This question probably will not receive a "real" answer because it is based on a misconception about what $MachineEpsilon actually is. But, since the question is upvoted, I suppose there is more than one person who is not yet clear on how this is defined. Therefore, here is a comment to try to clarify the definition and tie up the loose ends of the thread. ...


6

The problem here is that the Gridlines specification error message is not a kernel error message (you'll note that it is not printed with the standard Func::tag format). Instead, this warning text is generated by the front end during the rendering of the graphic. The actual generation of the gridlines values is deferred to the moment when the graphics ...


6

First, note that turning off messages is technically not the same thing as not printing them. You can avoid printing messages by removing the output channel they're being sent to: $Messages = {} Restore the previous behaviour using $Messages = $Output, provided that you haven't changed $Output. But this won't turn messages off, it will only avoid ...


6

One option would be to restrict the function from funky regions with a Condition liks this f[x_, y_] /; Abs[x - y] > 5 := (Sin[x] - Sin[y])/(x - y); Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10}] Out: One can easily see that Plot3D will also sample points in the region which is "forbidden", the points are just not drawn due to the RegionFunction. ...


6

This is not an attempt to answer the question exactly as posed, because generally speaking I don't consider it a good idea to subvert Mathematica's evaluation process (e.g. by reaching up the stack and rewriting definitions based on their RHS before they evaluate) just to satisfy arbitrary syntactical preferences. A better way, if you just want to stop ...


6

Note: this response was written before sample data for the question was changed from 24 3D points to 96 2D points. The main message remains unchanged, however. The error message is complaining that the first zero in the first polygon specification is not a valid index into the list coord which has 24 elements. A GraphicsComplex defines a list of points of ...


5

Not knowing quite what you're doing this may or may not help. I think the problem is you're turning the warnings off in the master kernel and the warnings you're seeing come from the slaves. I'd suggest... ParallelTable[Quiet[your code here],{your iterator here}]; OR ParallelEvaluate[Off[NIntegrate::slwcon]]; ParallelTable[your code here, {your iterator ...


5

This is a short-coming of how the arguments are evaluated. The symbols k.x[t] is treated as a single term, while g is treated as a list; Plus automatically threads over the list creating a little mess: x''[t] == k.x[t] + g (* x''[t] == {1 + {{1.5, 0.}, {0., 1.5}}.x[t], 2 + {{1.5, 0.}, {0., 1.5}}.x[t]} *) If a 2-vector value is substituted for x[t], this ...


5

If you execute the command in your question and do ShowExpression on the output cell containing the pink graphics box, you see the following code: GraphicsBox[{{}, {}, {RGBColor[$CellContext`a], ... This is further indication of what I suggested in the comment - that the error occurred when the FrontEnd was ultimately unable to find a value for a in the ...


5

Somewhat tautologically we can demonstrate that the Front End parses these differently: parseString[s_String, prep : (True | False) : True] := FrontEndExecute[UndocumentedTestFEParserPacket[s, prep]] parseString["?Sin\n2+2"] parseString["??Sin\n2+2"] {BoxData[{RowBox[{"?", "Sin"}], RowBox[{"2", "+", "2"}]}], StandardForm} {BoxData[RowBox[{"??", ...


5

According to the documentation center: Goto first scans any compound expression in which it appears directly, then scans compound expressions that enclose this one. Your Goto - Label construction is part of the List so Mathematica fails to find the label. Taking this under consideration, the following will work: k = 0; Do[{ Label[top]; k = k + 1; ...


4

The following expression should result in an error: First@Cases[NotebookGet[EvaluationNotebook[]][[1]], Cell[___, CellTags -> "MyCode", ___]]] because Cases, by default, operates at level {1} and in a notebook's expression, CellTags will never be at level {1}. Thus, Cases returns {} and First throws an error. The solution here, is to use level ...


4

The ability to recognize vectorial unknowns such as x[t] in NDSolve is a relatively new feature that doesn't seem to work reliably for my applications, either. So I usually find it much safer to do things in a slightly more "old-fashioned" way, by declaring all unknown functions individually using Array. That can be done relatively efficiently and doesn't ...


4

Well, here's a (trivial) answer that works: Module[{u}, Integrate[1, u] /. u -> f[t]*Exp[(v/V)*t]]


4

I don't know Python, and there's one aspect of the Python code I don't get; but this does what the last paragraph describes. safeeval[fn_, x_, epsilon_] := ReleaseHold @ Catch @ Quiet @ Check[ fn[x], Check[ ReleaseHold @ Catch @ Quiet @ Check[ fn[x + epsilon], Throw @ Hold[fn[x - epsilon]]], Throw @ ...


4

The term incidence matrix has caused confusion on this site before, so I think it's time to clear this up. There's no standard, generally agreed upon definition of incidence matrix. It's a loose term for a matrix that describes the relationship (connections) between two different classes of objects. What these objects are can vary. When you see the term ...


3

It looks like you already have your solution, and a rather elegant one at that, but perhaps what is yet lacking is a convenient method that does not require manually writing that nested structure. We can use recursion. The basic form looks like this: SetAttributes[errorTry, HoldAll] errorTry[a_, b__] := Quiet @ Check[a, errorTry[b]] errorTry[x_] := x ...


3

So it looks like what you want to do is apply the temporary definitions in defs to code, then show the output. Here's what I came up with. SetAttributes[Rep, HoldAll]; Rep[defs_, code_] := Module[{symsTrans, downVals}, symsTrans = Union[Cases[Hold[defs], HoldPattern[SetDelayed][f_[___], _] :> (f -> "changeMe"[f]), {0, \[Infinity]}]]; ...


3

I believe this is due to special parsing just as I described in: Infix form of PutAppend ( >>> ) does not work with variable. You cannot assume that all input forms are valid syntax at an arbitrary place in an expression. It was my interest in seeing how Mathematica was interpreting certain input (that is, what Box expression were being sent to ...


3

Same idea a belisarius but moving the entire first argument into a separate function, while also localizing x: fn[x0_?NumericQ, v0_?NumericQ] := Module[{x}, {x[0], x'[0]} /. NDSolve[{x''[t] == 1, x'[0] == v0, x[0] == x0}, {x, x'}, {t, 0, 1}] ] StreamPlot[fn[x0, v0], {x0, -2, 2}, {v0, -2, 2}] No errors.


3

It's a bug: there are more than one call to Message[FindRoot::bbrac], and some of them are suppressed, but only if Quiet is used. Here's a way to check suggested by Szabolcs: messageHandler = Print[{##}] &; Internal`AddHandler["Message", messageHandler]; Quiet@FindRoot[x == 1, {x, 0, 0.5}, Method -> "Brent"] <...> ...


3

You only have to make sure that the coefficient c[n] in the Fourier series is defined for all n. This means that the If statement defining c[n] must return a value not only for n==0 as it does in your attempt, but also for other values of n. So all you have to do is change your code to c1[n_] := 1/2/Pi Integrate[Sign[x] Exp[-I n x], {x, -Pi, Pi}]; c2[n_] = ...



Only top voted, non community-wiki answers of a minimum length are eligible