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
4answers
263 views

Replace symbols with values without evaluation

If I have assigned values to a, b and c: ...
4
votes
1answer
112 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
162 views

Skip one step of the loop if there is an NIntegrate::eincr message

Is there a possibility of skipping one step of a loop if in this step there appears an error like NIntegrate::eincr? After skipping, the loop should go to the next ...
0
votes
2answers
254 views

Defining a function in terms of matrix elements

Currently trying to use elements from a matrix in defining a function however having some trouble. This is a somewhat simplified version of the problem. Say I have the matrix ...
15
votes
2answers
746 views

Why do certain values in ArcSin not fully evaluate?

This is a continuation of: Why do certain fractional values in TriangleWave not evaluate? The analysis by R.M and rasher revealed that problem to reduce to the behavior of: ...
3
votes
2answers
99 views

Evaluate in Plot leads to function error

Please help - I'm really struggling to understand why this evaluates with errors. ...
4
votes
1answer
84 views

Why do certain fractional values in TriangleWave not evaluate?

While answering another question I discovered that TriangleWave does not automatically evaluate when given certain fractional values, specifically fractions with a ...
0
votes
0answers
14 views

Evaluating a String that is a Variable [duplicate]

I have a Variable assigned a value, say ImportantDocuments=1 How do I make N["ImportantDocuments"] evaluate to be 1 instead of ImportantDocuments I found that ...
7
votes
2answers
278 views

Understanding Villegas-Gayley

Temporary message: I have written another question about the behaviour the code by Oleksandr R. . Sadly I clicked "discard" and that was lost. I am a bit demotivated now and in order to not let the ...
3
votes
1answer
92 views

Why is held expression evaluated?

Context: I'm studying non-linear dynamics. As part of a bigger problem, I'd like to generate lists of the form {{deq, ic1}, {deq, ic2}, ...}, where ...
12
votes
4answers
317 views

Prevent graphics render inside held expression

Assuming each odd line is input I would like the even lines to be the output of the following lines. In the above the Graphics are inside ...
4
votes
0answers
138 views

DynamicModule, SaveDefinitions and global functions

Unfortunately, I had not checked stackoverflow, because there, the exact same behavior was already reported. Please see the Q&A "SaveDefinitions considered dangerous". Up-front, I'm on Ubuntu ...
5
votes
1answer
245 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
1answer
110 views

Piecewise function with user-input interval

I would like define a function g[data,bins,x] which is a piecewise constant function taking value data[[i]] in the range ...
2
votes
1answer
119 views

Need help looping a notebook evaluation

I'm a new user and would like to find the minimum value of soln1[30] obtained after repeating the following evaluation (below) for 1000 cycles (for instance). I can obtain sequential values of ...
12
votes
4answers
353 views

Elegant high precision `log1p`?

Sometimes it is hard to understand how numerical expressions are evaluated. I remember reading claims by Wolfram on how smart the Kernel is to evaluate expressions trees numerically by recognizing ...
3
votes
2answers
93 views

Keep data in memory inside a notebook without having to evaluate it again [duplicate]

I have a notebook that calculates some data in a relatively large time so I want to keep these data saved inside the notebook without recalculate them every time I open the notebook. I know I can ...
0
votes
3answers
79 views

Preventing evaluation until all undefined symbols are resolved

FixedPoint[If[# <= 0, 0, # - 1]&, 2 x] Causes an infinite loop because of 'x'. How do i automatically prevent evaluation until ...
2
votes
1answer
80 views

Need to run evaluation 2 times

Why does this only work after running the evaluation 2 times? ...
1
vote
1answer
95 views

Manual CellGrouping option causes crash at cell evaluation

Update: Try to reproduce this behaviour with CellGrouping set to manual. To do that: either evaluate ...
10
votes
1answer
102 views

Aborting from inside a ScheduledTask

If you have an Abort[] inside a ScheduledTask expression, what does it abort? The scheduled task evaluation, or any main kernel ...
2
votes
1answer
69 views

Evaluate only one from a set of procedures

Let's say I've got a list of procedures: {Print[1];, Print[2];, Print[3];} And I want to only evaluate 3rd one: ...
3
votes
3answers
111 views

Using a variable to tell Mathematica which existing variable to manipulate

I have an estimation routine I have coded up, I want now to do some tests on it where I pick a particular parameter and run the estimation for differing values of that parameter. What I want is to be ...
3
votes
2answers
126 views

Assigning an equation as a variable

I am compiling a calculator where many slider parameters are used to define a value, where the defined value may then be reused to define another value. I am unable able to, or at least been ...
9
votes
1answer
188 views

ScheduledTask with scoped variables. Working with timed evaluation

I guess I have to try harder and focus more but timed evaluation always frustrates me. I will show the issue on simple example of delayed trigger. ...
2
votes
1answer
79 views

Differentiating a function that has NIntegrate within it

I am something of a novice with Mathematica. I have written the following code; ...
0
votes
1answer
101 views

Solving NLODE with substitution

I am trying to get a solution to a non-linear ODE, below is the code that works for my problem. ...
10
votes
1answer
185 views

TimeConstrained dynamic change of maximum time

I would like to run a time consuming function: TimeConstrained[f[x],maxseconds] and be able to change maxseconds during running (increasing or decreasing max ...
10
votes
3answers
161 views

Creating a custom context with a Hold construct

I'm trying to create a function "InContext" to execute a piece of code inside a certain context (and to return the result of evaluating that piece of code). One approach is to place the code inside a ...
2
votes
3answers
399 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 ...
5
votes
2answers
154 views

Remove versus ClearAll

What is the difference between Remove and ClearAll? I thought that "not being recognized by Mathematica", which is the effect ...
2
votes
3answers
118 views

Dynamic plot with Evaluate on expression

I'm trying to make a make a plot of a table of expressions, which should be pre-evaluated (since they are infinite series with analytic sums). I'm able to make the plot normally with ...
1
vote
1answer
104 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
104 views

Evaluation of second argument to NIntegrate

Apologies if this is a duplicate, but I couldn't find it. The expression Integrate[x^2, Flatten[{{x},{1,2}}]] evaluates properly, to $\frac{7}{3}$. However, ...
12
votes
3answers
200 views

Selective evaluation of blocks of code in a Manipulate

Is it possible to attach certain pieces of code to certain controls in a Manipulate? For example, consider the following Manipulate ...
17
votes
1answer
396 views

Incorrect result from Integrate

I attempted to calculate the following integral: ...
0
votes
1answer
139 views

Plot[ D[Sin[x]] ] and Evaluate[] [duplicate]

Why does t = 2 Pi; Plot[D[Sin[x],x], {x,0,t}] (* Plotting the derivative of Sin[x] *) not work, but ...
1
vote
1answer
112 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 ...
7
votes
3answers
216 views

Why does Mathematica not seem to know that $i^x$ cannot be equal to $0$?

I am experiencing a curious behaviour of Simplify when handling expressions involving powers of $\mathbf{i}$, such as $\mathbf{i}^x$ where $x$ is unknown. For ...
1
vote
1answer
135 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 ...
2
votes
1answer
378 views
0
votes
1answer
86 views

Plot producing many error messages when given complicated function

I'm new to Mathematica and am running in to all sorts of silly difficulties with coding in it. I'm trying to calculate a function f[x, k], normalise it with another ...
2
votes
1answer
207 views

Why is this expression being held, and how can I evaluate it?

I can't figure out why an expression isn't evaluating, even though there's no Hold* in its FullForm: ...
11
votes
4answers
303 views

Using With to scope over pure functions

Consider this example: given an option for a function func as "x" :> (a&), how can one assign different values to ...
1
vote
1answer
40 views

Output cell written with NotebookWrite dissappears on whole notebook evaluation, yet remains if I individually evaluate it

Create a new notebook with the following two input cells: NotebookWrite[EvaluationNotebook[], Cell[BoxData[ToBoxes[Manipulator[Dynamic[x]]]], "Output"]] and ...
0
votes
1answer
75 views

Evaluate outer function first

I'm new in Mathematica so this is maybe super easy to do, but I can't figure out how. I've got a function plus[a,b] that sums two numbers and I need to implement a ...