Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.
5
votes
0answers
75 views
Every second evaluation in notebook front end is slow
I'm having a rather baffling problem that Wolfram was unable to help me diagnose, and I'm hoping one of you geniuses in residence here can figure it out. (I don't get access to the Technical Support ...
7
votes
1answer
81 views
Performance of Dispatch and lists of Rules
First of all, I have seen the question "Why is this parallel evaluation with Dispatch[] so slow?", but that seems to be a different matter.
My question arose when I tried to answer this question by ...
0
votes
3answers
67 views
Evaluation in Manipulate [duplicate]
I have an expression assigned to a variable. For example:
exp1 = a*x+b
Now I would like to plot it using something like this
...
5
votes
3answers
101 views
Applying a function with the HoldAll attribute inside NestList
I'm trying to write an update function, which can be applied to a list and then to NestList it.
As the function has to manipulate the given variable I figured I ...
1
vote
2answers
68 views
Overloading conjugate operator for a particular function
I trying to modify the behaviour of the built-in Conjugate[] operator on a particular function I have defined, to take into account that some of its variables are real.
...
4
votes
4answers
165 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 ...
0
votes
1answer
68 views
0
votes
0answers
62 views
28
votes
1answer
490 views
0
votes
2answers
54 views
Automatically evaluating related cells
I have the cells:
In[1]:= l = 2 + 2;
In[2]:= l >= 5
After evaluating them:
Out[2]:= False
Is there a way to evaluate ...
1
vote
1answer
118 views
Confused about Unevaluated
Why does
Map[Unevaluated, Table[PauliMatrix[i], {i, 1, 3}]
give
{Unevaluated[{{0, 1}, {1, 0}}], Unevaluated[{{0, -I}, {I, 0}}], Unevaluated[{{1, 0}, {0, ...
1
vote
1answer
98 views
direct assignment to the element in a Table
I have already asked a related question here why set values in this way doesn't work?
But I think I have to write the question which I encountered explicitly?
...
2
votes
2answers
83 views
Evaluating Polynomials at Grid Points
I am continuing my quest on B-splines. The code below builds a 5x5 matrix out of B-splines, using the BSplineBasis[] routine.
I now want to evaluate the polynomials that are stored in each matrix ...
10
votes
3answers
217 views
Comparing Mathematica expressions like diff
I am looking for a way to compare (or "diff") two Mathematica expressions, similarly to how to diff utility can compare two text files and report the differences.
Has anyone already written such a ...
0
votes
0answers
128 views
A SetDelayed issue [closed]
I get
General::ivar: "-Cos[[Pi]/52] is not a valid variable.
when I call the function below
...
5
votes
1answer
90 views
“And” to continue evaluation after “False”
Below, is it possible to print No and have x be 2. That is, I'm looking for an And-like function that looks at all arguments ...
4
votes
2answers
175 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 ...
4
votes
3answers
293 views
Why the difference?
When I do the double sum using the sigma notation I get
$$1 + \sum_{n=0}^{\infty}\sum_{k = n}^{\infty} \frac{1}{(k+2)k!}$$
$1 + e - \cosh[1]$
When I do the sums as below, I get the expected ...
0
votes
1answer
63 views
Can I force a function to quit and return some value after a certain amount of time has passed during its evaluation?
Imagine I provide some random input to function like FindInstance[], and I observe that, despite the existence of good solutions, the function will, with some ...
3
votes
1answer
99 views
Manipulate a Plot that contains a variable that contains symbol
This snippet
mm = m
Manipulate[{mm, Plot[mm x, {x, 0, 1}]}, {m, 0, 1}]
(m is not defined anywhere) produces a sadly fixed ...
4
votes
2answers
138 views
Why is CityData[All, “Coordinates”] failing?
When I evaluate
CityData[All, "Coordinates"]`
Mathematica returns
{Missing["NotAvailable"], Missing["NotAvailable"]}`
but when I evaluate ...
0
votes
2answers
72 views
Symbolic evaluation fails because it exceeds $RecursionLimit
I am trying to perform a simple arithmetic in complex algebra.
...
5
votes
2answers
144 views
Graph does not evaluate some options when not displayed
How can I force Graph to evaluate all its options without actually displaying the graph itself?
Evaluating the following code ignores the ...
0
votes
4answers
114 views
Specify a variable as an integer
I have a formula that always evaluates to a certain number for any variable X under one condition that X is an integer and ...
2
votes
2answers
93 views
How do you configure Mathematica 9 to automatically evaluate all notebooks?
I have a Mathematica 6 course that I am using in Mathematica 9; there is no updated version. Every time I open a notebook I have to go to the Evaluation menu and click on "Evaluate Notebook". Is there ...
1
vote
2answers
63 views
Prevent Mathematica to automatically evaluate Manipulate at start
I'm using an initialization cell to import a lot of data:
data = Import[myFiles];
and then I use a custom function to display this data with Manipulate:
...
2
votes
3answers
115 views
Alternative to using global variables in functions?
Often times I find myself using unevaluated variables (i.e. they show up blue) as dummy variables in whatever I'm returning such that I can evaluate them as needed later on.
A simple example is as ...
2
votes
0answers
42 views
Non-preemptive evaluation of a dynamic function? [duplicate]
I want to monitor a long calculation that is triggered by the release of a Slider. While one can indicate running calculations when the main evaluation loop is ...
2
votes
2answers
101 views
How to make Mathematica returns the exact expression I typed
I'm using Mathematica to compare some constants. Before playing around with those constants, I would like to check that I didn't make any mistake in typing them. So my question is the following: "What ...
1
vote
1answer
90 views
Evaluate code to some point
How can I evaluate my code, up to some point? I don't want to evaluate all of my code always.
I have to use Shift - Enter for every line from the first cell up to the point I want to be, and it's not ...
8
votes
4answers
135 views
How to pass a list of arguments into HoldAll
I have a list of arguments (which in reality is lengthy):
arguments = {a, b, c}
arguments2 = {a_, b_, c_}
f[Sequence@@arguments2] := a + b + c
Note: It seems ...
4
votes
4answers
203 views
Efficiently finding the positions of a large list of targets in another, even larger list
I have a big list. It contains nearly 60,000 sub-lists. It's structured like
bigList= {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3},.....,{x60000,y60000,z60000}};
...
0
votes
0answers
19 views
Define a Plot3D function with custom options [duplicate]
I am trying to define a Plot3D function with custom options, following (this previous SE question), but I'm running into a brick wall. I've narrowed the problem to the following 'toy' code:
...
1
vote
0answers
39 views
Confusing efficiency and evaluation when returning pure functions? [duplicate]
I have a function that takes some time to evaluate, that's meant to be a polynomial approximation to a function. The polynomial is defined by a list of coefficients, so I have the function ...
10
votes
4answers
149 views
How do I evaluate the terms in an expression, but not the expression itself?
I am trying to write a set of homework questions.
I would like the output to evaluate the constants but not the sum, so that I may present the homework question as something like this:
...
0
votes
0answers
29 views
Finding solutions based on set criteria [duplicate]
If anyone would be so kind, I'm wondering if I could get a basic direction in Mathematica to begin coding a method for taking a set of resources (numbers and operators) along with a set goal/answer, ...
0
votes
1answer
83 views
NumericQ prevents evaluation at a numerical value sometimes
I set up a symbolic integral, to be evaluated only when some of the symbols have been replaced by numbers. The evaluation after assigning numbers to the symbols is still symbolic for some reason. The ...
4
votes
1answer
94 views
Identical code, different answers?
I'm having some trouble with identical code giving different answers. On a fresh kernel (MM 9.0.0.0, Windows 64-bit), running the same code, copy-paste, gives two different answers:
...
0
votes
1answer
85 views
Why won't ContourPlot accept a variable argument? [duplicate]
I have a list of linear inequalities which describe a (polygonal) region. I can use RegionPlot to visualize this region; but I'd also like to overlay this plot with ...
4
votes
3answers
138 views
Keep function range as a variable
Plot[2*x^2 - x + 2, {x, -1, 1}] plots a function of x from -1 to 1. As far as I can see, I cannot "save" this range in a variable:
...
3
votes
1answer
54 views
Stop TradtionalForm evaluating expression
I'm trying to get this expression to display as typed instead of evaluating the 1/1.121.
...
1
vote
1answer
99 views
Forcing evaluation of ArgMax
How to force evaluation of ArgMax before its output gets used in Solve?
Background: I'm trying to solve for the Nash ...
2
votes
1answer
98 views
3
votes
1answer
226 views
How is the Mathematica kernel structured internally, and how does evaluation work?
There is so much information available for Java--the internal details of (for example) the JVM memory manager are well-documented, and the performance considerations arising from its interaction with ...
3
votes
0answers
179 views
A is fast, B is fast, but together they're Mathematica-crashing slow?
I'm trying to do something with finding solutions to a quantum mechanics problem with n wells. If there are 40 wells, I need to find the solution to an equation in the form:
...
4
votes
1answer
106 views
Evaluation order control
This question is related to Evaluation order of Button[]'s action
Concusion was, Button[]'s actions are evaluated in preemptive link so "the code that needs ...
2
votes
0answers
89 views
Strange double evaluation using MorphologicalGraph
(MMA 9.0.0 on Mac OS/X 10.8)
Please consider the following snippet (this is as SMALL as I could make it -- my attempts at making a smaller repro-case eliminated the effect that I am investigating)
...
12
votes
1answer
104 views
Exclude Sections/Subsections/… from evaluation
I'm working on a large notebook and I want to exclude some sections and subsections from being evaluated when I evaluate the whole notebook.
Is there a way to exclude specific sections or ...
1
vote
1answer
105 views
Summation of If statements
The following made me curious. Suppose you want to sum the if statement If[x[i] < 1., x[i]^2, 0.] over i=1,2, i.e.
...
3
votes
1answer
69 views
Evaluation order of Button[]'s action
it looks like it should be well known issue but I haven't found answer anywhere.
Please tell me why the result (after clicking) of this:
...

