# Tag Info

27

The symbols that are market [[EXPERIMENTAL]] in the documentation are in their own entity class of the "WolframLanguageSymbol" entity type, which is named "UnderDevelopment". EntityClass["WolframLanguageSymbol", "UnderDevelopment"] Here is a list of all the 25 symbols currently (version 10.3) in EntityList[EntityClass["WolframLanguageSymbol", "...

21

dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65}; Module[{t = 0}, Split[dat, (t += #) <= 1 || (t = 0) &] ] {{0.71, 0.685}, {0.16, 0.82, 0.73}, {0.44, 0.89}, {0.02, 0.47, 0.65}} Credit to Simon Woods for getting me to think about using Or in applications like this. Performance I decided to make an attempt at a higher ...

19

General When you define a type based on a head, like f[x_List, y_List]:=... the test happens entirely in the pattern-matcher, not involving the main evaluator. I call such patterns "syntactic". Pattern tests on such patterns are usually faster or much faster. The reason is that all the matching happens entirely in the pattern-matcher, and the latter only ...

18

how to reproduce the default hashing behaviour when explicitly choosing a method Hash[1, "Expression"] (* 6568131406215528669 *) Hash[1, "Expression"] === Hash[1] (* True *) re-create the default hashing behaviour in different versions? Not possible as far as I know. The one-argument Hash implementation may change between versions. ...

18

fibSequences[n_?EvenQ] := Nest[Accumulate[Join[{1, 0}, #]] &, {}, n/2] fibSequences[n_?OddQ] := Most@Nest[Accumulate[Join[{1, 0}, #]] &, {}, (n + 1)/2] fibSequences[10] {1, 1, 2, 3, 5, 8, 13, 21, 34, 55} fibSequences[9] {1, 1, 2, 3, 5, 8, 13, 21, 34}

18

You seem to be re-evaluating the eigenvalues at every point. Just use this definition: Clear[Eval,kx, ky, kz]; Eval[kx_, ky_, kz_] = FullSimplify[ Eigenvalues[H[kx, ky, kz] + Subscript[H, 1][kx, ky, kz]]]; Then the plots will be faster. This will symbolically evaluate the eigenvalues once, and the variables kx, ky, kz get substituted into the ...

17

What's happening This is not simple by any means. You have encountered another instance of a general situation with lexical scope leaks / emulation / over-protection by symbol renaming. The case at hand is pretty similar to the one discussed here, so you can read the detailed explanation of this behavior in my answer there. Roughly speaking, outer lexical ...

16

The answers of the original questions by Szabolcs: What does Rescale do when infinities are present? What's the justification for this behaviour? Where is it documented? were guessed correctly with the comment: If I may be allowed to speculate, these were picked because they do the job advertised and are "conveniently" algebraic. They certainly ...

15

Short answer The local variables of the form varname$... are used by the system, and it is unwise to use symbols with such names as local variables. With, like many other lexical scoping constructs, performs excessive renamings, often even in cases where it isn't strictly necessary. This probably has to do with efficiency - full analysis may be more costly.... 14 There are subtle differences between #& and Identity. If you pass more than one argument, Identity will complain and remain unevaluated, #& will just return the first argument. Identity[x, y] (* Identity::argx: Identity called with 2 arguments; 1 argument is expected. >> *) (* Identity[x, y] *) #&[x, y] (* x *) Also Identity is ... 14 Suggested solution If I understood the question right, then the simplest solution here would probably be to define a helper function like the following: vv[n_] := InternalInheritedBlock[{v}, v /@ Range[n]]; Then, you get vel = vv[m] and every run of vv would result in different set of values, while the values in the set will all come from the same ... 14 This is a good example of why one should never blindly trust the numerical results of systems like Mathematica, without thinking about numerical methods that these systems use. Mathematica won't ever make numerical analysis courses obsolete. Most interpolation methods use piecewise polynomials, and assume slowly varying smooth functions. Your data has ... 14 Usually, when one defines a function that's not too complex (usually a one-liner) it is customary (here we mean Mathematica custom) to define it directly without any scoping constructs (Module, With or Block). For example: myFunction[x_]:= 2 Sin[x] + Exp[-x^2] But as the function definition gets more complex, instead of polluting the Global context with ... 13 Agree with other answers, this is a bad idea (why, precisely do you want to do this?), but in the spirit of encouraging unmaintainable write-once read-never code, here's my entry into the freak show:$NewSymbol = If[StringMatchQ[#, "f" ~~ NumberString], ToExpression[# <> "[x_]=x+" <> StringDrop[#, 1]]] &; Remove["f*"]; ...

13

You are looking for VertexOutComponent. VertexOutComponent[g, 4] gives you the successors of 4. Use Subgraph to get an actual graph out of those. With HighlightGraph, you can also use a subgraph, it will highlight both vertices and edges: HighlightGraph[g, Subgraph[g, VertexOutComponent[g, 4]]]. For visualizing the graph, use GraphLayout -> "...

12

There are many closely related topics but I've failed to find a duplicate. MapThread[Thread @* f, {First @ list1, list2}] MapThread[f, {list2, list3}] {{f[a, 1], f[a, 2]}, {f[b, 3], f[b, 4]}} {f[{1, 2}, {x, y}], f[{3, 4}, {z, w}]}

12

No, this is not possible since there is no forward compatibility for MX files. DumpSave will refuse to continue reading the file once it sees it was written by a newer version as demonstrated in the question. Having said that, there happen to be no changes in the format itself between 10.2 and 10.3, so in principle (after some surgery as shown below to ...

11

It looks like this has not only been corrected in Mathematica 10.4, but has been made about 7 times faster than 10.1. $Version lis = Riffle[RandomReal[100, 10^6], -1]; First @ AbsoluteTiming @ HistogramList[lis, {0, 6, 0.02}] "10.4.0 for Microsoft Windows (64-bit) (February 26, 2016)" 0.12289 11 It is sometimes beneficial to first work with functions (in mathematical sense) as symbols and apply to them some pointwise operations. Then, just at the end, convert resulting expression to pure function (in Mathematica sense) and pass some arguments. This task can be automated using something like following purify function: ClearAll[purify] Default[... 11 I think it's possible to find the shape automatically, but I can't say how reliable this will be. If you can post more sample images, I can try to improve this. Using your image: img = Import["http://i.stack.imgur.com/kL6cd.jpg"]; I would use watershed segmentation to find the particle. The idea is this: Imagine the image gradient strength as a 3d ... 11 One approach is to employ a helper function that unwraps singleton lists: {delist[v_]} ^:= v With this, the GroupBy expression is fairly succinct: dataset // GroupBy[{#type&, #subtype& -> delist}] (* <| "a" -> <| "I" -> <|"type" -> "a", "subtype" -> "I", "value" -> 1|> , "II" -> <|"type" -> "... 11 Complement seems to work without stripping Association in both cases. Complement[b, a] (* <|"b" -> 5|> *) Complement[Sequence @@ KeyUnion[{b, a}]] (* <|"b" -> 5, "c" -> Missing["KeyAbsent", "c"]|> *) What version are you using? 10 These were in a text file on my computer. I put it here, so that I can delete it from my computer. InternalQ's InternalLinearQ[expr, var] yields True if expr is a polynonial of exactly order one in var, and yields False otherwise. InternalRealValuedNumberQ[expr] yields True if expr is a real-valued number, and False otherwise. Internal... 10 Let's start by looking at the code for SequenceCases: << GeneralUtilities PrintDefinitions[SequenceCases] We can see in this code that three different conditions determine whether the expression will be evaluated by sequenceCasesSublist or sequenceCasesPattern. Let's evaluate the two tests that matter on {a_?PrimeQ, b_, c_?PrimeQ} and {a_?PrimeQ, ... 10 Just to be clear, I think this is a terrible idea but nevertheless, a question has been posed for which there is a simple answer: ClearAll@fn SetAttributes[fn, HoldAll] fn[h_[x_]] /; StringMatchQ[SymbolName@h, "f" ~~ DigitCharacter ..] := First@StringCases[SymbolName@h, "f" ~~ d : DigitCharacter .. :> x + ToExpression@d] fn[... 10 I would define your recursion as follows: f[0] = x + Abs[x - 100] - Abs[x + 100]; f[n_] := Abs[f[n - 1]] - 1 You can then plot the value of f[100]; you will notice that it is bounded between$-300\le x\le 300$, but it grows linearly outside those boundaries: Plot[f[100], {x, 250, 320}] Plot[f[100], {x, -320, -250}] The plot suggests that the$f(100) ...

10

To elaborate a bit on Michael's comment, let's first consider this statement from the docs: Sum and Product use over 100 pages of Wolfram Language code. Executing ?Sum`* will in fact show you some of the internal routines used behind the scenes by the function Sum[]. You, the regular user, are not usually intended to access these by yourself; however, ...

10

MapThread[#1 /. x -> #2 &, {list1, list2}]

10

I can't find any confirmations in the documentation, but through numerical and visual checks I think when at least one input to Mod is not real, we have This definition doesn't equal the definition one would think to have over the reals, so my guess is a piecewise definition is used to modify the function over the real line. Testing mod[z_, n_, d_] := z ...

9

The following shows a way to emulate the summary boxes using only documented constructs: grid[g_] := Column[Row /@ MapAt[Style[#, Gray] &, g, Table[{i, 1}, {i, Length[g]}]]] MakeBoxes[c : foo[___], form : (StandardForm | TraditionalForm)] := With[{boxes = RowBox[{"foo", "[", ToBoxes[Panel[ OpenerView[ {grid[{{"Something:...

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