# Tagged Questions

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

141 views

### UpValues evaluation with Dot operator

I would like to simplify some database notation, and I'm doing some tests with UpValues for that. For example, if I set this Upvalue fot tab1: ...
132 views

### Multiplication non-deterministic?

I have two vectors of 134 elements each ($mu$, and $gt$). $mu$ contains Integers, and $gt$ contains machine precision Reals. I execute the following simple expression multiple times without changing ...
140 views

### Using a variable to tell Mathematica which existing variable to manipulate

I have an estimation routine I have coded up, I want now to do some tests on it where I pick a particular parameter and run the estimation for differing values of that parameter. What I want is to be ...
216 views

### HoldForm: how does it interact with nested evaluations?

Here's an example to illustrate the issue I'm having. right = 8 - y; left = y^2 + 6; integrand = HoldForm[Evaluate[right]] - HoldForm[Evaluate[left]] (I ...
257 views

### Alternative to using global variables in functions?

Often times I find myself using unevaluated variables (i.e. they show up blue) as dummy variables in whatever I'm returning such that I can evaluate them as needed later on. A simple example is as ...
350 views

### Log function - why is Log[b,b] not being evaluated to 1?

Have been experimenting with the Log function to demonstrate simple Log relationships such as Log[xy], Log[x+y] etc. ...
558 views

### How to NOT simplify fraction

How can I prevent Mathematica from simplifying fractions? What I would like to do is run a test on a list of fractions to see how many are in their reduced form. For example, I have a list: ...
218 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 ...
406 views

### Summation of If statements

The following made me curious. Suppose you want to sum the if statement If[x[i] < 1., x[i]^2, 0.] over i=1,2, i.e. ...
119 views

### Turning evaluation off

I am making a directed graph, but Mathematica keeps trying to evaluate my labels. I know that I can just use " ", but I have a lot of input. Is there a way to turn evaluation off? ...
174 views

### Set promotes Rule to RuleDelayed?

In mentally building a model of how Mathematica works, I naively expected Set to create a Rule in a symbol's ...
156 views

### Is it possible to assign numbers generated in an Error-Message?

If I have a differential equation of the form ...
151 views

### Even with Evaluate[], Mathematica is plotting everything in the same color

The code evals[x_?NumericQ] := Eigenvalues[{{x^2, 2 x}, {x, 3 x^2}}]; Plot[Evaluate[evals[x]], {x, -1, 1}] gives both eigenvalues in the same color. I thought ...
324 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 ...
252 views

### Evaluation of Derivative in a Module

Can someone help me understand the evaluation procedure in the following two pieces of code? ...
126 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: ...
212 views

### How to make a defined symbol stay in symbol form?

How to make a defined symbol stay in symbol form? w = 3; g = 4; {w, g}[[2]] 3 I want the output to be ...
108 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 ...
70 views

### Evaluation control with TagSet

Suppose I have a property associated with two functions using TagSet: ...
135 views

### ReplacePart equivalent for Associations

I have a fairly complicated Association. I wish to use/create a function such as ReplacePart to operate on certain Keys within this multi-level Association. Here's ...
198 views

### Assigning an equation as a variable

I am compiling a calculator where many slider parameters are used to define a value, where the defined value may then be reused to define another value. I am unable able to, or at least been ...
423 views

### Why can't Mathematica parallelize this?

The following code makes mathematica print "ParallelTable::nopar1: [...] cannot be parallelized; proceeding with sequential evaluation." ...
99 views

### Can evaluation show what was evaluated along with results? [duplicate]

After I write and evauate the following lines in Mathematica: a = 1 b = 2 x = a + b It will show only the result : 3. I want mathematica to show the following ...
102 views

I need to feed to an external program a number of points (in Complex128 format) generated from the numerical evaluation of some function, e.g. $e^{i \vec{k}\cdot\... 1answer 201 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 ... 2answers 327 views ### Expectation of a family of random variables I did some search here, but seems that no one asked about this. I want to define a family of independent and identically distributed random variables,$x_1,...,x_n$, and then calculates the expected ... 1answer 352 views ### Manipulate executes expressions multiple times I am using Manipulate for a rather intricate front end for data visualization. I was getting very sluggish performance and was able to boil the problem down to a ... 2answers 54 views ### How to avoid 0 OverVector[F] to be evaluated as 0? I am fairly new in Mathematica and I am trying to work with scalars and vectors. I decided to denote vectors using OverVector (as example, ... 1answer 91 views ### Why doesn't my expression evaluate at the subkernel? Consider this code: ... 1answer 462 views ### Gâteaux (directional) derivatives and higher order differentials of a functional I would like to calculate the Gâteaux 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$... 1answer 97 views ### How to localize symbols on the right-hand side of Rule when using ReplaceAll? [duplicate] I am frustrated by the following: {1, 2, 3.0} /. a_Integer -> a + 1 The a on the left side of the arrow is localized and ... 2answers 181 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 ... 2answers 167 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 ... 2answers 102 views ### Confused with HoldForm in Postfix notation Why does the following code produce different result? In my mental model, they should be the same. ... 1answer 126 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 ... 1answer 96 views ### Map works but Thread doesn't This question may be trivial, but I can't get past it for the life of me. I have$n$matrices of dimension$p_i \times N_i$, with$i$indexing the$n$-set. I also have$n$vectors of the appropriate ... 1answer 64 views ### How to evaluate an expression via LinkWrite when the expression is only known at runtime? *** Here's the original post... I'm setting up a secondary kernel in sandbox mode with LinkLaunch, and need to pass various expressions to it for evaluation. These ... 1answer 64 views ### SelectionEvaluate executes out of turn I'm seeing some unexpected (to me) behavior from SelectionEvaluate. I've got a notebook with two sections. In section 2, I've got code that clears the notebook's ... 1answer 121 views ### Strange integration Bug introduced in 9.0 or earlier and fixed in 10.1 Note: Beginning with V10.1, this integral returns unevaluated but without error messages. I tried to evaluate this line ... 1answer 86 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 ... 1answer 145 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 ...
188 views

134 views

### Caching data in Mathematica package

Consider the following: m=Quantity[1,"meter"] If I run the package, it will return 1m But when I load the package, the ...
565 views

### Use output of NDSolve as an integration limit of NIntegrate

I've been working on a ODE, for a function y[t], that, due to it's complexity, has to be solved numerically. I then need to use the results of NDSolve, which I ...
325 views

### FunctionInterpolation Errors / Question re Evaluation Order and Options

I have using Mathematica functions that takes a Cartesian coordinate relative to the Earth (xyz) and converts it to a latitude, longitude, and altitude (lla). And here it is: ...
52 views

### An issue regarding the use of CopyToClipboard with dynamic content

Please, consider the following code: ...
102 views

### Working with ScheduledTasks inside DynamicModules

I have a question - is it possible to run ScheduleTask[] inside DynamicModule[]? What I have tried so far: ...
354 views

### Expanding huge expressions that simplify and factor

The following is for Mathematica 8.0.4 running on Windows 7 laptop (6GB memory). I have eight expressions that are unexpanded multivariate polynomials in 6 variables. They are huge expressions, so ...