# Questions tagged [hold]

Questions about functions which maintain an expression in unevaluated form, including the use and behavior of Unevaluated, Hold~ functions, Inactive related functions or Hold~ attributes.

299 questions
Filter by
Sorted by
Tagged with
39 views

### Exploring curl of a gradient of a scalar function

Suppose I want to explore $\nabla \times \nabla V$ where $V$ is some scalar function. It basically results in a zero. But I would only know why if I solve it on paper. I wanted to use Mathematica for ...
46 views

### How to instruct internal function to evaluate arguments only after numerical values are plugged in?

For convenience, let me start with a simple example. The following code calculates the sorted eigenvalues of a 4x4 Hermitian matrix with a parameter x ...
47 views

### How to force Mathematica to output a function using its alternate pretty form when using Apply? [closed]

By default, Bra is an undefined function. Let's say I have defined Bra, Bra[a___]:=... such ...
35 views

### How to stop Quantity from evaluating

I'm trying to get an expression to display, without it evaluating it's internal arguments, but for some reason, when given the Quantity function, HoldForm doesn't seem to do what I expect: Code ...
57 views

### Avoiding the memory requirements of an accumulation of returned Nulls (etc)

There is an extensive but relatively old answer to a similar question here, and there are many Qs and As about avoiding using Table where possible. My problem is a mixture of the two: I have been ...
39 views

### How to “Hold” variables assigned value inside DSolve?

Consider the following ODE: a = 0.8; b = 8; v = DSolveValue[{ u[x] == a*(b* u'[x] + u''[x]), u[4.925] == 4, u'[4.925] == 0.625 }, u[x], x] which gives ...
61 views

### Hold the value of a variable

This is my code xyzzy = 1; Hold[xyzzy] // ToString // StringLength The output is 11. This 2nd one below. ...
226 views

### HoldForm does not prevent evaluation

I'm still relatively new here, and I'm not a native speaker. I hope, I don't make any obvious mistakes when asking this question. For instance, I simply had no idea how to title it accurately. I'm ...
52 views

### How to get the symbol name of a list element?

Let's say we have a list g with variable d as its element: Clear[g, d] g = {1,2,3,d} Now <...
38 views

### why mathematica Holds the Solve on the set of equations in the diagonal a matrix?

Say I have a simple function F[x_, y_, z_, r_, a_, b_, c_, d_] := (1 - a + b - (b/3) (c x + d (y + z + r))) x And I want to solve the set of equations given by: <...
54 views

### Order of evaluation

I am having a hard time figuring this out: ( sample ) I have any matrix which can have an arbitrarily large dimension. ...
34 views

### Extracting name of symbol (variable name) from within a function not working

Abstract: I use a pattern so often that I needed to make a function for constructing it. A function getName[...] for extracting name of variable and value only ...
74 views

### How to use the SymbolName of variables along with Map and pure function

I want to label each point of a Graphics3D with the simplest method as possible. I tried many solutions like this : ...
35 views

### How to return a variable name and value from within a self-contained function block?

Abstract: I have viewed other solutions on StackExchange but none actually address using a fully self-contained function to return name and value of a variable. The only function that works requires ...
75 views

Why does Head[Sequence[b, c]] return c[Symbol] and not Sequence? Why does ...
77 views

...
71 views

### Releasing multiple nested Hold in a single expression simultaneously

Trivia: I need to take a coefficient list of a long list of complicated expressions of the form $\prod c_{ij} \left( p_{i,j}(x_1,x_2) \right)^n$ where $n$ is positive integer, and $i,j$ label ...
49 views

### The number 1 evaluates inside HoldForm sometimes

If I run the following code: ...
47 views

### Evaluating part of an expression, but delaying the rest

Say I have an expression g = x^2 + y^3; I tried writing this H[x_, y_] := Eigenvalues[Evaluate[{{0, g}, {g, 0}}]]; The ...
86 views

### Problem calling function defined with HoldFirst

V 12.1 on windows. I am trying to use nice function from a recent post How to directly get the TeXForm of each steps from Rubi? ps. to run MWE code below, requires Rubi package, which if you do not ...
44 views

### SetDelayed using local variables

I'm trying to define MakeBoxes for a bunch of functions all at once, but wish to do so within a loop as in the following example: ...
52 views

### Hold all the symbols from a huge list?

The two following codes work similarly: Num = 5; symbols = Hold[X1, X2, X3, X4, X5]; or ...
35 views

Example: ...
45 views

### Keeping equations in terms of specific variable

I'm new to Mathematica and really struggling with something seemingly simple. I'm trying to do an integration and keep the results in terms of the symbol $T_1$ and $A_i$:  T_1=\frac{\text{pi} A_i}{...
33 views

### Help with Evaluation controll/hold all attributes?

I'm making a sort of symbolic derivator, which needs to take its formulas in unevaluated form. ...
56 views

### Evaluation Control for interpolating functions

I would like to find the root of the third component of an interpolating function, here e.g. a BezierFunction p: ...
54 views

### Making a list of Strings from the SymbolNames for a list of Graphics

Having generated a list of plots, such as plot01 = Plot[Sin[x], {x, 0, 6}]; plot02 = Plot[Cos[x], {x, 0, 6}]; plotList = {plot01, plot02} Then create strings ...
40 views

### RandomVariate on multidimensional Bernoulli array

Executing... Map[RandomVariate, Map[BernoulliDistribution, RandomReal[1, 5]]] yields the expected result, e.g. ...
62 views

### Custom function which behaves like Evaluate

Question Is there a way to define a function which evaluates itself regardless of HoldAll, HoldFirst, ... ? Background I'm ...
92 views

### How to hold the expression when using ToExpression with TeXForm

I know {1, 1} // Apply[Defer@*Plus] can return 1+1 But if I want hold the form from TeXForm,what should I do? ...
28 views

### Define function that interleaves and then evaluates its arguments

I wish to define a function interleaveWithX[statements__] with behavior such that evaluating, for example, ...
168 views

### Why can't I use Inactive[D] in NDSolve?

I have a 2D rectangular domain with -L/2 < x < L/2 and 0 < y < D0, which is divided into two parts, with a ...
60 views

### LetL Breaks in ParallelEvaluate

This was a wild head-scratcher for me to hunt down, but I now am sure LetL is the culprit. Here's a small example: ...
60 views

### Vanishing function and Manipulate

Within Manipulate, I want to vanish certain controls if other controls satisfy a specific condition. The simplest case is to consider two checkboxes, ...
133 views

### Generate pattern held by HoldPattern

I am trying to match expressions that have factors with certain exponents. For instance, I would like to match as follows ...
59 views

### Map patterns to values

Suppose I have a list of named patterns: listofPatterns = {a_Integer, b_Real, c_?StringQ} I would like to have a mapping from a pattern to a certain value like: ...
130 views

### Why Optional in Set is not held by the HoldFirst attribute?

When evaluatingf[x_:x0] := x, x0 will be evaluated, regardless of the HoldAll attribute of <...
62 views

### Inactivate Controls within Manipulate

Given a certain Control object (checkbox, for example) within a Manipulate environment, my goal is to define another control ...
54 views

### Map a function to every given key of a nested association

Consider for example the nested association: myA = <|"d" -> <|"c" -> <|"a" -> 1, "b" -> 2|>|>|> It is easy to map a function to a ...
60 views

### Evaluate and PlotLegends

Related to this question here. I dont understand why Evaluated->True does not behave properly when also using PlotLegends. For example, running the code below ...
287 views

### How to Force Evaluation of Derivative in a Pure Function Definition

Let's say I have a function f1 = #^2 &; I want to calculate its derivative, perform some manipulations and make the result a pure function. I try ...
206 views

### Why does Unevaluated applied (@@) to a held expression not work?

I do not understand why Unevaluated sometimes does not work. Consider this expression: expr = Hold[a - a] Now let's say I ...
91 views

### Is it possible to use a previously defined value in subsequent definitions of a Block?

Is it possible to use a previously defined value in subsequent definitions of a Block? According to syntax coloration, this should work as expected, that is, ...
263 views

### Obtaining the terms of a summation alongside the result

I have a Sum expression: s := Sum[2x,{x,0,3}] As an exercise to explore the rewriting capabilities of the Wolfram Language, I ...
95 views

### Through does not have hold attribute?

Possibly Related to Unexpected behavior of KeyTake. Consider the following example, where I input #11 (last) is the misbehaving one. Am I missing something or do you agree there is a bug? ...
52 views

### After activating, inactive integral, output is coming same as input

I am trying to plot s w.r.t r (0,10). But because of inactive integral I am not able to. When I activate inactive integral, output is coming same as input. When I am trying to plot graph w.r.t r(0 to ...
48 views

### Prevent argument substitution in held expression when injecting into unevaluated code

I want to write a custom sow/reap pair to wrap any piece of code in sow[code] and call reap ...
50 views

### Evaluation control inside Compile

I have the following function ...