Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.
2
votes
1answer
106 views
3
votes
1answer
232 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
189 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
119 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
107 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
115 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
70 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:
...
4
votes
1answer
167 views
Behavior of expression evaluation in Plot
I'm confused with Mathematica's way of parsing expressions. I've been struggling with this for a while and never found an exhaustive answer, sometimes things don't parse the way I think they would ...
0
votes
2answers
148 views
How can I get the approximate analytical solution to this simple algebra equation?
Is there a way to get the analytical form to the root of this equation
2 A e (-ArcTanh[smax/s0] + ArcTanh[(smax Cos[w \[Zeta]])/s0]) == F0
...
3
votes
1answer
178 views
Log function - why is Log[b,b] not being evaluated to 1?
Have been experimenting with the Log function to demonstrate simple Log relationships such as Log[xy], Log[x+y] etc.
...
5
votes
1answer
133 views
Strange Behavior with RegionPlot
Consider the following code.
RegionPlot[Print[{x, y}], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 2]
...
5
votes
1answer
96 views
Why does this pattern with Plus not work for numbers?
I have a very simple question about redefining basic built-in functions, such as Plus. I'm pretty sure someone must have asked a similar question around here, but I ...
3
votes
2answers
82 views
UpValues evaluation with Dot operator
I would like to simplify some database notation, and I'm doing some tests with UpValues for that.
For example, if I set this Upvalue fot tab1:
...
0
votes
1answer
164 views
Make Mathematica wait before replacing?
How can I force Mathematica to completely evaluate a subexpression before using a replacement rule?
For example, consider the following definition (for the series of ...
5
votes
1answer
73 views
how to print stack trace when TimeConstrained times out
According to the documentation, TimeConstrained generates an interrupt which interrupts the computation. This interrupt is treated just like an abort, at least in ...
18
votes
2answers
188 views
Evaluation of OptionValue[]
I have a function that takes an OptionsPattern and I want to access several options, say a, and ...
2
votes
1answer
236 views
GraphPlot only working when I evaluate twice
I have some code that builds a graph and some vertex coordinates, but when I evaluate it I get a message that the list of coordinates is not valid and the graph is not valid and it shows the output as ...
11
votes
1answer
320 views
Get the current iteration count
I would like to be able to get the current iteration count, the one that if exceeds $IterationLimit makes the evaluation stop.
After not finding a magical variable ...
0
votes
1answer
102 views
Array of functions, evaluation in plot
I would like to create two arrays of functions yfunc[[i]] and tfunc[[i]], with each entry of those functions being a function ...
8
votes
1answer
95 views
How to catch the “Preemptive” evaluations from within the main loop?
When trying to make an optimized version of my plotRange fonction I faced a problem of catching the "Preemptive" evaluations ...
1
vote
2answers
278 views
Derivative of a spline approximation
To approximate an experimental data function $f(t)$ with $t \in (t_{min},t_{max})$ I used a cubic spline $s(p)=(t(p),f(p))$ with the parameter $p \in (0,1)$ and $p = t/(t_{max}-t_{min})$ by using the ...
4
votes
0answers
47 views
Problem with inequality using refine
I am using inequalities to follow some line of reasoning in Mathematica and I came across a problem I can not explain to myself. Does from a>=0 and b>=0 not follow a+b >= 0? How does Mathematica ...
5
votes
2answers
188 views
Problem with ParametricPlot of multiple Curves
I have written a function f[Ne,t,T], that gives back a list of results when evaluated with numeric values of the variables Ne, ...
0
votes
0answers
46 views
How to ContourPlot a Table? [duplicate]
Possible Duplicate:
Why is ContourPlot not displaying this curve?
Why do I have to put Evaluate[] here
I'm trying to plot certain contours of a function $f:\mathbb R^2\to\mathbb R$.
What I ...
1
vote
2answers
132 views
Why does Evaluate[a[[1]]]=0 assign a value to a variable while a[[1]]=0 doesn't?
I'm trying to do a small page counter with Mathematica, for leting me know about my reading progress on some books. I'm stuck on a problem:
...
2
votes
3answers
121 views
Function to preserve evaluation on display?
I'm looking for a function that applies the following behavior to an expression:
-When the expression is given as the full input, or as part of a function that cannot be evaluated, it remains in ...
4
votes
1answer
139 views
Why does Dynamic output cause CPU usage when onscreen?
I write such a line in Mathematica:
{Slider[Dynamic[s]], Dynamic[f[x_] := s*x]}
After evaluation, the CPU immediately runs at full power. And if you scroll the ...
6
votes
1answer
124 views
PlotStyle does not work when plotting a non-evaluated list of functions
When a list of functions is passed to Plot in an unevaluated form (e.g. with Through), the result is a plot with single color.
...
4
votes
2answers
134 views
9
votes
1answer
68 views
Different behaviour of ValueQ inside and outside of a loop
I need to store a rather big number of variables and I tried to do that by storing each variable as Z[n] with varying n. I guess this was not my best idea. The first problem I encountered is when I ...
0
votes
0answers
96 views
Do Import and Get work asynchronously? Can I prevent this?
I'm getting strange behavior in some of my notebooks that makes it seem like Import and Get load asynchronously. When I evaluate ...
9
votes
1answer
228 views
How can I set a keyboard shortcut to run a command?
I want to use this to add a keyboard shortcut to an undo function I wrote. The basic problem is the following:
I have a command, let's say x=1, and I want to run ...
7
votes
2answers
452 views
How do you force a decimal output? [duplicate]
I have some very small values such as 2.601519253*10^-8. I'd like to output these values to CSV for another program to work with. I've tried N[value, 50], but Mathematica still insists on producing ...
6
votes
0answers
70 views
Return partial result when MemoryConstrained aborts NDSolve
I use NDSolve to solve a large set (~400) of coupled ODEs. Sometimes, the memory (~4GB) gets filled up, and my computer becomes impossible to work with, because it ...
8
votes
1answer
112 views
Get the name of a symbol passed to a function
I'm trying to get the name of a symbol passed to a function with this:
f[x_] := {SymbolName[x], x}
SetAttributes[f, HoldFirst]
x = 5;
f[x]
But ...
7
votes
4answers
157 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}]
...
5
votes
2answers
63 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 ...
4
votes
3answers
166 views
How can I create a custom control which evaluates to a list of values or replacements?
I have a set of variables which are used in various places in my calculations (solving a system, initial conditions, etc.). In order to make this easier to deal with, I want to make a control-like ...
1
vote
1answer
194 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?
2
votes
1answer
151 views
Why can't Mathematica parallelize this?
The following code makes mathematica print "ParallelTable::nopar1: [...] cannot be parallelized; proceeding with sequential evaluation."
...
5
votes
4answers
204 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 (...
8
votes
1answer
100 views
Prevent Plus from threading InterpolatingFunction
For an InterpolatingFunction $y:\ \mathbb{R}\to\mathbb{R}^2$, Plus is unaware of this, so when I do any modifications to it in ...
2
votes
2answers
98 views
Updating a tracked symbol inside Refresh?
I have some code inside a Manipulate, whose goal is to allow the user to edit the upper half of the matrix while keeping it symmetric at all time. The minimal code ...
3
votes
2answers
1k 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 ...
10
votes
2answers
186 views
How can I access a variable in one evaluator from another evaluator?
I have two notebooks, each with a different kernel. Is there a way to grab the value of a variable in KernelA from KernelB?
12
votes
2answers
385 views
Difference between AbsoluteTiming and Timing
I need to evaluate the efficiency of my code. Therefore I would like to evaluate the time the code need for some calculations. Mathematica gives me two possibilities for this kind of evaluation:
...
11
votes
3answers
290 views
Labeling plots without evaluation
This is my first question here so please excuse my mistakes.
Let us consider a rather contrived example:
...
2
votes
1answer
113 views
Implementing a For (?) or series or loop (?) for individual results for every x to n
I'm working on improving a modeling formula and have spreadsheets worth of data to use, but my work so far has been quite tedious. I'm essentially pulling 20 rows of data from each separate sheet of a ...
4
votes
2answers
195 views
How to make a function that evaluates an expression?
I'm trying to make a function where the input is an expression, but somehow it just won't be evaluated. For example, this little function doesn't work:
...





