Questions tagged [evaluation]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
24 views

Initialization cells not evaluating?

I think I'm experiencing a bug, but perhaps there is a simple explanation and fix. I have many initialization cells in my notebook (a few hundred). As of quite recently, they stopped all evaluating ...
0
votes
0answers
35 views

Evaluating a function that is defined by Minimize

I want to find a global minimum of a function and plot the result for different parameters. ...
3
votes
2answers
62 views

Evaluation time for each evaluated cell (as a whole)

I have a Mathematica notebook that has a number of cells, and each cell has a number of code lines. Sometimes it takes long hours to finish evaluating each cell and I want to compare their evaluation ...
1
vote
1answer
41 views

How to clear a selection of definitions from UpValues?

I'm trying to set up a bunch of 2D points using UpSet that I am going to use later for building lines and graphs. ...
2
votes
2answers
117 views

Really slow evaluation of a simple? list expression

I believe this is a standard problem, but I could not find a solution anywhere. Possibly because I don't know what to look for. I define a subset of some numbers and I want to count how many are less ...
1
vote
0answers
28 views

Discrepancy between AbsoluteTiming and actual execution time with Table

While trying to benchmark whether or not I could benefit from ParallelTable[] I ran into a rather strange discrepancy between the time reported by ...
9
votes
1answer
321 views

Zeta zeros bug in Mathematica 12.0.0.0

In Mathematica 12.0.0.0 when I input one of these: Log[2/Im[ZetaZero[127]]] Log[2/Im[ZetaZero[128]]] Log[2/Im[ZetaZero[127]]]//N Log[2/Im[ZetaZero[128]]]//N ...
0
votes
1answer
52 views
4
votes
0answers
148 views

Inconsistent Output Bug and Code-Quits-Kernel Bug with Compile

This is the strangest bug I've encountered. In my experience, variations in the code will unexpectedly crash the kernel, give inconsistent output, or produce expected results with no problems. 1) Code-...
1
vote
4answers
83 views

multi-dimensional interpolating function evaluation and extract dimension

I have an interpolating function which output dimension is greater than 1, so it's a vector. I get it as the result of a NDSolveValue. The problem is that I'm not able to Evaluate it. I would obtain ...
3
votes
0answers
173 views

How to allow one process to take advantage of all available cores while other processes run in parallel?

I have to run multiple tasks simultaneously: Data download from stock exchange during live market session and append it to a global variable. Process the data by taking the data from the front of the ...
7
votes
1answer
97 views

Compile Can Handle Passing an Empty List Only When Returned by Some Functions?

There seems to be a bug whereby Compile can deal with empty lists only when passed in some cases. Consider the case below. ...
10
votes
1answer
260 views

"instruction 9223372036854775807" Bug and Bug with Using DeleteCases[] inside Compile[]

I get an error referring to "instruction 9223372036854775807" as follows. I run the code ...
0
votes
1answer
59 views

Precision problem with mathematica

I have a precision problem with a complicated function in Mathematica. I need to get norm (NIntegrate[f[x],{x,0,1}]) and shape (...
2
votes
1answer
66 views

Construct really identical function (the same as Length)

In[1] Length[Unevaluated[1 + 1 + 1 + 1]] Out[1] 4 Q1) Can we construct a function named f, such that ...
0
votes
1answer
132 views

RandomPoint does not return with many region intersections

I am trying to generate random points on an n-dimensional unit sphere that satisfy a number of linear inequalities (a point $v \in \mathbb{S}^N$ has to satisfy $v \cdot x \geq v \cdot x_k$ for all $...
1
vote
0answers
27 views

How is the Riemann-Siegel Z function evaluated in Mathematica?

How is the Riemann-Siegel Z function evaluated in Mathematica? Is it calculated using the first so many terms of its power series or by other means?
6
votes
2answers
171 views

Why is Evaluate not handle on the Association?

This is a demo code ...
1
vote
0answers
41 views

Generalised Hold pattern for currying

Let myFun[a_][b_] := myFun[a[b]] . The HoldFirst attribute will prevent evaluation of a. Is ...
3
votes
1answer
110 views

Why do these two calls to Apply return different results?

In the following example, why do these two calls to Apply return different results? ...
1
vote
1answer
58 views

Getting a symbol from a string without it being replaced by its value?

Consider the following code running on a fresh Mathematica session with no symbols defined: p[s_String] := Protect[s]; p["x"] This doesn't do anything ...
8
votes
2answers
227 views

How to stop this computation?

I want to implement start-stop dynamics within a Manipulate environment so that, when I click a "Start" button, the simulation starts, and when I click ...
1
vote
1answer
37 views

HoldAll doesn't work for List or BlankSequence?

Consider the following function: f[arg_] := Print[Unevaluated[arg]]; Attributes[f] = HoldAll; The purpose of the function is to print the arguments unevaluated. In ...
3
votes
1answer
115 views

Why isn't RandomPoint evaluating?

Consider the expression RandomPoint@ BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}}]}] This does not ...
2
votes
0answers
50 views

How can I know the value of some parameter (say w) during a parallel calculation in Mathematica?

I am computing something like ParallelTable[{w, f[w]},{w,0,10,1/100}], in which f[w] is a numerically obtained function that ...
4
votes
0answers
58 views

Residue for $L(s,\chi_1)$ not same in Mathematica as theoretical value

I want to find the residue of Dirichlet-L function, defined as $L(s,\chi)= \sum_{n=1}^\infty \frac{\chi(n)}{n^s}$ for $Re(s)>1$. We know that $Res_{s=1}L(s,\chi_1)=\frac{\phi(k)}{k}$, where $\chi$ ...
4
votes
1answer
60 views

Mathematica Documentation for HoldAll: Unevaluated doesn't do anything?

I'm trying to understand the difference between HoldAll and Unevaluated. The documentation for ...
2
votes
1answer
47 views

Extract only a few coefficients of the multiple of extremely many polynomials

I want to extract some informations, say the coefficients of $x^{500}$ and $x^{1000}$ terms (numerical values are acceptable), of the multiple of ...
3
votes
2answers
70 views

How to symbolically evaluate expression within If[]?

I have a function, say f, that needs to take one of two symbolic forms depending on the value of its inputs. This function is part of a very large expression, and I'...
2
votes
1answer
49 views

Stop Minimization after condition

I want to interrupt the optimization of a function when a particular condition is satisfied. Here I provide a test function. ...
6
votes
1answer
191 views

Append vs AppendTo

According to the documentation AppendTo[s,elem] is equivalent to s = Append[s,elem]. But then ...
0
votes
0answers
41 views

How do I increase an amount of digits after the point?

I have an expression such as: Log[0.784637, 517.8796]*ArcTan[-1.112673]*0.4256^(-2.034)*Sqrt[3.567] and I get 3 digits precision. I tried: ...
0
votes
0answers
31 views

Evaluating function of two variables inside NMinimize with respect to second argument

Consider three functions: f[t_, 1] := {Cos[t], 1, 0} f[t_, 2] := {Sin[2 t], 1, 0} f[t_, 3] := {Cos[t - 2], 1, 0} For each $k=1,2,3$, let $g(\cdot,k)$ be the ...
1
vote
0answers
63 views

Different handling of division by zero [closed]

MMA differently handles division by zero. How to control this behavior? In this case it delivers the expected error: i/(i + k) /. {i -> 0, k -> 0} ...
1
vote
1answer
68 views

Creating a Button to evaluate initialization cells

I am trying to create a setup where I have a number of InputField, SetterBar, and Checkbox ...
2
votes
3answers
144 views

Limit of empty sum

Why MMA delivers this result and how to interpret or reformulate it? Limit[k Sum[1/i, {i, 1, k - 1}], k -> 0] I would expect 0 as it is an empty sum. MMA 12.1 ...
0
votes
1answer
54 views

How solve this system of trigonometric equations?

I have the following system of equations: (substituting any real values for a,b,c,r,Alpha,Beta will return the same answer for x) ...
0
votes
0answers
40 views

Evaluating more than one open notebook in Mathematica without mixing issues

I have two open Mathematica notebook files, call them file A and file B, that are identical except for some initial parameter conditions that I manually input at the beginning of each file (all the ...
0
votes
1answer
76 views

Evaluation taking extremely long

I am trying to solve the following: ...
0
votes
0answers
36 views

Notebook Evaluate crashes after several evaluations

I created master and slave notebook where master notebook evaluates slave notebook as follows: ...
4
votes
1answer
72 views

Refer to OptionValue externally without a specific function name

I want to refer to the actual option values of a function f outside of f, using OptionValue. ...
3
votes
1answer
95 views

How does MMA return an unevaluated expression on errors without going into an infinite loop? [duplicate]

Post-answer note: this question is (understandably) marked as a duplicate, and indeed has a similar solution, but is subtly different in focus: the linked question is about returning a function call ...
7
votes
1answer
168 views

How to write a simple interpreter / DSL with Wolfram Language?

I am specifically trying to write an interpreter for Mathematica predicates to MongoDB aggregation stages, but I wanted to phrase the question a bit more generically because I can see many times one ...
6
votes
2answers
163 views

Extract held value from Association

Consider an association which contains a key which must not be prematurely evaluated. assoc = <| key :> value |> For example, a value of ...
0
votes
0answers
24 views

Mathematica doesn't evaluate LinearSolve Function properly [duplicate]

Maybe this could be a stupid question, but I can't solve this problem. I'm trying to evaluate an expression with LinearSolve Function but it doesn't work. I have pre-evaluated the matrix ...
1
vote
1answer
107 views

WhenEvent how to handle events at the same time and detection order

I need to use WhenEvent inside NDSolve in which events happen simultaneously. I show simple code to better explain my question: ...
0
votes
1answer
65 views

How to prevent Table replacing expressions in argument

I have a function called velocitySolver, which takes in a list of geometric parameters as well as a condition involving those geometric parameters. Therefore, if I ...
0
votes
1answer
28 views

Create a table of plots in manipulate with redundant variables

I'm trying to create a table of diagrams of which each shows a different variable on the x axis and fetches the remaining parameters from the enclosing scope, a Manipulate object. So I have this code ...
0
votes
0answers
42 views

BellY function call fails

I would very much appreciate to get an answer about the reason of the message I get calling the BellY function. ...

1
2 3 4 5
28