# Tag Info

0

Adding this as an answer since it's too long for a comment. m_goldberg suggests that all pairs must be compared but that's not the full story, consider In[1]:= a == 2 == 3 (* Expect False *) Out[1]= a == 2 == 3 In[2]:= 2 == 3 == a Out[2]= False Doing some experiments it appears that all pairs of arguments are compared in lexicographic order; if two ...

2

It's all explained in the Documentation Center. Equal Subscript[e, 1] == Subscript[e, 2] == Subscript[e, 3] gives True if all the Subscript[e, i] are equal. LessEqual Subscript[x, 1] <= Subscript[x, 2] <= Subscript[x, 3] yields True if the Subscript[x, i] form a nondecreasing sequence. That is, the three arguments in Equal must be equal ...

4

Probably you should use NotebookEvaluate instead of SelectionEvaluate. According to the Documentation, By default, NotebookEvaluate evaluates the cells of a notebook in the same way that Get evaluates the lines of a package file. For example try: nb = CreateDocument[ExpressionCell[Defer[Pause[10]], "Input"]]; NotebookEvaluate[nb] Print["!"] The ...

1

A useful principle in using the Wolfram Language: Remove values you assign to variables as soon as you finish using them. See Defining Variables. How to Work with Variables and Functions Variables and functions are integral to the Wolfram Language's symbolic programming language. These "How tos" give step-by-step instructions for common tasks related to ...

13

Nothing is like Sequence[]: it gets removed during evaluation. But there is one significant difference: it only gets removed from lists. {{Nothing}, {Sequence[]}} (* {{}, {}} *) {foo[Nothing], foo[Sequence[]]} (* {foo[Nothing], foo[]} *) Update from @ilian It only gets removed from lists is correct for Mathematica 10.4.0 and later; Nothing did get ...

-2

Nothing is a function... Association[If[True,Nothing[]]] ...You need the [] after or you're just using the symbol Nothing, not calling it.

4

tl;dr You need to call Needs before GetBoundaryMesh definition so it can be parsed (found in correct context) correctly or you have to use the full name of ToBoundaryMesh. Relevant part of documentation from SettingUpWolframLanguagePackages Executing a function like Begin which manipulates contexts changes the way that the Wolfram Language ...

6

It's not a bug and it's not so uncommon. For an explanation have a look here. This and some related issues also appear in this MathGroup thread. Also relevant: 1 2.

3

They are not identical computations. With the first form, (mu/2 gt).gt Mathematica can take advantage of vector arithmetic, usually going through specialized routines like LAPACK. The second form, Sum[(mu[[i]]/2 gt[[i]]) gt[[i]], {i, Length@mu}] however, will usually be calculated term by term because there is a possibility that the input can change ...

3

Fundamentally this is a very common question: Reassign values to symbols How do you programatically load data into symbols? How to pass a symbol name to a function with any of the Hold attributes? MapThread gives different results from ToExpression when trying to assign variables from a list Assigning values to a list of variable names Elegant ...

2

Do you mean: ClearAll[A] Attributes@A = HoldAll; A[f[n_]] := A[f[n]] = Module[{d}, d = Numerator@f[n - 1]] I've removed the redundant Return. Module is also irrelevant here actually. Anyway, I suppose you need Module in your real problem so don't take it away. Or you need f to be arbitrary, too? Then: ClearAll[A] Attributes@A = HoldAll; A[f_[n_]] := A[f[...

5

You can use Trace with TraceDepth option set to 1 to get evaluation steps giving whole expression, and format result as you want it. Function performing this actions can be assigned to $Pre to be automatically used for all inputs. ClearAll[showSetSteps] SetAttributes[showSetSteps, HoldAllComplete] showSetSteps[Set[lhs_, rhs_]] := With[{trace = Replace[... 5 Actually the observed behavior is in full accord with the HoldAll attribute, just check what happens when there is no such attribute: nIntegrate[x + x, {x, 1, 2}] // Trace {{x + x, 2 x}, nIntegrate[2 x, {x, 1, 2}]} From the above it is seen that the arguments are evaluated before applying the rules associated with the function nIntegrate. The purpose ... 5 From the "Details and Options" section in the docs: NIntegrate first localizes the values of all variables, then evaluates f with the variables being symbolic, and then repeatedly evaluates the result numerically. So I guess this is expected behavior. 0 The bug is confirmed and a workaround is available in the linked topic. Nothing to do here now so I will move the code part of the question to this wiki answer to remove it from an unanswered stack and make a terse list on top. Code samples to reproduce specific values of$EvaluationEnvironment: "WebEvaluation" CloudEvaluate[\$EvaluationEnvironment] "...

1

With ver 10.4.1, I am unable to evaluate dNdz[0, 12] using the code provided in the question, instead getting the error message, NIntegrate::inumr: The integrand ddndLogMdz[0,var] has evaluated to non-numerical values for all sampling points in the region with boundaries {{12,20}}. >> This occurs because the derivatives of delta and Sigma are undefined....

4

This was introduced in 10.0 and fixed in 10.3. curve1 = {Cos[φ] (4. - 1. Cos[4 φ] + 1. Cos[8 φ] - 1. Cos[12 φ]), (4. - 1. Cos[4 φ] + 1. Cos[8 φ] - 1. Cos[12 φ]) Sin[φ]}; curve2 = 2. - 1. Cos[4 φ]; tangent1 = D[curve1, φ]; surface = {{Cos[3 z], Sin[3 z], 0}, {-Sin[3 z], Cos[3 z], 0}, {0, 0, 1}}.Append[(1 - Sqrt[1 - Abs[z]]) (...

1

This isn't a very satisfactory answer, but it turns out that this exact same code works on version 10.4.0 for Linux x86 (64-bit) (February 26, 2016) on the same OS and laptop, and as @JHM points out it works on a Windows machine, therefore I suspect this might be a version+OS specific bug. In any case, my problem is solved.

4

Since you referenced How do I evaluate only one step of an expression? I might use: (* step loaded from referenced Q&A *) mySet[str_String, val_] := step @ Symbol[str] /. _[s_Symbol] :> (s = val) Now: x = 5; mySet["x", 7]; x 7 (This also makes use of Injecting a sequence of expressions into a held expression.) For clarity the above is ...

Top 50 recent answers are included