Questions tagged [evaluation]
Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.
1,601
questions
1
vote
1
answer
39
views
Unevaluated indexed variable in the events when using Table or Array generating a list of events [duplicate]
I want to use Table or Array to generate a list of events for NDSolve, but the variables (<...
0
votes
0
answers
35
views
SetAttributes on second set of arguments [duplicate]
I am applying functions with the postfix operator syntax (expr//function), and sometimes I add in my definitions some configuration argument (...
4
votes
1
answer
168
views
Why is {_Integer..} matching {_Rule..}?
Why is this getting stuck in a loop:
...
2
votes
1
answer
96
views
Is it possible to prevent side effects? opposite of Scan [closed]
Suppose I have a function that returns an output, and also does a side effect, such as writing a new cell to the notebook. I would like to use the function but prevent its side effects. Essentially, I'...
10
votes
2
answers
202
views
Evaluation leak in Derivative[]
Bug introduced in 4, persisting through 14.1.
I usually only report bugs, but in this case, two reason prompted me to post this:
Given that derivatives are computed internally by various commands, ...
0
votes
1
answer
36
views
Mysterious evaluation inside DiscretePlot
I'm trying to solve a mystery, I made the following code:
...
0
votes
0
answers
49
views
Modeling distributed computation with Wolfram MultiwayFunctionSystem. How to set priority for certain rules?
I am modeling distributed computation using Wolfram Physics project.
I have actors with memory, which compute their state and send messages to each other. All of this represented by a directed graph.
...
1
vote
0
answers
80
views
How to use the tedious definitional results to make a next definition for FindRoot?
I am trying to use a designed function to find the quasi-normal modes.
...
0
votes
0
answers
55
views
Inconsistent Function Evaluation with FunctionExpand
I'm pretty new to Mathematica and I came across the following apparent inconsistency which I am not able to explain.
I'm using Mathematica 14.1.0 to evaluate the Jacobi polynomial
$$P_{(n-1)}^{(-n,n-j)...
2
votes
1
answer
81
views
Evaluate section in a loop
I would like to evaluate a section several times for different values of some variables. I can evaluate it once with a simple command, but not in a loop.
To evaluate it only once, this code works
<...
0
votes
1
answer
70
views
Function thinks it has poles until you expand
Below I have a function func, which I have to evaluate thousands of times for various values of l,m,x. At the value x=0, the ...
0
votes
0
answers
58
views
How to evaluate Ginsh in Plot3D
I have a function F[x,y] containing multiple polylogarithms $G$ that can be evaluated numerically via GiNaC within the command Ginsh.
If say (toy example),
...
2
votes
1
answer
233
views
Why does FindInstance[x>0,x] give 27? [closed]
Why does FindInstance[x>0,x] give 27? I would think it would give 1… maybe 2 or some small positive decimal.
1
vote
3
answers
58
views
How to programmatically wrap an output expression in a function
When I execute:
Audio["ExampleData/rule30.wav"]
I get an Audio Object.
How can I programmatically wrap the output in another function (without ...
2
votes
2
answers
131
views
Force Mathematica to simplify a function to avoid infinities
I am doing some evaluations which return functions of three variables similar to the following:
...
2
votes
0
answers
50
views
Evaluation break in WolframScript
Astonishingly, I couldn't find this either by googling or tag search here.
CTRL-C completely closes WolframScript (on my Windows 10). But I just want to break the evaluation (if it takes too long). ...
0
votes
0
answers
53
views
How to list all the procedures Mathematica uses when doing some computation and how to control it?
If I compute:
Factor[x^3 + x - 2]
It will give me the expected result:
$(x-1) \left(x^2+x+2\right)$
But if I try the following:
...
2
votes
1
answer
174
views
How to get the output of evaluating in place and append the output to the place
I am trying to use MMA for some engineering calculations, and the text cell contains both descriptive text and mathematical formulas. The example is as follows:
...
9
votes
3
answers
1k
views
Why doesn't b = a; f[a_] := b; f[2] return 2?
As the title asks, why does
b = a;
f[a_] := b;
f[2]
evaluate to a rather than 2?
3
votes
1
answer
112
views
What does this statement about "Block" mean in the official documentation?
Initial values specified for x, y, ... are evaluated before x, y,... are cleared.
It's from the Details in The reference to Block. And I can't understand it.
When are the local variables cleared and ...
2
votes
3
answers
93
views
Clearing a list of variables: Problems trying to control the order-of-evaluation [duplicate]
I am having trouble controlling the order of evaluation of mathematica expressions.
What I would really like is a general solution, in the form of a pair of functions ...
0
votes
0
answers
48
views
Solve in solving equation system
I have the following problem:
I have a system of equations specifically consisting of 56 equations, with 34 coefficients to be determined, in simplified form:
...
6
votes
1
answer
142
views
Help in understanding the evaluation inside Plot
My colleague sent me this surprising example of code today (this is after stripping everything unrelated to the evaluation):
...
0
votes
0
answers
24
views
Keep list of user-definitions
Is there some easy way to keep track of user defined definitions. Or perhaps even better definitions made while some definitionRecordingFlag==True.
This is prompted ...
1
vote
0
answers
41
views
Avoiding ugly errors in Manipulate (and alike functions) on start up of Notebook [duplicate]
When there are Cells containing Manipulate this often leads to Errors in cells right at startup.
Say I write
willReceiveValue={1,2}
in one cell and in another
<...
0
votes
0
answers
74
views
Wolfram Cloud does not evaluate cells using Shift+Enter
When one clicks Shift+Enter on or evaluates a cell, it prevents you from typing/editing it, so it was thought
How can I prevent SHIFT-ENTER moving the editing cursor?
would stop this, but it did not....
5
votes
3
answers
157
views
Evaluation control of nested With, If and Integrate
Can you explain the behaviour of the following?
The first With outputs unevaluated If.
So in the second ...
4
votes
1
answer
132
views
Functions, Speed, and Evaluate[]
This is a question about how Mathematica works, rather than how to solve a specific instance of an issue, so apologies in advance if this isn't admissible for this StackExchange. I've noticed some ...
1
vote
0
answers
35
views
Unexpected function evaluation result in Plot [duplicate]
I find some strange behaviors of Plot. The code is:
...
0
votes
0
answers
54
views
How to convert LaTeX to expression without interpreting variables as products?
I need to convert some LaTeX code to mathematica expressions. So far I have used
ToExpression["ab", TeXForm]
yielding ...
4
votes
3
answers
241
views
Converting to a scalar pure function without getting the warning messages
I am using this from the function repository for which I need to convert one of my functions into a unique form. A simple example is like this:
Suppose I have,
...
1
vote
0
answers
49
views
Unexpected recursion when enumerator (like Table) uses variable also non-atomically in value list
Consider expression
Table[k, {k, {a, b, k}}]
which correctly evaluates to {a,b,k}. The duplication of the enumerated variable <...
2
votes
0
answers
73
views
Changes in the kernel across versions
I was going through the Power programming book by David Wagner, and I tried:
...
3
votes
2
answers
138
views
Different behavior of Clear in different versions of Mathematica
Consider the following code:
list1 = {1, 2, 3};
m = 17;
{list1, m} // Clear
In Mathematica 13.2, this syntax with Clear works ...
1
vote
0
answers
113
views
Save as custom folder in menu bar in 1 step
I found the solution for myself.
For some reasons I decided to write the updated content(=solution) at the top. One important reason is.. that you almost don't need to read after the solution.
...
0
votes
1
answer
104
views
Command to press a button
Under normal circumstances, giving a command to
press the Button
is stupid. Because we only need to execute the button action of that ...
5
votes
2
answers
492
views
How to convert this logarithm into this form? [duplicate]
How to convert this logarithm:
Log[Log[2]]/Log[2]
into this form:
Log[2, Log[2]]
1
vote
0
answers
59
views
Initialization Cell evaluation warning : turned off but still [closed]
I have a two .nb files, MyStart.nb and MyDoing.nb in c:\testfolder.
My intention is that if ...
7
votes
1
answer
297
views
How to condition all cells of a notebook to a specific SeedRandom?
Is there a way to fix SeedRandom[.] for an entire notebook? If I carry out many calculations using random numbers, I need to give a separate code ...
0
votes
0
answers
71
views
Integral evaluates to zero when it should not
I have the following code:
f[x_, y_] := KroneckerDelta[x, y]
g[x_, y_] := x*y
r[x_, y_] := Integrate[f[x, t]*g[t, y], {t, 0, 1}]
Now I query ...
1
vote
1
answer
147
views
Numerical optimization yields strange result with imaginary number
Edit: I changed the range for $r$ to $d/s \leq r \leq 1/2$ from the original one, $0 \leq r \leq 1/2$ and now it works! But there has emerged another issue, which is presented below.
Consider the ...
1
vote
0
answers
57
views
Is there an easy way to make built-in functions do a replacement before throwing an error message?
Many built-in functions throw errors before executing a ReplaceAll. The functions still execute the ReplaceAll as intended, but ...
0
votes
0
answers
69
views
Any way to eliminate evaluating cells except for "Abort evaluation"?
I have a notebook with many cells, one of which contains an evaluation of some condition. If it is False, I want to have an automatized way of the "Abort ...
3
votes
0
answers
76
views
PrimeZetaP evaluation in different versions of Mathematica
PrimeZetaP was introduced in version 7.0. I suspect there were made some changes in the definition of this function in subsequent versions.
Is there any user that ...
1
vote
1
answer
58
views
How to simplify expression depending on former definition?
If
a = x + y
b = x - y
u = a + b
v = a
This gives me for u/v the expression (2 x)/(x + y)...
0
votes
0
answers
90
views
FindRoot + NDSolve + List? [duplicate]
I've noticed that FindRoot fails when its argument involves a component of a list, to which a substitution rule from NDSolve has ...
3
votes
3
answers
271
views
How to define a root that is obtained by FindRoot as a variable? [closed]
Given some function I want to find a root around some value $x=x_0$
so I use FindRoot, for example:
root = FindRoot[Exp[x]+Sin[x],{x,0}]
But I want the root to be ...
1
vote
2
answers
141
views
Should expression evaluation depend on the choice of a variable name?
I am verifying the series representation of the Sonine polynomial or the associated Laguerre polynomial, which is
$$
L_m^{(n)}(x)=\sum\limits_{l=0}^n\left(-1\right)^l\binom{m+n}{m-l}\frac{x^l}{l!}=S_{...
4
votes
2
answers
358
views
Is it possible in Mathematica to get a step-by-step evaluation of the following?
Is it possible in Mathematica (or WolframAlpha["...]") to get a step-by-step evaluation of the following?
...
1
vote
0
answers
35
views
Monitor inside core function
I like DistanceMatrix: its performance is surprisingly high, even for a big data.
However, for a huge arrays and custom ...