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

learn more… | top users | synonyms

0
votes
1answer
32 views

What's the difference between this differentiation? [on hold]

I've tried to evaluate a sum and get a result in terms of Zeta function. And I have results in two forms: ...
4
votes
1answer
86 views

Menu item “Interrupt Evaluation…” missing in V10

The menu item “Interrupt Evaluation…” seems to have disappeared in Mathematica 10 on OS X. Well, this is a bummer. I personally use Mathematica for very long calculations, and I was using this ...
13
votes
3answers
624 views

How do you programatically load data into symbols?

I am trying to convert a list of string names into symbols, which will then be used to store data. I have 24 files (where the name of each file is a member of the list mentioned above) that I need to ...
54
votes
5answers
27k views

Get a “step by step” evaluation in Mathematica

Is it possible in Mathematica to get a step-by-step evaluation of some functions; that's to say, outputting not only the result but all the stages that have led to it? Example : Let's say I want to ...
5
votes
3answers
206 views

difficulty abstracting the OptionValue pattern

I am building lots of functions that use Options and OptionValue and wanted to reduce the redundancy in the expressions that ...
0
votes
1answer
39 views

Ivar error with Fit inside Plot

I'm trying to plot this Plot[Fit[med,{1,x},x],{x,0,10}] Why this doesn't work? I find out that if I do ...
12
votes
1answer
315 views

What is the real default CellEvaluationFunction?

The default CellEvaluationFunction is Identity but one can quickly see that this is handled specially as an equivalent function, ...
3
votes
5answers
127 views

Algebraic expressions on pure functions

I would like to know how to perform algebraic operations with pure functions. Simple version: Here's a silly toy model: I want to transform the algebraic expression Sin*Cos into the function ...
6
votes
1answer
87 views

Functional-Style Partial Application and the Accumulator Pattern?

Following up on Functional-style Fixed-Length Queue Object?, I want to generalize it to a functional-style accumulator pattern. Lots of things look like accumulators, loosely defined as binary ...
2
votes
0answers
49 views

Functional-Style Fixed-Length Queue Object?

Following up on question Side-effecting an array in an association? and @Mr.Wizard's answer in there, I'm modernizing and tweaking Daniel Lichtblau's efficient queues and ran into a little roadblock. ...
3
votes
2answers
80 views

Side-effecting an array in an association?

I'm working on some classical data structures (stack, queue, etc.) and want to mimic oo style in MMA. As a first attempt, I want to store an array in an Association, like this: ...
0
votes
3answers
140 views

Avoid creation of OwnValues when inserting transformation rules into Experimental`OptimizeExpression

I have a large list of transformation rules that I want to simplify. I find Experimental`OptimizeExpression works as it gets me the answers. My question is: **I can only get this to work when I ...
2
votes
1answer
94 views

How to explain the behavior of Rule inside these functions [duplicate]

I'm trying to define a function that takes an expression and spits out a pure function involving a replacement rule of that function's variable. An example would be a function ...
2
votes
1answer
87 views

kernel Local crashes during the course of a For loop

I want to find the minimum of the function r[x,p] subject to the constraint w[x,p,t]==0 (t ...
3
votes
1answer
96 views

Can $\it{every}$ usage of While be changed into NestWhile?

Ok, I think this problem is more close to philosophy. :P I've some idea now. But I'm not sure whether it's correct. For the purpose of convenience, I will use some C-like code instead of MMA's. A ...
3
votes
2answers
49 views

Mathematica automaticly evaluates some cells

Is there a command or a trick to tell Mathematica to not automaticly evaluate some cells? I use the NMinimize function to calculates some coordinates and then use ...
0
votes
0answers
74 views

Memory problem in Mathematica 10

I'm having a problem with memory. I'm doing nonliner fits of several data lists to a system of differential equations. When I evaluate the "Do" cycle the memory grows with the iteration step up to my ...
0
votes
0answers
40 views

Evaluation inside Compile

here's a simple question: I have a function: ...
6
votes
1answer
214 views

How to simplify expression and use HoldForm at the same time?

Hopefully a simple problem for the experts here. I have a need many times to build a symbolic expression for an equation (say a PDE) to use for plot labels in a low level function inside ...
6
votes
2answers
176 views

Why does Mathematica appear to change the head of certain expressions?

I don't know if the question trivial or not (if so I will delete it), but here is what I have: I know that x x (* x^2 *) Looking at the full form gives ...
1
vote
2answers
115 views

Higher derivative [closed]

Is there more efficient way to rewrite this code in order to compute 2nd and higher derivatives of r=sqr{x^2+y^2+(z-a)^2}? ...
0
votes
1answer
50 views

Simplifying a symbolic product of rational powers

I'm trying to symbolically evaluate a lot of equations that can consist of up to 10 parameters. The form of these expressions is a product/quotient of rational powers of the mentioned parameters, ...
0
votes
0answers
31 views

Expressions to functions, and evaluation [duplicate]

When calculating derivatives a expression is the result: in:= f[x_,y_]:= 1 + 2 x + 3 x^2 y + 4 x y^2 in:= D[f[x,y],x] out= 2 + 6 x y + 4 y^2 how do i make this ...
14
votes
4answers
466 views

HoldForm doesn't hold form

In Mathematica version 10, HoldForm no longer produces the same results as in version 8 (edit: I only have versions 10 and 8 installed, so can't compare to version ...
2
votes
2answers
52 views

Order of Evaluate for Map

I would like to get a list of variable names as strings. For example, x = 1; y = 2; Map[SymbolName, Unevaluated /@ Unevaluated@{x, y}] {"x", "y"} This works ...
7
votes
3answers
827 views

Keyboard shortcut to evaluate notebook

(If this is entirely trivial, although I couldn't find an answer as much as I searched the archives, I will delete the question.) How could I add a keyboard shortcut to evaluate the entire notebook ...
4
votes
5answers
205 views

How to make a table of $\sum_{i=1}^n$?

I want to create a table of $\displaystyle \sum_{i=1}^n i^k$ for $1\le k\le 5$. The output I want to obtain is a TeXForm output as follows. \begin{align} ...
4
votes
1answer
120 views

Example from Mathematica documentation (ExtremeValueDistribution) seems to be evualting “forever”

I am referring to this example at the reference page for the extreme value distribution: http://reference.wolfram.com/mathematica/ref/ExtremeValueDistribution.html#6764486 The first three commands ...
9
votes
3answers
117 views

Implement settable properties

I am looking for advice on implementing the following. (It is possible that the answer is that it is simply not a good idea to do this.) I would like to have an object similar to ...
4
votes
2answers
64 views

With command does not behave as expected according to its Attributes

The attributes of the With command are HoldAll which means it should not evaluate its arguments before its starts its business. ...
5
votes
5answers
533 views

Prevent Part[] from trying to extract parts of symbolic expressions

If you have a list, e.g. {1, 2, 3} then you can extract the $k$th part using Part (...
2
votes
0answers
42 views

Timing of ParallelDo versus Do: simple example [duplicate]

I'm trying to understand why a simple do-loop takes substantially longer when done in parallel than sequentially: ...
10
votes
2answers
205 views

Why doesn't a Composition[] hold its arguments and what can be done about it?

Now that Composition (also RightComposition) has shorthand syntax I am more inclined to use it, however what I feel should be ...
3
votes
1answer
89 views

ExampleData menu view

I'm trying to build an ExampleData browser, so that the "collection"/"type" is selectable in a drop down menu, and the "name" is selectable in another drop down menu. What I have so far: ...
9
votes
1answer
232 views

Performance of Dispatch and lists of Rules

The issue outlined here seems to be no longer present in version 10, if you use a Dispatch table! This because a Dispatch table ...
1
vote
2answers
50 views

Pattern matching to head with HoldFirst

I want to define a function that only operates on expressions with a head from a given list, such as f[expr:(_And|_Or)] := Print["LHS is ", expr[[1]]]; This of ...
3
votes
1answer
133 views

Gateaux (directional) derivatives and higher order differentials of a functional

I would like to calculate the Gateaux derivative of a functional (i.e. a function depending on functions). A simple example for the Dirichlet functional: $L(u(x))=\int_0^1 \frac{1}{2} (u'(x))^2 dx$ ...
1
vote
2answers
156 views

How to get the absolute difference between two angles

I need a function that will give me the shortest separation between angles that range from -pi to pi. For example if I have two angles 3pi/4 and -3pi/4, I would like a function that will tell me pi/2 ...
1
vote
1answer
85 views

Generate conditions seems to not work [closed]

I am trying to compute the following integral Integrate[E^(I*k*Omega*t), {t,0,T}, GenerateConditions->True] for which Mathematica returns ...
8
votes
3answers
601 views

Why are functions called first-class objects in Mathematica?

I've heard lots of people say a function is a first-class object in Mathematica. "Everything is an expression, including function." "There is no distinction between functions and data." Having read ...
1
vote
0answers
69 views

How to implement nested With as a single construct using functional programming (Fold)?

It is possible to define my own With construct where each local constant can depend on the previous defined local constants? I wish to replace something like this ...
-3
votes
1answer
77 views

Why does the function Evaluate speed up one function by orders of magnitude and another function not at all?

I've got two functions, one sample function (function 1) i've created for demonstartion purposes here, and my actual function. The function Evaluate speeds up the sample function by orders of ...
0
votes
1answer
107 views

Why does Evaluate fail? [closed]

If i use this code: ...
1
vote
1answer
76 views

FindRoot with vector functions

I'm trying to solve a system of non-linear equations with FindRoot, and I get the answer, but also a ...
0
votes
1answer
120 views

How does Mathematica interpret a expression?

I'm a beginner to Mathematica. I'd read several document. But I still have a problem. For example, every expression in Mathematica are of the form ...
2
votes
1answer
80 views

ParallelEvaluate: Evaluation Rules and Increment

I'm trying to understand how ParallelEvaluate works, considering the two following snippets: ...
0
votes
3answers
65 views

Automatically evaluate next cell

I am new to Mathematica. I am trying to achieve the following: I need one input cell in which I set parameters, then another input cell where functions are defined and calculations are performed. ...
3
votes
1answer
53 views

Print prints into the Messages notebook rather than into the evaluation notebook

Some time ago I noticed that the results of the evaluating the function Print[something] does not emerge in a new cell created in the notebook where the operation ...
2
votes
3answers
166 views

will the same result be evaluated twice per evaluation?

here is the silly question of mine, if mathematica takes 3 seconds to evaluate the function ...
1
vote
0answers
62 views

Expression for evaluating multiple functions?

I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate ...