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

learn more… | top users | synonyms

3
votes
0answers
113 views

Assign variables from list inside With or Module

I have found that it is possible to assign variables from lists, as follows. r = {1, 2, 3}; {a, b, c} = r; b 2 However, ...
0
votes
1answer
118 views

Plotting two variables indirectly dependent on each other

I have the following system of linear ODEs for "i" number of species "c" migrating in "j" number of habitats: ...
18
votes
2answers
355 views

What does f_[whoCalled]^:=f really mean?

I came across the following post by John Doty in this Google Groups discussion: On Friday, January 11, 2013 8:23:16 PM UTC-7, amzoti wrote: It is clear the Mathematica uses Lisp as one ...
2
votes
0answers
52 views

Import names into notebook namespace [duplicate]

I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default ...
1
vote
0answers
34 views

Save a Mathematica notebook evaluated [duplicate]

My notebooks can take some time to evaluate and by quitting Mathematica, I have to reevaluate every definition I've made once I restart Mathematica. Is there a way to tell Mathematica to save the ...
0
votes
0answers
76 views

Skipping sections of a notebook automatically

I have a notebook which allows to set some parameters at the start, and then does computations depending on these parameters. It is a long notebook and for readability it is broken up into sections ...
4
votes
1answer
50 views

How to adapt MSPToExpression function in $PrePrint?

I am introducing the mathematica Security (MSP module) to our system. The Document suggests use MSPToExpression as followed: ...
10
votes
1answer
122 views

Use EvaluationCompletionAction to notify me only after long evaluation

Is it possible to use the option EvaluationCompletionAction to notify me (e.g. with a Beep[]) when an evaluation that took ...
1
vote
1answer
49 views

Evaluation of InverseFunction at the boundaries of its domain

Folks, I want to numerically evaluate a InverseFunction h[x] close to the edges x5 and ...
8
votes
6answers
2k views
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: ...
10
votes
4answers
334 views

How to take and evaluate a specific part of a list without evaluating the rest?

I have a large list, for example, lis = {x + y, x y, Sin[x] y + Exp[y], x^2 y} and its elements depend on variables x and ...
2
votes
0answers
43 views

Executing selected code [duplicate]

In current Mathematica interface, if I select some piece of code and press CMD + Shift + Enter, the code is evaluated in place. Replacing the selected part by the evaluated version. The question is: ...
0
votes
0answers
70 views

Memoization and upvalues

Can I store an algorithm to one variable and the result as an upvalue to another? With regard to the problematic code below (real algorithm and argument test omitted), I would like to store the ...
1
vote
1answer
53 views

Creating a keyboard shortcut to change the Style of text [duplicate]

I'm editing a very long text in a Mathematica notebook and I'm using the "Article" stylesheet. In this text, code is highlighted using ...
6
votes
1answer
254 views

Dynamic and Refresh

If I am not mislead by my memory, in Mathematica 6 a function Refresh was introduced, having the options UpdateInterval and ...
1
vote
1answer
42 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 ...
10
votes
2answers
170 views

stop notebook evaluation when Assert fails

I would like a notebook evaluation to entirely stop when an Assert fails, without quitting the kernel. Is this possible (e.g., by setting ...
2
votes
2answers
85 views

PasteButton: Pasting expression name without quotation marks?

I am struggling to find a way to use PasteButton to paste the name of an expression (in particular a list) without showing the contents of the expression or without ...
2
votes
2answers
67 views

How can I use an InputField value as a variable name to save to?

I'm trying to save some settings and results from Manipulate, and I want to be able to save them to different variable names. The code I have is something like ...
22
votes
2answers
2k 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: ...
23
votes
1answer
2k views

A one line proof that one is zero using Mathematica 10

a = (Sqrt[2] + 1) (Sqrt[2] - 1) - 1; {a/a, Simplify[a]/a, b/b == Simplify[b]/b} {1, 0, True} This one line "proof" that ...
14
votes
3answers
389 views

Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
5
votes
1answer
45 views
2
votes
1answer
116 views

How to properly define this function of function

I encountered real problem at first, and here is the toy example variable argument stored some expression that is generated from other parts of the program. I ...
1
vote
0answers
65 views

Meaning of Abs´? [closed]

A friend showed me the code below. r[i_] := {x[i, t], y[i, t], z[i, t]}; rji = r[i] - r[j]; solap = 2 a - Norm[rji]; FullSimplify[D[solap, t]] I'm unsure about ...
26
votes
4answers
1k views

Asynchronous evaluation: Is it possible?

Currently we have a limited number of ways to perform asynchronous evaluation. The most common is through Dynamic and ...
5
votes
2answers
100 views

Parallel function evaluation for minimal value

I am asking myself, if the evaluation of a function f looking for a minimal value over a discrete set of values can be parallelize (brute scan for a potential ...
1
vote
1answer
63 views

Resolving Error: Mathematica evaluation order on Lists

I have a table that is 27 x 27, each entry corresponds to an element from the periodic table. I use the replacement rules in element list to allow me to convert a list of elements into a list of ...
2
votes
3answers
6k views

Step-by-step definite integration

I am interested in obtaining the intermediate steps for rather straightforward symbolic definite integrations (e.g., from an elementary calculus text). As an example, for $\int_0^1 x\,dx$ I'd like ...
2
votes
3answers
111 views

Evaluation inside a Manipulate

Let's assume I have a symbolic expression, and inside a Manipulate I define the actual values: ...
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 ...
0
votes
2answers
104 views
2
votes
1answer
75 views

Errors in plotting regular function

Suppose we want to define Tanh-function via exponent: th[x_] := (1 - Exp[-2 x])/(1 + Exp[-2 x]); FullSimplify[th[x]] Out[13]= Tanh[x] Then we define new ...
5
votes
2answers
240 views

Evaluate notebook from other notebook

I have a notebook ("notebook 1") which in the beginning sets some parameters, does something depending on their value and saves the result to a file, say: ...
1
vote
1answer
40 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
48 views

How do I dynamically update “name” of Action Menu?

I have created an action menu that allows you to change the style of a cell. It works. However, I would like it to dynamically update the action menu "name". I can't get the name to refresh. ...
1
vote
1answer
62 views

Trace and SameTest in Union [closed]

This question is actually two question. First, I feel so stupid that I just don't understand the use of theSameTest option in ...
4
votes
0answers
90 views

Simple arithmetic with Irrationals fails [closed]

While solving a simple puzzle that asked for a few calculations in plane geometry, I ended up with this expression: $-\frac{55}{2}+\frac{\sqrt{27233}}{2}+\frac{1}{2}(55-\sqrt{27233})$ Or, in ...
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
41 views

How to enable automatic “grammar check” for MMA? [duplicate]

The special evaluation mechanism of MMA might make it more likely for MMA users (especially new users) to make mistakes and more difficult to find them. For example, one may have defined a function ...
1
vote
1answer
132 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?
5
votes
3answers
74 views

StepMonitor won't display Plot

This example is from the documentation under Monitor ...
7
votes
1answer
272 views

NMinimize with NIntegrate (crash in symbolic evaluation, memory leak)

This is a "common" problem from what I've seen, but with a different spin. I have a function I use often that finds a fit of an expression to another expression with some free parameters (e.g. for ...
3
votes
3answers
210 views

How to make a defined symbol stay in symbol form?

How to make a defined symbol stay in symbol form? w = 3; g = 4; {w, g}[[2]] 3 I want the output to be ...
0
votes
0answers
42 views
1
vote
1answer
154 views

Printing intermediate calculations in an external file, while suppressing the output in the notebook

I'm trying to construct a text-file that contains all the operations that Mathematica performs when evaluating an expression. However, i'd like to suppress all output in the notebook in which I'm ...