# Tagged Questions

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

242 views

### Graphics in Notebook Different from Graphics Expression?

Consider the expression TreeForm[a+b^2+c^3+d] which displays as This is a nice Graphics object, as I can prove by typing ...
429 views

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

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

### Expand series unevaluated

I'm newbie in Mathematica. I'd like to obtain nice and verbose output for any series calculation. For example, given a simple sequence n*(-1)^(n-1) and ...
1k 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 -- ...
210 views

### Keywords to find documentation for this syntax

Mathematica allows this syntax, but I cannot find any documentation (or books) that discuss the various uses/advantages of it ...
175 views

### With/Function(/etc) replacement behaviour

Can anyone explain to me this behaviour? I've been having more than a couple of similar doubts these last weeks. For example f[_?NumericQ] := 8; Now, if I do <...
306 views

### Difference between Evaluation>>Quit Kernel and Quit[]

What is the difference between Evaluation >> QuitKernel and Quit[]? Both seem to quit the kernel (and clearing all ...
199 views

### Obtain input expression from history without evaluating

I typed and evaluated an expression, but deleted it from the notebook. For instance, suppose it was In[1]:= Round@SessionTime[] Out[1]= 2 I now want to retrieve ...
145 views

### Automatically scroll along with currently evaluating cell?

If I'm evaluating an entire large notebook, I usually just press Alt-V Y to find the currently evaluating cell. Is there a way to keep the currently evaluating cell automatically in focus so that the ...
2k views

### Prevent Part[] from trying to extract parts of symbolic expressions

If you have a list, e.g. {1, 2, 3} then you can extract the $k$th part using Part (...
358 views

### Unexpected behavior of Unevaluated

Maybe it is about time I read some proper text about the main loop. Maybe I should not care (so much) about Unevaluated (as Leonid suggests). But I think this is an interesting question anyway. This ...
614 views

### Exporting held expressions through JSON

Trying to round-trip expressions through JSON, I'm getting unexpected errors for held expressions, and would be grateful for advice or clues. Consider, first, something that works well ...
221 views

### Trouble with polynomial multiplication

Bug introduced in 10.1.0 and fixed in 10.4.0 ...
392 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}]; ...
811 views

### Mathematica rule substitution memory

First I present the specific programming question, and then I provide further background details. Given an expression in Mathematica, say f=3x+7y, there are two ...
228 views

### How do I write a ValueQ function that only returns True if there exists an OwnValue?

Reading the comments in this answer has motivated me to request a full solution to part of this problem. What I'd like is an efficient solution that returns True ...
70 views

### How do I SetDelayed $Assumptions For some reason,$Assumptions := (Print["y"]; x > 0) evaluates the RHS immediately. I have code in which $Assumptions ... 1answer 148 views ### Why one needs two Unevaluated to show 1+1 correctly in TreeForm? The task sounds simple, give the tree plot of 1+1. However, after some trying, I can only make this possible by using two Unevaluated. ... 1answer 435 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 ... 1answer 192 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 following:... 1answer 926 views ### Creating self destructing notebook Inspired by this post I've been trying to implement the idea in Wolfram with no success yet. I've come pretty close though and need some help. So I've managed to do this: ... 1answer 821 views ### How to properly DumpSave & Get Globals symbols inside packages while not touching Global context? For efficiency reasons I prefer to use DumpSave instead of Save. For ease of access I prefer to save symbols in ... 1answer 223 views ### Difficulty catching thrown errors in asynchronous tasks In this Question, Leonid explained that module variables can get garbage collected from a chain of asynchronous tasks unless their Temporary attribute is cleared ... 1answer 158 views ### Is it possible to write a function immune to symbol redefinitions in any Block surrounding its invocation? Normally, semantics of symbols used in a function definition can be changed by their redefinitions in Blocks surrounding the function invocation: ... 6answers 215 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 ... 4answers 271 views ### Button's command is not evaluated in iteration I wish I didn't feel like a newbie after several months, but... If I enter the following: Table[ Button[ "Number: " <> ToString @ i, Print @ i], {i, 1, 5}] ... 2answers 1k views ### Nothing appears in simple plot I'm trying to get the following simple code to work. (The code is just supposed to graph the norm of the second derivative of a vector function). ... 3answers 258 views ### Why does Mathematica not seem to know that$i^x$cannot be equal to$0$? I am experiencing a curious behaviour of Simplify when handling expressions involving powers of$\mathbf{i}$, such as$\mathbf{i}^x$where$x$is unknown. For ... 4answers 154 views ### How to map Unevaluated over a list I have a list {a1, a2, ...... , an}, in which all as have been initialized to a number. I want to get: ... 2answers 257 views ### Evaluation in lambda function If I have a function, that returns a function, for example: f[a_] := a^2 * # & then f[3] == 3^2 # & Is there a way ... 2answers 213 views ### Is there a way to show the details of a numerical computation? I have recently started using Mathematica as a calculator while teaching (definitely overkill, but I try to use as few tools as possible). I would like my students to be able to trace simple numerical ... 2answers 9k views ### Simple ways to evaluate a derivative at a point? The contrast in behavior between, say, f[x_] = Sin[x^2]; f'[2] vs. u[x_, y_] = Cos[x + y^2]; has always bothered my ... 2answers 196 views ### “A number in base b” and pure functions: why doesn't b^^# & work? Why do the following not work (in Mathematica 7)? 2^^ # & /@ {1000, 1101} and 2^^ # & @ 1101 This does work: <... 4answers 554 views ### Attaching persistent assumptions to symbol definition Is it possible to attach assumptions to a symbol? This relates to this question. Most of my work involves physical equations, i.e. there are basic assumptions on variables that will always hold true (... 2answers 151 views ### Evaluation inside Inactivate The documentation for Inactivate makes the function sound really powerful because it gives granular control over which kind of expressions specifically not to ... 2answers 237 views ### How to correct this, f[a_] := FindRoot[eq == 0, {x, 0.5}], where eq contains a parameter$a$, without using eq[a]`? I want to solve an equation with a parameter$a$, and define the result as a function of$a$. It is something like this: ... 3answers 144 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 ... 2answers 110 views ### Cannot Block Plus It is customary to use the following idiom to partially evaluate something inside a held expression: ... 1answer 426 views ### Debugging a$RecursionLimit error?

I sometimes encounter bugs that involve a recursion limit. It's often very hard to find the origin of the problem. Would there be a way to copy the stack somewhere and abort the evaluation in order ...
1k views

### Possible to evaluate only selected cells?

Is it possible to evaluate only the selected cells programmatically that I am interested in? Say in current cell to bottom of the notebook, instead of evaluate notebook or cells?
281 views

### Module variable scoping in Scheduled Tasks?

I ran across a scoping puzzle while experimenting with ScheduledTasks, and I'd be grateful for an explanation from the sages here. I found a workaround by intuitive horse sense, but was unable to ...
539 views

### Changing the plot variable inside Plot [duplicate]

Possible Duplicate: Difference in Plot when using Evaluate vs when not using Evaluate Assume one has vector of functions (e.g., vec={x,x^2}). The command <...
140 views

### Inserting symbols' definitions during read time of the code

Let's say we've got a package: ...
130 views

### Unevaluated @ {args} versus Unevaluated /@ {args}

Working my way through Robby Villegas's lovely notes on withholding evaluation, I almost got Polish Notation on my first try. Here is my final solution, which seems to work well enough: ...
319 views

### How is LHS = RHS; … ; LHS (nontrivially) different from … ; RHS

I'm trying to understand how Mathematica thinks about the results of Set. Suppose we perform LHS = RHS. I'm focusing on when ...
88 views

297 views

### NMinimize with NIntegrate (crash in symbolic evaluation, memory leak)

This is a "common" problem from what I've seen, but with a different spin. I have a function I use often that finds a fit of an expression to another expression with some free parameters (e.g. for ...
82 views

### Kernel randomly aborting

Bug introduced in 10.0 and fixed in 10.3 So after 2 days of trying to figure out what's going on, I figure I should post here as I don't have enough knowledge about the Mathematica evaluation ...