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 - ...


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:


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 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 ...


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 ...


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

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

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; ...


5

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 ...


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

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

Sorry, but your matrices aren't valid incidence matrices. From the IncidenceMatrix help page: For an undirected graph, an entry $a_{ij}$ of the incidence matrix is given by: 0 if vertex $v_i$ is not incident to edge $e_j$ 1 if vertex $v_i$ is incident to edge $e_j$ 2 if vertex $v_i$ is incident to edge $e_j$ and a self-loop In ...


4

The test matrices are matrices but not incidence matrices. The rows represent the vertices and each column represents an edge. Consequently each column must have only 2 non-zero entries or a single entry of 2 for self loops. This is not the case for any of the matrices or their transposes. To check for yourself, try yourself, e.g.: mat = ...


4

The answer why it is not valid incidence matrix is given by the above answers. To verify if your matrix is valid, use the following command m = {{1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1}, {0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0, 0, ...


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_] = ...


3

The trial version does not support export operations, so this is not possible with the trial.


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

The reason this error occurs is because Set and Part have the Attribute HoldFirst, while functions like Position, which was used to get the position 4, does not have HoldFirst. To verify, the line s[[1]] = Sum[s[[1]] /. b[3] -> k, {k, 3}] adds a parenthesis which does not get evaluated, so (s//Hold)[[1,4]] Out[1] = Part::partw: "Part 4 of ...


3

Assuming there's not a typo in your question, it's doing exactly what it should, meaning perhaps your equation or its entry is incorrect. Using a simplify wrapper: fs[a_] := FullSimplify[a, 0 < r < 1 && r ∈ Reals] I applied it to the blocks of your equation as follows: s1 = fs[4* Pi*(-(r*(1 + r)^2* Sqrt[-(((1 + r)^4 + (-1 + ...


3

You have the x overloaded in too many places. You use it as free variable for the Series, then you use it for the plot command variable. I think this error happens because ?? Plot show it has HoldAll. Then the x for the plot takes effect before the Series is expanded. But this 'x' is now a number, so Series complains as it needs a symbol. But best to ...


3

Do[ Check[{i/i, 1/(i - 5)}, Print@i], {i, -10, 10}] // Quiet 0 5



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