# Tagged Questions

Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.

235 views

### Selective evaluation of blocks of code in a Manipulate

Is it possible to attach certain pieces of code to certain controls in a Manipulate? For example, consider the following Manipulate ...
2k views

### Keyboard shortcut to evaluate notebook

(If this is entirely trivial, although I couldn't find an answer as much as I searched the archives, I will delete the question.) How could I add a keyboard shortcut to evaluate the entire notebook ...
349 views

### Very different results from evaluating same expression with different precisions

When I evalute the following expression, ...
135 views

### How to stop a single function to be evaluated?

See this example: AA = {x} \[Function] Normalize[x] BB = {x} \[Function] Evaluate[AA[x]*5] I need BB to be Normalize[x]*5. Some context:I call evaluate because ...
150 views

### Order of evaluation in nested expression

I am trying to make a function that works as follows: Integrate 1 for all t in the interval $[0,1]$ such that the first element of function vstar is positive. ...
86 views

### CreateDocument using a specific Evaluator (Kernel) [closed]

I am trying to build a button to create a new document that contains a dynamicaly changing table. In the parent notebook I am using another kernel -- not the usual "Local". The problem is that in ...
404 views

### Prevent graphics render inside held expression

Assuming each odd line is input I would like the even lines to be the output of the following lines. In the above the Graphics are inside ...
901 views

### Obtaining the name of a variable as a string [duplicate]

Suppose that I have an arbitrary variable myVariable. Is there some function fun -- either built-in or one that I can define -- ...
415 views

### Is it possible to use RandomChoice to choose without other choices being evaluated?

I'm trying to do this: i1 = 1; i2 = 1; RandomChoice[{ (i1 = i1 + 1), (i1 = i1 - 1), (i2 = i1 + 1), (i2 = i2 - 1)}] In order to chose randomly which ...
212 views

### How to join held Lists?

Let's say I have a = Hold@{2+2} b = Hold@{4+4} How can I get Hold@{2+2,4+4} ie join the two held lists ? More ...
58 views

### Label cell goes away with SelectionEvaluate

When a given cell has a label (given with the CellLabel->"label" option of the cell), then this label disappears after calling SelectionEvaluate[ nb ] when the ...
270 views

### Manipulate executes expressions multiple times

I am using Manipulate for a rather intricate front end for data visualization. I was getting very sluggish performance and was able to boil the problem down to a ...
221 views

### How to get Cases to wrap results in an arbitrary head?

A number of functions provide for results to be wrapped in an arbitrary head. This is very important in cases where the results should not be evaluated. Take ...
281 views

### Dynamic [ NotebookEvaluate [“_”] ]

A nice way to centralize various tasks in one notebook is the NotebookEvaluation function. For instance I can evaluate ten notebooks from a single notebook (e.g. ...
514 views

### Select sublists with second element nearest to zero

I've got some big lists from which i need some data (one of the big lists). To be specific, I need to divide this biglists in sublists of the same length (10000), and form a new list with the mean of ...
351 views

### How to force an evaluation to use only one core?

There are some evaluations which are automatically parallelized or multithread if there are cores available.( for example, Eigenvalues) But I don't want the ...
249 views

### Why is building a table of function values so much slower than just plotting the function?

Here is a function that take some time to evaluate: n = 1000; coeffs = RandomVariate[NormalDistribution[], n]; f[x_] := Sum[coeffs[[k]] Sin[k x]/k, {k, 1, n}]; ...
149 views

### Reuse local variable in declaration within With [duplicate]

Considering the richness of Mathematica.SE, I am quite surprised I could not find my answer... I am very sorry if it is a duplicate. Consider the following example: ...
452 views

### Use output of NDSolve as an integration limit of NIntegrate

I've been working on a ODE, for a function y[t], that, due to it's complexity, has to be solved numerically. I then need to use the results of NDSolve, which I ...
338 views

### is there a method to send different cell evaluation to different core

I am running Mathematica on a computer with mulicpu and every cpu has multicore. I am wondering if there exist a method to send different cell evaluation to different core? So if I already have a ...
89 views

### Assign variables from list inside With or Module

I have found that it is possible to assign variables from lists, as follows. In[1]:= r = {1, 2, 3}; In[2]:= {a, b, c} = r; In[3]:= b Out[3]= 2 However, if I try ...
855 views

### Can graph interpolating function, but not use it. Any thoughts?

When solving a system of differential equations numerically, I get two interpolating functions. I can graph both of these, but when I try to evaluate either of the functions at a point, it just spits ...
173 views

### Understanding output of multivariable integration

I'm new to Mathematica and I'm trying to integrate this function: ...
186 views

### HoldForm: how does it interact with nested evaluations?

Here's an example to illustrate the issue I'm having. right = 8 - y; left = y^2 + 6; integrand = HoldForm[Evaluate[right]] - HoldForm[Evaluate[left]] (I ...
5k views

### Step-by-step definite integration

I am interested in obtaining the intermediate steps for rather straightforward symbolic definite integrations (e.g., from an elementary calculus text). As an example, for $\int_0^1 x\,dx$ I'd like ...
841 views

### How can I save the current evaluation state of a notebook and start from it later?

I currently have a nested Table command running (in Mathematica 9), with two progress bars to track the variables. I have to shut down or hibernate the computer in ...
63 views

### Get the unevaluated expression from a numbered cell

If a cell exists as below: In[1] := (xyPoints = {{1,2},{2,5},{3,10}}; ListLinePlot[xyPoints]) Is it possible to get at the expression rather than the plot shown ...
226 views

### Pattern matching on Orderless functions inside Hold

MatchQ[Hold[1 + 2], Hold[2 + 1]] returns False. But in the presence of a Blank[] in the ...
159 views

### Force Dispatch to generate dispatch tables

Dispatch creates hash tables only for lists of length larger than 3. Is there any way to force MMA to create hash tables even for lists of length smaller than 4? ...
391 views

### Pull Constants outside of integrals

I would like Mathematica to pull constants outside of an integral: e.g., $\int_0^t f[t] g[s] dt \to g[s] \int_0^t f[t] dt$ This has previously been discussed at replacement rule to pull independent ...
279 views

### While loop doing cell evaluation not completing

I am trying to get a loop structure using While to repeatedly evaluate another cell referred to in its body (using a cell tag). ...
135 views

### NotebookWrite undo

Is there way to make NotebookWrites undooable? For example let's say I open a new notebook and then run. ...
1k views

### The underlying process of Integrate[] [duplicate]

Integrate[x^4 E^-x^2, {x, 0, +∞}] Output: (3 Sqrt[π])/8 Can someone explain to me the specific calculation process ?
132 views

### Evaluation of elements in a list and then sorting them

This is probably a simple problem, but I'm having a lot of issues with it because I'm unfamiliar with Mathematica syntax. I have a list ...
180 views

### The Flat Attribute, Unevaluated and the Evaluation Process

To make this question easy to follow let's give some symbols a couple attributes. Attributes[f] = {Flat}; Attributes[s] = {Orderless}; Now consider the ...
437 views

### What is the real default CellEvaluationFunction?

The default CellEvaluationFunction is Identity but one can quickly see that this is handled specially as an equivalent function, ...
144 views

### Equivalent of __FILE__?

Many languages define a special identifier whose value is the path to the source file currently being processed. (For example, in C, this is done through the ...
327 views

### Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
232 views

### How can I speed up this plot manipulation? Why does Evaluate not help?

If I were able to "Save" the computed inverse function somewhere and then plot it, the manipulation would become faster. As I understand, Evaluate should do the job, but for some reason it does not. ...
122 views

I'm completely puzzled by the following codes: Clear[func, f] a = x^2 + z; func[k_] := Block[{f}, (f[x_] := Evaluate[(a /. {z -> k})]; f[1])] func[2] ...
247 views

### Expectation function does evaluate my expression

I am trying to evaluate the expression Expectation[(B x (-6 b + 12 a n0 + B x + B^2 x^2))/(2 (6 a + B x + B^2 x^2)), Distributed[x, BetaDistribution[α, β]]] ...
416 views

### How to tell Mathematica not to simplify an expression

While there is this question with a very similar title, it does not answer my question, which is: I have part of an input, in my case Re[Exp[I*x]] which ...
240 views

### TimeConstrained dynamic change of maximum time

I would like to run a time consuming function: TimeConstrained[f[x],maxseconds] and be able to change maxseconds during running (increasing or decreasing max ...
357 views

Is it possible to have an expression x such that its elements are only evaluated when they are individually accessed, for example when evaluating statements like ...
115 views

### Choosing an initializer list in With

I'm trying to have several initializer lists in a With function and choose which one I want to use. So far I have this: ...
1k views

### What do the hashtags represent in the result of Solve, and how should I use them? [duplicate]

There is a function that I'm trying to get the inverse of. My function is a simple polynomial: Tn[T_] := 4/9 T^3/Tc^2 + 5/9 T Now I tried to find ...
123 views

### Are there any videos that show how different Mathematica expressions are evaluated?

Are there any videos that show how different Mathematica expressions are represented internally as object graphs and demonstrate how they are transformed during an evaluation? I am asking because I ...
295 views

### Why doesn't Mathematica evaluate this limit?

I am trying to evaluate a few limits in Mathematica, and I can only get it to evaluate them in certain cases. I don't fully understand the evaluation order and when it substitutes numerical values in ...