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
2answers
65 views

How to force evaluation on the right of an @ operator?

Is there a way to force evaluation on the right before the Prefix operator (@) without using parentheses? I came across this question when I was working with the ...
6
votes
1answer
34 views

How to force evaluation of an expression with Part left unnevaluated?

My goal is to minimize a real valued multi-variable function averageFreeEnergyDensity. The function accepts an integer argument ...
5
votes
4answers
109 views

How to map Unevaluated over a list

I have a list {a1, a2, ...... , an}, in which all as have been initialized to a number. I want to get: ...
2
votes
0answers
43 views

Find the numerator of 6/8 [duplicate]

The statement Numerator[6/8] evaluates to 3. Numerator[Hold[6/8] does not work. What function NewNumerator[6/8] evaluates to 6?
4
votes
2answers
154 views

When are numerical expressions identical

Very elementary: 2 + 3 == 5 evaluates to True and 5 == 5 evaluates to ...
2
votes
2answers
71 views

Evaluation speed of apparently equivalent functions

Consider the following expressions: f[x_Integer] := x, f[x_] := x /; x ∈ Integers, f[x_?IntegerQ] := x All of the expressions above (and probably others which ...
4
votes
2answers
38 views

How to print unevaluated arguments in the form they were originally typed in?

I'm looking for a way to print a function's arguments, not only unevaluated, but also in the way they were originally typed in. By way of experimentation, I tried stuff like this: ...
1
vote
1answer
30 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: ...
4
votes
1answer
49 views
0
votes
0answers
31 views

Why is DownValues releasing RuleDelayed's hold for Graphics? [duplicate]

I am trying to understand DownValues in regards to the evaluation of its output. Consider this: ...
1
vote
1answer
37 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 ...
2
votes
1answer
50 views

Why isn't Table iterator value inserted in failed NIntegrate arguments?

Consider this simplest example: Table[{z, NIntegrate[f[x], {x, 0, z}]}, {z, {1}}] Here f is not defined, so ...
6
votes
1answer
74 views

Debugging a $RecursionLimit error?

I sometimes encounter bugs that involve a recursion limit. It's often very hard to find the origin of the problem. Would there be a way to copy the stack somewhere and abort the evaluation in order ...
5
votes
0answers
136 views

Built-in symbols which are more close to the root/core of Wolfram Language

Seeing the vast scope of science covered by the Wolfram Language (WL) and the large amount of built-in symbols (functions), I am curious to know which built-in symbols are more close to the root of ...
0
votes
0answers
25 views

What makes items with head `Function` different?

I apologize beforehand for the muddleheadedness of this question. It reflects the fact that I'm trying to interpret outward "behaviors" of Mathematica expressions without having any understanding of ...
16
votes
1answer
330 views

Quit the Kernel and start new session automatically

The question is how to quit the kernel, start a new session automatically, and to be able to run such procedure from e.g. Button. This is especially useful when ...
0
votes
0answers
23 views

Timing of an Evaluation is not correctly displayed

From: http://reference.wolfram.com/language/howto/DisplayTheTimingOfAnEvaluationInANotebookWindow.html I ran a process that took about two minutes to finish. But the time recorded is only 0.18 ...
0
votes
1answer
56 views

How do you stop Mathematica from evaluating a sum? [closed]

A concentration $A(i,j)$ varies over i,j. I'd like to include the summation of $A(i,j)$ in my Mathematica expressions, but it evaluates the sum ...
1
vote
0answers
37 views

Unexpected order of evaluation in ForAll

I noticed that ForAll behaves rather unexpectedly when its first argument is a symbol which has been Set in an outer scope. For ...
1
vote
1answer
45 views

How do you programmatically update a tag using the TaggingRules mechanism?

Consider the following simple front-end code: ...
0
votes
0answers
24 views

accessing solution of pde [duplicate]

How can I access the values of solution of a partial differential equation? For example given here, ...
1
vote
1answer
34 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 ...
-2
votes
1answer
95 views

Why does Mathematica “sleep” when I don't work at computer? [closed]

I started using Mathematica few days ago. I'm running this code: ...
4
votes
0answers
103 views

Why the flat f[x] is treated as ghostHead_[f[x]]?

While reading this answer I feel confused. If we do not care any specific detail of the original question, then ybeltukov's answer essentially makes use of the following fact ...
3
votes
1answer
142 views

Output an Expression in terms of GoldenRatio

Sorry if this is a dumb question (I'm new). I swear I searched and read forums first! I'm trying to rewrite expressions in terms of the Golden Ratio. For example, I know 9+4Sqrt[5] is Phi^6, but can ...
13
votes
3answers
225 views

Can't inject EncryptedObject

Here are minimal examples: ...
4
votes
2answers
117 views

Coarse-graining in numerical integrations

I have been working recently in a coarse-graining problem I found when using NIntegrate: I am trying to evaluate the function $$f(a)=\int_0^{\infty}x\,e^{-(a^2+b^2)x^2}\text{d}x$$ numerically as a ...
3
votes
1answer
75 views

Evaluation of Derivative in a Module

Can someone help me understand the evaluation procedure in the following two pieces of code? ...
1
vote
2answers
46 views

Evaluating and Plotting Multiple Zero-Counting Functions

In work that I am doing, I am trying to plot multiple zero-counting functions, depending on how a parameter works. For example, if the zeros of one function are {1, 2, 3, 4, 5, 6, 7}, the zeros of ...
2
votes
0answers
45 views

What is the difference between GenerateDocument and TemplateApply[NotebookTemplate[

Abstract GenerateDocument[ _NotebookObject ] seems to do the same what TemplateApply[ NotebookTemplate @ _NotebookObject ] ...
-1
votes
1answer
120 views

need help to price a european option using finite difference method [closed]

I am writing a function to price European option using backward induction finite difference method. The function is expected to price a European option taking Stock (stock_), age (time_), volatility ...
0
votes
2answers
40 views

Expand “hierarchical” system of equations

I have a system for equations that is structured hierarchically: - Level 0: these are base variables that I can measure from a process (e.g. a,b,c) - Level 1: these are variables derived from Level 0 ...
0
votes
2answers
42 views

Different behaviour of Map and Inner in replace rules

Why does x[{1, 2}] /. {x[l_] -> Map[func, l]} {1, 2} not behave as expected, while for example ...
0
votes
1answer
62 views

Why does Compile redo the calculation when overflow happens?

When implementing the Numerov method solving Schrodinger equation, I encountered this problem. In order to show the order of the evaluation, Print is added. ...
1
vote
1answer
70 views

How to Reap data from a ScheduledTask?

Here is an amusing little function mapped over a range just to iterate it. It ignores its argument and works entirely by side-effecting a global variable: ...
1
vote
0answers
76 views

How can I use L.Shifrin s code formatter package better

in the document of HoldAllComplete, it says: Evaluate cannot be used to override HoldAllComplete.. for example, when I'm ...
0
votes
0answers
27 views

Alter evaluation order when applying scalar multiplication to function

Consider the following program: g = 2f; g[x] (* (2f)[x] *) Is there any way I can change the above expression to have it return ...
5
votes
1answer
137 views

How is LHS = RHS; … ; RHS (nontrivially) different from … ; RHS

I'm trying to understand how Mathematica thinks about the results of Set. Suppose we perform LHS = RHS. I'm focusing on when ...
3
votes
2answers
47 views

Simplify with assumption of unknown function [duplicate]

I have an unknown multivariate function entry[x,y,z], which is positive. Then how to get FALSE and entry[1,2,3] in the following evaluations? ...
2
votes
1answer
86 views

Nested If statement with unevaluated arguments

I have a list of boolean functions {f1, f2, f3, ...} that take a value and return True or ...
27
votes
2answers
1k views

What are the cool kids talking about when they use ##&[]? [duplicate]

All the cool kids are apparently using ##&[] for Unevaluated @ Sequence[] but I have no idea what either means. ...
-1
votes
1answer
93 views

Recursion depth of 1024 exceeded during evaluation [closed]

This is my very first day using Mathematica, so please forgive me my complete ignorance... I fear that this might be one of those questions that gets rejected for being "easily found in the ...
1
vote
2answers
57 views

Coordinates of MeshPoints

The output of a set of differential equations solved with NDSolve produces a series of curves and I need to obtain the spacing between these curves at a given level ...
2
votes
2answers
66 views

How to apply list of values to a list of functions

I have the following: first= {1+a,2+a,3+a,4+a} and a list t={0,1,2,3} I want to evaluate the first element of "first" at ...
2
votes
1answer
83 views

Block assignments not quite sequential?

With scalars, Block acts like Scheme's let*, that is, the assignments (appear to) happen sequentially: ...
0
votes
2answers
40 views

Parallel evaluation hangs before doing anything

[I use Mathematica 9.0.1.0 on OS X Yosemite 10.10.2.] I am experiencing difficulty with parallel evaluation that I am finding extremely perplexing to troubleshoot. I define the following function in ...
2
votes
1answer
59 views

Show [In] and [Out] tags after quitting Mathematica

I cannot find a way to show [in] and [out] tags when evaluating cells after I close the application. Is there a way to keep these shown? I disabled the kernel in global options but cannot transfer ...
0
votes
1answer
44 views

How to see partial results during evaluation [duplicate]

I am computing a long Table[], but the computation of the last few elements is taking too long, and I am afraid I will never converge. I would like to access the ...
-1
votes
1answer
75 views

I have several functions and how I know which one is the maximum in a certain range?

What I did are the followings These lines will generate a piecewise function pw which tells me the corresponding variable given an interval as follows: Now, I want to get: names of variable ...