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

learn more… | top users | synonyms

8
votes
1answer
85 views

Evaluation leak from Dynamic in Button's action

a = 1; Button["Print", a++] Button["Print", Dynamic[a++]] Button["Print", Dynamic[a++];] Button["Print", {Dynamic[a++]}] Dynamic @ a The second ...
2
votes
2answers
144 views
0
votes
1answer
35 views

Replace argument of delayed function before it evaluates [duplicate]

How should I use replace so that f[x_] := x^2 Replace[f[3], 3 -> 1] OUT = 9 evaluates to 1, instead of 9? This way, the replacement of the argument is done ...
0
votes
1answer
29 views

Forcing evaluation of LinearSolve [on hold]

I have a linear solve function: ls = LinearSolve[MatrixForm[Transpose[basisNScoeffs]]]; Which I then use to generate a table of solutions: ...
1
vote
0answers
33 views

Prevent infinite product from trying to evaluate?

Consider an expression involving several infinite and non-infinite products, like ...
0
votes
1answer
69 views

Mapping over function's several parameters regions [on hold]

About this post: Mapping multiple parameters of a function to specific values I wonder if the parameters a and b have ranges ...
14
votes
2answers
363 views

Shell Emulation inside Mathematica

I am trying to create a Mathematica/shell syntax hybrid. I would like the following command wget -qO- "http://google.com/space line break\"" $var to be ...
3
votes
1answer
453 views

Gâteaux (directional) derivatives and higher order differentials of a functional

I would like to calculate the Gâteaux derivative of a functional (i.e. a function depending on functions). A simple example for the Dirichlet functional: $L(u(x))=\int_0^1 \frac{1}{2} (u'(x))^2 dx$ ...
2
votes
1answer
77 views

Help on order of evaluation within plot function

it is my first time asking a question here so please let me know if there's anything I should be doing that I'm unaware of. I'm sure the answer to my question already exists on the site but I'm having ...
0
votes
0answers
34 views

Creating a non-zeta-ified sum

The expression Sum[i^(-s), {i, 1, ∞}] evaluates to Zeta[s] But, of course, this is not strictly correct as ...
18
votes
2answers
286 views

Understanding evaluation and typesetting

Background So, one could be surprised by the fact that: Hold @ Grid[{{1, 2}}] (*or*) Hold @ Graphics @ Disk[] This issue and methods of prevention are ...
8
votes
2answers
67 views

How do I SetDelayed $Assumptions

For some reason, $Assumptions := (Print["y"]; x > 0) evaluates the RHS immediately. I have code in which $Assumptions ...
0
votes
0answers
41 views

Parallelization and efficiency improvement

Hey i am new to mathematica and at the moment i am writing some test code. It works but it is unrefined. I try to make it more efficient by using parallelization or other techniques. I wanted to ask ...
4
votes
1answer
479 views

Is there a method to send different Cell evaluation to different core?

I am running Mathematica on a computer with multi CPU 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 ...
4
votes
1answer
62 views

Blocking dialog with a blocking child dialog

Suppose I have a DialogInput, in which there is a Button. The Button can trigger another ...
1
vote
1answer
108 views

Evaluate pure function through round brackets

In have some matrices of pure functions or numbers which I multiply by other matrices or vectors. I would like the functions to be evaluated in the result, but all that I get is something like this: ...
0
votes
0answers
21 views

How to make an expression in this case evaluated one step and stop there? [duplicate]

I wonder how to make Symbol@"m" evaluated once so that it becomes a symbol m which is ready to be assigned again. ...
2
votes
1answer
52 views

recursively structuring a multivariate numerical optimization

Suppose that I want to partition the unit interval [0..1] into four subintervals whose max length is as short as possible. I can ask Mathematica to: ...
5
votes
1answer
48 views

Partial evaluation of symbols with non-inert OwnValues

Background: there are many, many questions here about the infamous ::setraw error. More often, than not, they have to do with repeated assignments to symbols. Here's the code: ...
5
votes
1answer
84 views

How can a function without an operator form be used in postfix form?

As an exercise, I was trying to convert the following Clojure code to Mathematica: ...
5
votes
1answer
46 views

How to understand the different output of two UnsetShared?

Update From technical support, Thank you for contacting Wolfram Technical Support. I understand that you are reporting an issue with UnsetShared deleting the shared variable after a second ...
2
votes
1answer
30 views

Delete Cell Inside of Module

I want to print a dynamic output while some code is running and then automatically delete it when when the output is done. PrintTemporary is not quite what I am looking for -- I want the output to be ...
2
votes
3answers
112 views

Strong glitch with Evaluate in Manipulate

I'm experiencing a strong evaluation problem for a Manipulate box and I can't find the best solution yet. Here's a MWE to show the glitch : ...
2
votes
1answer
66 views

Create a notebook and save it without prompting Dynamics

This is closely related to the recent: Creating self destructing notebook. However the answer doesn't work in my case. ...
18
votes
1answer
259 views

What is the difference between Dynamic[x] and Dynamic[ h[x] ] for DynamicModule variables?

Bug introduced in 9.0 or earlier and persisting through 10.4.1 Why plain Dynamic[x] is less sensitive and less likely to automatically be updated than e.g. ...
4
votes
1answer
46 views

Difference between Initialization Cell and Group

Is there a difference between setting a Cell or a Group of cells to be an ...
62
votes
4answers
5k views

Plot draws list of curves in same color when not using Evaluate

This example comes from the Mathematica documentation for Plot under Basic Examples. Can someone please explain why these are each plotted as a different color in ...
0
votes
1answer
65 views

Function Evaluation in Table [closed]

Apologies in advance: this is a really basic question, and I am sure it has been answered, but I don't know enough mathematica to even find the answer. I have a differential equation I want to ...
1
vote
1answer
40 views
0
votes
0answers
29 views

Strange cell evaluation state

I have encountered a strange cell evaluation state (Shown in the image). It seems to be related with unknown variable a. What does this state means ? how it is different from simple error ?
6
votes
0answers
125 views

What is the difference between GenerateDocument and TemplateApply[NotebookTemplate[

Bug introduced in V10.0 and persisting through V10.4 Since V10.3 the bug still remains but additionally the Genarate and ...
2
votes
0answers
45 views

Optimization for iterating and plotting a matrix product and its elements?

I have an iterative matrix product of this type Since i didnt knew how to do it, I explicitly wrote the product as {Ayn + Bxn, Cyn + Dxn} and evaluated it with the NestList construct ...
1
vote
1answer
61 views

Calling functions defined inside Manipulate in other notebook?

I'm creating a notebook with a Manipulate and I'm trying to call/use a function from another notebook (I use Get for that), in ...
1
vote
2answers
82 views

Partial Function Evaluation [closed]

How can I evaluate only part of a stack of function calls? In particular, given f[x_,y_,z_]=x+y+z;, say, I'd like to define a function ...
1
vote
3answers
112 views

Multiple Plots inside a Manipulate with different dynamic variables on their x-axes

I have an expression with lots of variables, and I would like to make several plots of the expression, where the axis in each is a different variable. The idea is to put them side by side inside a ...
2
votes
0answers
53 views

Estimating processing time for commands

I am trying to evaluate some equations by using Taylor series of expansion (Series[], ExpandAll[], and Normal[] command), and using n equation and n unknown (Solve). Following is not full command (if ...
1
vote
1answer
45 views

Notebook Initialization

I am running Mathematica 10.2. I am having trouble automatically initializing a notebook. I realize that there have been several other questions/answers on this topic, but the advice given there ...
10
votes
2answers
266 views

The introduction for Context in Wagner's book is out of date? [duplicate]

In Section 8.1.1 (P230 of the book, P249 of the PDF) of Wagner's book, the following example is shown: x = 5; temp`x = 6; Begin["temp`"]; {x, Global`x} The ...
1
vote
1answer
63 views

How to force evaluation inside the body of a pure function?

For example, I'm writing a function to scale my list of numbers into a specific range. It goes like ...
21
votes
4answers
452 views

Result about Context is inconsistent with the description of “Power Programming with Mathematica”

x = 5; temp`x = 6; Begin["temp`"] {x, Global`x, temp`x} The result in my Mathematica session is {5,5,6}, but it's ...
-1
votes
1answer
58 views

How to plot a function, that is not properly defined in mathematica? [closed]

After rather long and relatively complicated calcuations, I finally got to a point where all my $x(t)$ functions are ...
6
votes
2answers
111 views

What is the Difference Between Rule (->) and RuleDelayed (:>)?

I am new to Mathematica so this question may seem rudimentary. Sorry for that! :) I want to implement the well-known property of Kronecker's Delta $$\Sigma_{i=1}^{n} a_i \delta_{ij}=a_j,\quad 1 \le ...
12
votes
7answers
626 views

How to properly inject iterators into table? [duplicate]

Goofing off on a prior question, I was fiddling with other methods, which led me to the need to inject a constructed set of iterators into a table construct. Now, ...
8
votes
3answers
179 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 ...
6
votes
0answers
67 views

Why Unevaluated doesn't work on unheld side of Rule/RuleDelayed?

Unevaluated is a function that I never truly understand, and here's one of the cases confusing me: ...
8
votes
1answer
146 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. ...
1
vote
1answer
57 views

Convert an evaluated in place code to original

I like "Evaluate In Place," because it hides code and works well. However, I can't figure out how to return to the original code when I want to modify it. I'm sure there is an easy way, but I can't ...
13
votes
3answers
457 views

Handling Kernel quit

One can use $Epilog to do something when the Kernel is quit or put an end.m file next to the ...
0
votes
0answers
43 views

EvaluationMonitor and variables with indices + subscripts

I have encountered the following problem while using EvaluationMonitor with NMinimize: variables that have both a subscript and an index, e.g. Subscript[x,y][1] do ...
0
votes
3answers
207 views

Avoid creation of OwnValues when inserting transformation rules into Experimental`OptimizeExpression

I have a large list of transformation rules that I want to simplify. I find Experimental`OptimizeExpression works as it gets me the answers. My question is: I ...