Tagged Questions

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
122 views

Is it possible to use the global definition of a symbol as part of its new local definition set in a Block?

Consider the following expression: Block[{Print = CopyToClipboard}, doSomething[]] Now all calls to Print from ...
0
votes
0answers
116 views

How to evaluate only arguments, but leave topmost expression unevaluated? [duplicate]

I want to represent expressions mostly in unevaluated form, but being able to evaluate it's subparts. For example, how to evaluate only arguments, but leave topmost expression unevaluated? For ...
0
votes
0answers
125 views

Integrating and plotting pde system solution

I have a trouble with plotting a pde system solution. I'm solving a PDE system in 2-dimensional space and then I want to integrate the solution along one dimension and build a log plot along the ...
4
votes
1answer
115 views

How can I test properties of a symbol without unwanted evaluation

Problem How to get the head, size, dimensions, etc. of a symbol without evaluating it? Since Mathematica does not allocate fix storage space and type to symbols it is not trivial to query runtime ...
1
vote
1answer
2k views

Evaluate an expression at a specific point

In Maple, you right click and can evaluate an expression (whatever it is) at a specific point say: Expr.= abcddafjosjfoj, then right click and simply evaluate at c=-34 say. But how does one do the ...
4
votes
1answer
188 views

Is there a way to force Mathematica 8 to expand $z^{a+b}$ into $z^a z^b$?

The function PowerExpand[z^(a+b)] does not transform $z^{a+b}$ into $z^a z^b$. Is there a way to force Mathematica 8 to expand $z^{a+b}$ into $z^a z^b$? In this ...
11
votes
3answers
744 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 ...
9
votes
1answer
259 views

Performance of Dispatch and lists of Rules

The issue outlined here seems to be no longer present in version 10, if you use a Dispatch table! This because a Dispatch table ...
0
votes
3answers
148 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
219 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 ...
3
votes
2answers
238 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 ...
4
votes
3answers
299 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 ...
37
votes
1answer
945 views

How to compare power towers in Mathematica?

First I tried it directly, but it overflowed: ...
1
vote
2answers
107 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
172 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
138 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
204 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 ...
14
votes
3answers
465 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 ...
5
votes
1answer
105 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 ...
7
votes
2answers
204 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
381 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
111 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 ...
4
votes
1answer
201 views

Manipulate a Plot that contains a variable that contains symbol [duplicate]

This snippet mm = m Manipulate[{mm, Plot[mm x, {x, 0, 1}]}, {m, 0, 1}] (m is not defined anywhere) produces a sadly fixed ...
6
votes
2answers
271 views

Why is CityData[All, “Coordinates”] failing?

When I evaluate CityData[All, "Coordinates"] Mathematica returns {Missing["NotAvailable"], Missing["NotAvailable"]} ...
0
votes
2answers
122 views

Symbolic evaluation fails because it exceeds $RecursionLimit

I am trying to perform a simple arithmetic in complex algebra. ...
5
votes
2answers
228 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
743 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 ...
4
votes
2answers
753 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 ...
4
votes
3answers
482 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: ...
3
votes
3answers
202 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 ...
3
votes
0answers
66 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
132 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
138 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 ...
10
votes
4answers
324 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 ...
0
votes
0answers
37 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
54 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
182 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
1answer
270 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
135 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
208 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 ...
6
votes
3answers
751 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
96 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
376 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
265 views

Evaluate Numerator and Denominator Separately

I have this function. ...
5
votes
1answer
542 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
368 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: ...
5
votes
1answer
258 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
110 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) ...
16
votes
1answer
235 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 ...