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

learn more… | top users | synonyms

1
vote
3answers
64 views

Controlling the evaluation of other arguments in pure functions [duplicate]

I have a piece of code where I would like to do the something like the following: ...
1
vote
2answers
1k views

How to evaluate Modules in a notebook from another notebook?

I would like to create a notebook populated with several modules and be able to evaluate these modules by running a separate notebook. I have attempted several uses of the ...
1
vote
2answers
154 views

Evaluation of elements in a list and then sorting them

This is probably a simple problem, but I'm having a lot of issues with it because I'm unfamiliar with Mathematica syntax. I have a list ...
1
vote
2answers
167 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: ...
1
vote
2answers
108 views

What is the default file path used by the Put function and how do I pre-evaluate an expression to use in Put?

I have a problem of trying to store some output in an external file. In one note book I define a function f[x_]:=AdvancedCalculation, where this function generates ...
1
vote
3answers
111 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 ...
1
vote
2answers
198 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
137 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 ...
1
vote
2answers
136 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
62 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 ...
1
vote
2answers
260 views

How to get the absolute difference between two angles

I need a function that will give me the shortest separation between angles that range from -pi to pi. For example if I have two angles 3pi/4 and -3pi/4, I would like a function that will tell me pi/2 ...
1
vote
1answer
352 views

FindRoot with vector functions

I'm trying to solve a system of non-linear equations with FindRoot, and I get the answer, but also a ...
1
vote
1answer
134 views

Why does evaluating an integral within a Plot expression take so long? [duplicate]

I want to evaluate Plot[Integrate[Sin[((1 + 1/2) x)] (1/(2 Sin[(x/2)]) - 1/x), {x, 0, t}], {t, 0, 5}] but it takes ages to load on Corei3 computer with ...
1
vote
1answer
214 views

Passing a joined list of symbols for Module or Block to treat as its own local symbols

The Question I'd like to write a function which itself takes a list of symbols, e.g. Foo[{x, y, z}] to pass to Module ...
1
vote
1answer
85 views

How can I draw truth tables using Mathematica [duplicate]

For instance, the given expression p ⊕ (p v q) In the problem I'm trying to solve. There's a Mathematica answer to this: ...
1
vote
1answer
133 views

Why isn't Mathematica reducing my result to a number? [closed]

I do not understad why the program do not show the number values. Even when I use N[xx]. How can I simplify this?
1
vote
1answer
538 views

Why is evaluation Enter for Mac and shift+Enter for Windows? [closed]

Per the title, why is evaluation done using just the Enter key for Macintosh and shift+Enter for Windows? UPDATE Okay, I see the Mac keyboard's "Enter" key is actually labeled "Return", so by Enter ...
1
vote
2answers
588 views

Converting expression into string without evaluating it

How can one convert a Mathematica expression into a string without the expression being evaluated first? I tried using Hold, but it returns ...
1
vote
1answer
648 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 ...
1
vote
2answers
169 views

How can define a set of nested parameters

I would like to know how I to define a function with a nested set of parameters (or whatever you would like to call it). For example, how would I get the following function ...
1
vote
1answer
41 views

Unpacking NumberForm expressions

Given a NumberForm expression, e.g.: NumberForm[N[Pi], 10] How does one get the underlying numerical expression (short of ...
1
vote
1answer
104 views

Evaluate multiple notebooks sequentially and automatically

I know how to run multiple notebooks at once. But my problem is that due to the RAM capacity, I have to run these notebooks consecutively. Another problem is that since I may not be in my office all ...
1
vote
1answer
49 views

problem about Root and Hypergeometric2F1

See these example, why does the output is different? ...
1
vote
1answer
55 views

How to achieve fun[Unevaluated[f][Unevaluated[x], Unevaluated[y]] in a more elegant way?

I have defined a function fun[f_[x_,y_]]. When I call it, I want to wrap everything by Unevaluated: ...
1
vote
1answer
79 views

Replace symbols in output without evaluation

I found the Wolfram example for ExpandNCM but I want a more human-readable output form. I want to evaluate ExpandNCM, for example with ...
1
vote
1answer
80 views

A With and ContourPlot difficulty

Consider: sys = {u (1 - u + a v), r v (1 - v + b u)}; With[{a = 2, b = 3, r = 1}, Evaluate[Thread[sys == {0, 0}]]] Which gives the output: ...
1
vote
2answers
88 views

Assigning to the “local” version of a symbol

Compare Manipulate[c[1] = 1; c[1], {c[1], 0, 1}] with Manipulate[Do[c[i] = 1, {i, 1}]; c[1], {c[1], 0, 1}] The first case ...
1
vote
2answers
84 views

Extract the real components from a very large expression

Suppose I have a very long expression (>500,000 characters) which contains a mixture of real and imaginary terms. e.g ...
1
vote
1answer
44 views

Cell seems to be evaluating in exponential time even though it shouldn't

I am trying to implement Newton's method for a given function f[x] and a starting x-value xval. The code should print out each new x-value as it approaches one of the zeroes of the functions. g[x] is ...
1
vote
1answer
140 views
1
vote
1answer
9k 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 ...
1
vote
1answer
185 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? ...
1
vote
1answer
40 views

How do I run DialogInput and SystemDialogInput by keyboard shortcut?

I have tried modifying KeyEventTranslations.tr with code: ...
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
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 ...
1
vote
2answers
72 views

Evaluation of a list

I'd like to assign to $a[1],\ldots,a[m]$ ($m$ being defined beforehand) zero values. I tried Table[a[i], {i, m}] := Table[0, {m}]; but got an error message ...
1
vote
1answer
41 views

Aborting an evaluation automatically after a specified time elapsed

I use the following code to evaluate a series of notebooks: nb1 = NotebookOpen["C:\\Users\\....nb"]; SelectionMove[nb1, All, Notebook] SelectionEvaluate[nb1] ...
1
vote
1answer
75 views

How to get Mathematica to abort the current evaluation if an assertion fails?

I can turn on assertions, but they don't terminate the current evaluation. For example: ...
1
vote
1answer
147 views

GCD of Table entries

This question is from a newbie, so please be gentle in thrashing if I'm missing something very basic. How can I use GCD on a matrix/vector entries stored as Table. For example, if ...
1
vote
1answer
73 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 ...
1
vote
1answer
90 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: ...
1
vote
1answer
190 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 ...
1
vote
1answer
40 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 ...
1
vote
2answers
68 views

Strange behavior of the Evaluate function

I am solving a system of differential equation whose unknown are saved under variable vec={C00,C01,C10,C11} and the solutions are saved under variable ...
1
vote
1answer
131 views

Caching data in Mathematica package

Consider the following: m=Quantity[1,"meter"] If I run the package, it will return 1m But when I load the package, the ...
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
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 ...
1
vote
1answer
39 views

Please explain this pattern/Message related issue and help with finding workaround

I attempted to clean up my code and also add messages to functions if they are called with wrong arguments. This introduced some error which I tracked down to the following: ...
1
vote
1answer
43 views

Showing updating message in Dynamic with UpdateInterval

I am creating an interface which needs to repeat an operation every few seconds. The operation itself is expensive but faster than the update interval of the interface. I would like to have some ...
1
vote
2answers
64 views

Plot of function-generated lists: Why does this workaround not work?

My problem is a classic one: I want to plot a function-generated list, and there's no way to pre-evaluate (because the actual function includes NMinimize and thus ...