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

learn more… | top users | synonyms

2
votes
1answer
202 views

Nested Derivative

These two expressions are mathematically the same, but when substituting with the same rule, yield different results. What is happening? ...
3
votes
1answer
77 views

Where do Mathematica's probability functions draw a line in the sand for predicates?

Thinking about a recent question mis-posted here (belonged on math), I noted the following. A contrived example - probability that a or b are 1: ...
2
votes
2answers
90 views

Merging two held expressions into a held compound expression

Consider e1 = Hold[a = x + x; b = y + y + y]; e2 = Hold[c = a + a + b + b + b; c^2]; How can I obtain the following? ...
8
votes
1answer
169 views

Why does Plot[Hold[x], {x,0,1}] work?

It appears that, counter to my expectation, all of these (and probably many others) seem to work fine: ...
2
votes
0answers
66 views

Assign a value to a variable without using Set or SetDelayed?

I supose probably yes, but at the end I assume that internally mathematica has to use Set or SetDelayed. Am I right? Background: I am developing a super simple phraser that takes a code description ...
1
vote
1answer
46 views

Commutative algebra by generators and quadratic relations

My apologies if this has been asked before. Please also be gentle, as this is my first question here. I am trying to define a commutative algebra by generators and relations in the following way. ...
0
votes
0answers
48 views

Dynamically Update Inset within Graphics with RunScheduledTask

I followed the instructions given below to play with RunScheduledTask within DynamicModule. ScheduledTask with scoped ...
3
votes
2answers
132 views

Stopping a head from evaluating more than once

While attempting to answer my own question, Is there a way to "hold" prefix / infix / postfix notation?, I came across the need to evaluate a recursive function only one level deep. For ...
9
votes
2answers
294 views

How to see which arguments are passed into a function

It is often that one wonders which arguments are evaluated before being passed into a function. I would like to know if it is possible to see which argumets are being passed into a function without ...
12
votes
2answers
109 views
1
vote
1answer
43 views

Cell seems to be evaluating in exponential time even though it shouldn't

I am trying to implement Newton's method for a given function f[x] and a starting x-value xval. The code should print out each new x-value as it approaches one of the zeroes of the functions. g[x] is ...
12
votes
2answers
147 views

How to find out what files are touched when Get is called?

Is there a way to capture all package files touched whenever a package is called via Get, Needs, ...
0
votes
2answers
78 views

Defining Piecewise Functions in Modules

In short, my question is the same as my previous one except that everything is now wrapped up in a module. The relevant code I'm working with is: ...
3
votes
1answer
84 views

How to calculate the residue of $1/f(z)$ at a numerical approximation to a root of $f(z)$?

The input Residue[1/DirichletL[19,10,s],{s,s0}] gives 0 even when s0 is a root. For ...
1
vote
0answers
85 views

Is there a way to stop evaluation immediately?

Sometimes I'll have a loop that I accidentally made too big. I'll evaluate, and MM will try to run through the entire loop. The program itself doesn't actually seem frozen... I can go to Evaluation-> ...
6
votes
2answers
112 views

Partial result of aborted evaluation of FullSimplify

When FullSimplify invoked on a large expression, it can run for hours. If I do not have time to wait, and abort the evaluation, I get no result, although, ...
0
votes
1answer
99 views

Symbolic vs. numeric evaluation is incorrect [closed]

In Mathematica 9: I have two functions f[v] and g[v]. When I do f[g[0]], I get the correct ...
9
votes
1answer
92 views

Why does $Failed have attribute HoldAll?

Why does $Failed have attribute HoldAll? Are there typical situations where $Failed is ...
2
votes
2answers
130 views

Generating an editable table that can be used as input

Say I have a number $n_{max}$. I want a command to generate a table like 1 1 2 2 3 3 4 4 ... nmax nmax where the second column is editable, and this table can be ...
1
vote
0answers
56 views

How to extract a variable names (not values) from a list of transformation rules?

I am trying to extract variable names from a list of transformation rules mapping = {var1 -> 'val1', var2 -> 'val2' }. Variables ...
2
votes
1answer
236 views

Why does Mathematica evaluate Sin[2.0] but not Sin[2]?

I can't understand why is it that In[88]:= Sin[2] Out[88]= Sin[2] while In[89]:= Sin[2.0] Out[89]= 0.909297 I even tried ...
0
votes
1answer
199 views

Pass unevaluated function with evaluated arguments

I am almost sure that this question has been asked somewhere. I found similar ones, but I cannot find exactly what I need, which might mean that I am on the wrong track. I search a method to pass an ...
0
votes
0answers
38 views

Faster evaluation of an expression for brute force optimization [duplicate]

I'm trying to bruteforce an optimization problem and I want to generate roughly a million function evaluations. I was wondering what would be the best for me to do in terms of having the expressions ...
3
votes
2answers
127 views

How to define the irrational domain or any other arbitrary domain?

I have found no way to define the domain of Irrational numbers. I can easily define a test to see if a number is irrational by defining: ...
0
votes
0answers
61 views

Evaluation - separate Output window + not evaluate particular cells

is it possible to avoid that mathematica writes the output into the nb file? I would prefer that mathematica writes the output into a separate file. If it writes into the notebook (I usually use: ...
3
votes
2answers
137 views

Bare symbol invocation fails but not if used with an argument

How to achieve the following behavior on a symbol f? Background: The main goal is to use the symbol to tag an abstract data structure where downvalues are used to store information. Only defined ...
1
vote
2answers
126 views

Converting expression into string without evaluating it

How can one convert a Mathematica expression into a string without the expression being evaluated first? I tried using Hold, but it returns ...
6
votes
2answers
177 views

Evaluation in lambda function

If I have a function, that returns a function, for example: f[a_] := a^2 * # & then f[3] == 3^2 # & Is there a way ...
2
votes
1answer
146 views

Dynamic [ NotebookEvaluate [“_”] ]

A nice way to centralize various tasks in one notebook is the NotebookEvaluation function. For instance I can evaluate ten notebooks from a single notebook (e.g. ...
11
votes
3answers
592 views

Every second evaluation in notebook front end is slow

I'm having a rather baffling problem that Wolfram was unable to help me diagnose, and I'm hoping one of you geniuses in residence here can figure it out. (I don't get access to the Technical Support ...
-3
votes
2answers
92 views

Find the value by using FindRoot command [closed]

The equation x^4-3 x^3 = cos(3x)+3 has two real solutions on the interval from -10 to 10. Lets call these two solutions r and s. Use Mathematica's FindRoot command to find r and s. Now let M equal the ...
6
votes
1answer
59 views

How to reset the $ModuleNumber?

According to the documentation, we can reset $ModuleNumber to a positive machine integer. There is even an example in the doc: ...
3
votes
1answer
142 views

Order of operations, precedence in Mathematica [duplicate]

I get confused in the order of operations in Mathematica. For example, f /@ 10^{1, 2, 3} {10, 100, 1000} In my head, that ...
0
votes
1answer
64 views

Not evaluating all cells unless I explicitly evaluate each one?

I'm running a Mathematica (version 8) notebook. In one of the first few cells, it is supposed to plot some data. It uses a couple functions that are defined in an above cell. If I do Evaluation-> ...
2
votes
2answers
62 views

Confused with HoldForm in Postfix notation

Why does the following code produce different result? In my mental model, they should be the same. ...
2
votes
1answer
115 views

Strange results of definitions using OwnValues

I am asking this question simultatenously with this one, which is strongly related. I was trying to see if I could create the behaviour as in that question without using ...
7
votes
2answers
217 views

Another difference between Set and Setdelayed. Evaluation shortcut?

A little while ago I wondered why f[x_] = f[x] gives an infinite iteration. I ended up discovering the following difference in evaluation between ...
3
votes
4answers
252 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
157 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
229 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
735 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
94 views

Evaluate in Plot leads to function error

Please help - I'm really struggling to understand why this evaluates with errors. ...
4
votes
1answer
83 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
276 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
90 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 ...