# Tag Info

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: << Version5Graphics 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:

10

One possible solution is using Quiet: ds[All, Quiet[#a/#b]&] Another possible solution is using the FailureAction option: ds[All, #a/#b, FailureAction -> None]

10

Use NDSolve antiD = NDSolveValue[{f'[x] == Sqrt[1 + x^3], f[0] == 0}, f, {x, 0, 10}] Example usage: Plot[antiD[x], {x, 0, 10}] Alternatively... This works because this function can be antidifferentiated (by Mathematica). antiD = FunctionInterpolation[ Evaluate @ Integrate[Sqrt[1 + x^3], {x, 0, t}, Assumptions -> 0 < t < 10], {t, 0, ...

10

FYI a more elegant way to get tweets1 is tweets1 = Rule @@@ tweets; Classify automatically separates words under the hood (via StringSplit), so you don't actually need to do that yourself. Classify has a built in sentiment classifier: Classify["Sentiment", "Windows 10 why is It called windows 10 when there was no Windows 9?"] (* "Negative" *)

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

9

The reason you get a message is because Compile cannot handle non tensor arrays, and the first argument to MeijerG is not a tensor (i.e. {{1/2, 1/2}, {}}). Now DumpsterDoofus is correct in that MeijerG cannot be compiled, but we can get around this error, which will make MeijerG usable in compiled code. What I mean by usable is Compile will call ...

8

I see there are no accepted answers for this question after more than 10 months so I thought I'd have a go at it. Although I have been using Mathematica for since V8, I am only an occasional user and hence not at all an expert like the others who have chimed in so far - but I'll give it a shot. Rather than using the Java based import to open and import the ...

7

You can specify a general error message that only consists of a placeholder General::error = "1"; and then use foo[x_] := Module[{}, If[x < 0, Message[foo::error, "x<0 detected"], x]]; r = foo[-1] foo::error: x<0 detected

6

How about using "RuntimeErrorHandler": f = Compile[{{x, _Real}, {y, _Real}}, Log[(x - y^2 - 2. x)^2]/(y x^2 - 2 (x + y) - y^2 + 3.), "RuntimeOptions" -> {"RuntimeErrorHandler" -> Function[Throw[$Failed]]} ]; Catch[Quiet@f[-196, 15]] // AbsoluteTiming (* {0.000019, 0.0000116843} *) Catch[Quiet@f[-196, 14]] // AbsoluteTiming (* {0.000051, ... 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 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 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 ... 6 The problem is that the stdin stream for each process is being left open and needs to be closed. To demonstrate the issue, we create a single process:$process = StartProcess[$SystemShell]; WriteLine[$process, "echo example line"]; KillProcess[$process]; The call to WriteLine implicitly creates a stream object. Even though the process has been killed, ... 6 If you set the contents of your interpolation function to be the variable data={{..,..},..} (such that Interpolation[data] gives the message), you can look at the mesh generated with: Needs["NDSolveFEM"] mesh = ToElementMesh[data[[All, 1]]] That also gives the message. Looking at mesh["Wireframe"] gives you an idea what is going on. You can then use ... 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 ... 5 We can use Hold to prevent message names from being evaluated until the time is right: g[a_, verbose_:False] := Module[{messageList} , messageList = If[verbose, {}, Hold[FindRoot::lstol]] ; messageList /. _[m___] :> Quiet[FindRoot[x^2 + x + a, {x, 3}], {m}] ] 5 The following works in Version 9.0.1.0 and Version 10.0.1.0 BoxForm$UseTemplateSlotSequenceForRow = False; {x^a, Sqrt@b, ArcSin[c]} // Row // TeXForm (* x^a\sqrt{b}\sin^{-1}(c) *)

4

NDSolve has already detected the largest such intervals for you, which is why the resulting InterpolatingFunctions have restricted domains. You can use InterpolatingFunctionDomain to extract those domains. I'd do something like so Clear[x1, x2, y] eqn = {x1'[t] == -x1[t]^2 - x2[t] + y[t]^3, x2'[t] == x1[t] - x2[t] + x1[t]^2 x2[t]^2, y'[t] == x2[t]^2 ...

4

We had a bug like this on v. 10: it specifically stopped running new processes after you created 100 of them. This was fixed in version 10.0.1. I recommend testing it there, as version 10.0.1 has a number of improvements with respect to StartProcess. I can't test your example in MacOS right now, so please let me know if this isn't working on v. 10.0.1. ...

4

I use \$MessagePrePrint = StandardForm since without that the real number 1.5 is displayed in a message as 1.5. However, you might have$MessagePrePrint set to something else. Check is used to control what should happen when a built-in message occurs. Quiet prevents the built-in message from being displayed. I made a pure function (i.e. #1,#2,& ...

4

A simple way would be to assign the value of expr to a variable and then return that variable after printing the messages. For example: info::values = "n was  and d was "; Module[{n, d, v} , n = 100 ; d = 0 ; Check[v = n / d, Message[info::values, n, d]; v] ]

4

One can define a dynamic environment where Message will be overloaded. Here is one way: ClearAll[withMessageDetection]; SetAttributes[withMessageDetection, HoldAll]; withMessageDetection[code_] := Internal`InheritedBlock[{Message}, Module[{inMessage, tag}, Unprotect[Message]; (call : Message[args___]) /; ! TrueQ[inMessage] := ...

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

4

I have found a workaround which works for my purposes, though it is not particularly pretty, and the weird behaviour of Evaluate on error messages remains a mystery to me. It is possible to switch between different Quiet behaviours by setting a custom message group and then switching that within the logic. The following code works, as far as I can tell. ...

4

Why not something a little simpler? g[a_, verbose_: False] /; ! verbose := Quiet[g[a, True], FindRoot::lstol] g[a_, True] := FindRoot[x^2 + x + a, {x, 3}] Now: g[1] (* no message *) g[1, True] (* FindRoot::lstol: printed *) This has the advantage of separating the primary definition from the one that controls Message printing, making both ...

4

Since gh is a tensor, you need to say what rank it is, so replace {gh, _Real} with {gh, _Real, 2} to fix the error. costFxn = Compile[ {{P, _Real}, {Ns, _Integer}, {gh, _Real, 2}, {Kg, _Integer}, {G, _Integer}, {betaGN, _Integer}}, Sum[ -Exp[Kg/(P gh[[g, n]])] (Kg * betaGN)/ Log[2] ...

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