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

learn more… | top users | synonyms

13
votes
5answers
952 views

How are parameters evaluated for a Plot in Manipulate

I am trying to get my head around how Manipulate evaluates functions in a Plot. I have read the introduction to Manipulate, and introduction to Dynamic, but I still ...
11
votes
3answers
4k views

General::ivar is not a valid variable when plotting - what actually causes this and how to avoid it?

I was just evaluating a couple of expressions and started to get errors like this: ...
51
votes
4answers
3k 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 ...
2
votes
1answer
83 views

Nested If statement with unevaluated arguments

I have a list of boolean functions {f1, f2, f3, ...} that take a value and return True or ...
-1
votes
1answer
86 views

Recursion depth of 1024 exceeded during evaluation [closed]

This is my very first day using Mathematica, so please forgive me my complete ignorance... I fear that this might be one of those questions that gets rejected for being "easily found in the ...
1
vote
2answers
56 views

Coordinates of MeshPoints

The output of a set of differential equations solved with NDSolve produces a series of curves and I need to obtain the spacing between these curves at a given level ...
2
votes
2answers
66 views

How to apply list of values to a list of functions

I have the following: first= {1+a,2+a,3+a,4+a} and a list t={0,1,2,3} I want to evaluate the first element of "first" at ...
2
votes
1answer
83 views

Block assignments not quite sequential?

With scalars, Block acts like Scheme's let*, that is, the assignments (appear to) happen sequentially: ...
7
votes
2answers
144 views

How to track Part of Symbol or How to symbolize Parts of Symbol without copying data

Let's create simple function: SetAttributes[h, HoldFirst]; h[data_] := Dynamic[Grid[data], TrackedSymbols :> {data}] test = RandomReal[1, {2, 2}]; h[test] ...
0
votes
2answers
38 views

Parallel evaluation hangs before doing anything

[I use Mathematica 9.0.1.0 on OS X Yosemite 10.10.2.] I am experiencing difficulty with parallel evaluation that I am finding extremely perplexing to troubleshoot. I define the following function in ...
2
votes
1answer
59 views

Show [In] and [Out] tags after quitting Mathematica

I cannot find a way to show [in] and [out] tags when evaluating cells after I close the application. Is there a way to keep these shown? I disabled the kernel in global options but cannot transfer ...
0
votes
1answer
42 views

How to see partial results during evaluation [duplicate]

I am computing a long Table[], but the computation of the last few elements is taking too long, and I am afraid I will never converge. I would like to access the ...
1
vote
1answer
86 views

Working with derivative of conjugate of a complex number

I have a complex function, lets say $g(x)$. I want to take its and its conjugate's derivative. I need the solution of derivative which must be symbolically and computationally efficient. Lets take an ...
4
votes
1answer
58 views

Prevent evaluation of certain cells / code segments

I´m not quite sure if I ask a stupid question but I could not find an appropriate answer in the forum... I have a variety of cells (= code segments) in my notebook which I would like to evaluate in ...
-1
votes
1answer
75 views

I have several functions and how I know which one is the maximum in a certain range?

What I did are the followings These lines will generate a piecewise function pw which tells me the corresponding variable given an interval as follows: Now, I want to get: names of variable ...
12
votes
7answers
560 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, ...
1
vote
2answers
100 views

Evaluate a list

I have a function $f(x_1,\cdots,x_n)$ that takes $n$ arguments, and I would like to evaluate it using a list of lists $\lbrace\lbrace x_1,\cdots,x_n \rbrace,\cdots,\lbrace x_1',\cdots,x_n' ...
1
vote
3answers
147 views

How can I make a summary of all the commands of Mathematica?

I would like to have a simple way to get summary information about all the many commands built into Mathematica. How could I do this? Is there a site I may refer to?
1
vote
1answer
51 views

How can I force an installed, user-created palette to automatically evaluate?

I have created a palette in Mathematica v10.0.2, and used the Menu-->Palettes-->Install Palette functionality to successfully install it. When I choose my palette (from the dropdown menu), rather ...
17
votes
2answers
310 views

Why doesn't a Composition[] hold its arguments and what can be done about it?

Now that Composition (also RightComposition) has shorthand syntax I am more inclined to use it, however what I feel should be ...
3
votes
1answer
136 views

Why even try the semantic constraints, if expression can't match the pattern structure?

This result is unexpected: Trace[MatchQ[{7}, {_?NumberQ, __}], NumberQ] (* -> {{NumberQ[7], True}} *) Why evaluate ...
0
votes
0answers
73 views

How can I solve this expression?

I'm trying to solve this expression for A, but I'm not sure how. ...
1
vote
3answers
107 views

How I create a 'TraditionalForm' expression in which only parts are evaluated?

I have an expression for the form Subscript[W, f[a, b]][c] = ρ^f[a,b]ω[c]ρ^-f[a,b] that I want to render in TraditionalForm ...
5
votes
2answers
60 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 ...
9
votes
3answers
163 views

Implement settable properties

I am looking for advice on implementing the following. (It is possible that the answer is that it is simply not a good idea to do this.) I would like to have an object similar to ...
0
votes
0answers
62 views

Calculating the rank of an abstract matrix

I'm trying to compute the rank of a 4x4 matrix with 4 parameters and 2 variables. I tried to calculate its rank under some assumptions on those conditions and I kept getting rank 4. So I did an ...
7
votes
1answer
88 views

Why can't I abort main evaluation from ScheduledTasks (Service Link)?

FrontEndExecute[FrontEndToken["EvaluatorAbort"]] is equivalent of the menu item: Evaluation >> Abort. It works with ...
0
votes
1answer
84 views

How to make Mathematica show intermediate steps in integral [duplicate]

I want to know how Mathematica evaluates this integral: $PV \int _ {0} ^ {i \infty} d \tau \, \frac{e^{-\frac{\tau^2}{2 M^2}}(b^2 - 3 τ^2)^2 (|b^2+\tau^2|-(b^2-\tau^2))}{\tau (\tau^2 - b^2)}$, where ...
6
votes
1answer
92 views

Strange behavior when setting NumericQ of a symbol

It happens both in v9&v10. If you try this a^0 a^0 (1/a)^(3/2) a^0 (1/a)^(5/2) Mathematica returns 1 (1/a)^(3/2) (1/a)^(5/2) It's trivial. ...
2
votes
2answers
55 views

function definition with a given list of parameters: how to use Evaluate[] properly?

given a list of variables variables = {a, b, c}; I want to automatically define a function f[{a_,b_,c_},x_] := g[a,b,c,x] ...
6
votes
2answers
174 views

There is an issue with Manipulate in which it updates its argument twice in V10

I have asked this question before (here) and I thought that the issue is only when moving the Notebook window. It appears that Manipulate is working in weird manner. ...
1
vote
1answer
57 views

How to make strong assumptions?

Or put in another way, how to make a variable behave as it belongs to a specific domain, even outside the use of simplify or other commands alike? For example: ...
0
votes
0answers
70 views

How to prevent long evaluation and infinite loops

I'm new to this, so sometimes I accidentally ask Mathematica to do calculations with numbers so big that it can't handle it and it immediately freezes my laptop to the point where there's nothing I ...
6
votes
1answer
196 views

Context “Unique to This Notebook” makes variables black even if they're not defined?

I'm trying to use this technique to keep variables separated between different notebooks. It seems to be working fine, except that variables turn black as soon as they are evaluated — any ideas why ...
1
vote
1answer
65 views

How to evaluate some parts of an expression inside Hold? [duplicate]

I want to return a Hold expression but with some parts pre-evaluated. The easiest way to explain this is probably through code example. Here is what I have ...
2
votes
1answer
87 views

How to abort running evaluation?

I would like to implement a "Stop" Button into a program that basically consists of a loop. Unfortunately I do not how to interrupt the running evaluation. Minimal Example: ...
3
votes
3answers
117 views

ReplacePart equivalent for Associations

I have a fairly complicated Association. I wish to use/create a function such as ReplacePart to operate on certain Keys within this multi-level Association. Here's ...
0
votes
1answer
43 views

How to force numeric evaluation?

I need to evaluate the PolyLog function at some points, but I'm interested in numeric values. E.g. PolyLog[3, 2.7] works fine, but PolyLog[3, e] just prints the same PolyLog[3, e]. I somehow need to ...
0
votes
0answers
59 views

subtlety of self-defined function and its evaluation [duplicate]

I wrote a simple code as follows f[x_,y_]:=NIntegrate[x+z,{z,0,1}]; g[x_,y_]:=NIntegrate[y+z,{z,0,1}]; VectorPlot[{f[x,y],g[x,y]},{x,0,1},{y,0,1}] then ...
1
vote
0answers
83 views

Smart pointer for Mathematica?

Would the implementation of the smart pointer idea be possible in Mathematica ? Let's say I have an object "o" of the form Class[object] where object is an Association, and Class has the HoldFirst ...
1
vote
1answer
67 views

Trying to calculate derivatives of spherical harmonics

I am trying to confirm what is shown on this website: http://functions.wolfram.com/Polynomials/SphericalHarmonicY/20/01/01/0001/ But when I type ...
10
votes
2answers
287 views

Another difference between Set and Setdelayed. Evaluation shortcut?

A little while ago I wondered why f[x_] = f[x] gives an infinite iteration. I ended up discovering the following difference in evaluation between ...
7
votes
2answers
288 views

Using up-values and down-values

I have a problem I'm trying hard to find a solution for, although I don't know if a solution exists. The following rules produce the result e[2].f[] ...
1
vote
1answer
37 views

Evaluation order in polynomials

I'm confused by the evaluation order of polynomials containing division. Consider these two polynomials: (x^2 + y) z/w (1) a/b (2) And their tree ...
3
votes
2answers
44 views

Evaluation control with TagSet

Suppose I have a property associated with two functions using TagSet: ...
5
votes
4answers
484 views

Delayed evaluation of assignment

I have a set of PDE's that depend on parameters. They depend on many parameters, but for simplicity we can here assume that they depend only on one, say a. I want ...
0
votes
1answer
43 views

Why returning False? [closed]

Can anyone explain the false? I'm trying to grab co-efficient in front of X^2 I think. I say I think as I'm following my tutors example using his screenshot the only difference between his question ...
2
votes
0answers
131 views

Mathematica shift-enter problem

Would really appreciate if someone can help with this problem: When I first open a Mathematica note book, say you do 1+2 and press shift-enter. As expected, I get "3" as the output. Now suppose you ...
3
votes
0answers
74 views

Functional-Style Fixed-Length Queue Object?

Following up on question Side-effecting an array in an association? and @Mr.Wizard's answer in there, I'm modernizing and tweaking Daniel Lichtblau's efficient queues and ran into a little roadblock. ...