Skip to main content

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.

34 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
59 views

Why does MatchQ[Hold[c + b + a], Hold[x_ + b + a]] return False?

Can anyone explain why the following pattern matches: [In1]:MatchQ[Hold[a + c + b], Hold[x_ + b + a]] [Out1]:True But this one fails: ...
user61796's user avatar
4 votes
0 answers
130 views

DynamicModule Error when assigning Nothing to variable

Assigning Nothing to a variable inside Module works as expected: ...
Paul's user avatar
  • 41
3 votes
0 answers
47 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 ...
Vince McKinsey's user avatar
2 votes
0 answers
49 views

Automatically iconize all Associations in output cells

I work with expressions containing large associations (<|…|>) as subexpressions, and I want to automatically iconize all such subexpressions in all output ...
Vladimir Reshetnikov's user avatar
2 votes
0 answers
99 views

Why does Plot function have HoldAll attribute?

I had an odd issue where my plot wasn't drawn correctly when I called it via Plot[Join[fs,gs], (*..*)]. However, these two versions worked: ...
Niklas Vest's user avatar
2 votes
0 answers
44 views

Hold parents of ArcTan

If this question is beating a dead horse about Hold, Inactivate etc., a close vote is fair enough. That being said, I'm curious ...
Adam's user avatar
  • 3,946
1 vote
0 answers
73 views

Understanding HoldFirst in QuickSort algorithm

I have read the implementation of QuickSort algorithm in WL from Roman Maeder's Computer Science with Mathematica (2000). The implementation is shown below. ...
LambdaHaskell's user avatar
1 vote
0 answers
58 views

Plot functions don't allow postfix function execution?

I'm confused about syntax of using // for postfix function execution. It fails in some situations where I would expect it to work. For example, it works with both <...
yirenng's user avatar
  • 21
1 vote
0 answers
132 views

Can't Export string made with StringForm?

This works. It returns "acb". StringForm["a``b", "c"] This doesn't work. ...
ppm's user avatar
  • 61
1 vote
0 answers
44 views

Generalised Hold pattern for currying

Let myFun[a_][b_] := myFun[a[b]] . The HoldFirst attribute will prevent evaluation of a. Is ...
user3257842's user avatar
1 vote
0 answers
101 views

A function that maps Held symbol to string

Rougly my question is about constructing a function that maps Hold[var] to "var" even when var has an assigned value. In details : ...
imida k's user avatar
  • 4,295
1 vote
0 answers
85 views

Speeding up value reassignments in ParallelTable

I am solving a differential equation of two closed functions using ParallelTable. For the attached code, I thought the computation time should be approximately proportional to ...
user16308's user avatar
1 vote
0 answers
64 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 ...
pudepied's user avatar
  • 246
1 vote
0 answers
67 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 ...
Jules Manson's user avatar
  • 2,457
1 vote
0 answers
187 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 ...
Histoscienology's user avatar
1 vote
0 answers
46 views

Differentiating functions of Set expressions

There are so many things in Mathematica I think I will never understand. Perhaps today there will be one fewer... B'[y]/.B->Function[y,y^2] Outputs ...
bjorne's user avatar
  • 569
1 vote
0 answers
84 views

EmbedCode not evaluating a list of Manipulates

I have created a simple FormPage that asks for some user input, and should display a list of manipulates which are influenced by the given input. I use EmbedCode to display my results. The code I used ...
user3423641's user avatar
1 vote
0 answers
90 views

Extracting function names in Manipulate to label plot

I have previously asked a question in regards to determining the labels of the dynamic graph that I have created, but by using SetAttributes and ...
Wilson's user avatar
  • 349
1 vote
0 answers
66 views

Hold Values of DensityPlot to use for an other DensityPlot

I have two surface functions, f[x,y] and g[x,y]. Assuming that the DensityPlot of ...
sekisushai's user avatar
1 vote
0 answers
131 views

How to "INJECT" with holding Evaluation, specifically into a WhenEvent

I am importing a set of differential and stochastic equations from an external package, and want to use Mathematica to analyse this. I am struggling building the set of equations that I can use with <...
Sander's user avatar
  • 1,866
1 vote
0 answers
87 views

Pretty equations in HoldForm[]

I have been generating equations programmatically, resulting in lists that look like this: {Log[2,(4^4)^3, 3 (Mod[2,4] 4), Log[root[2, 3], 4^4]} where 'root[x,y]'...
Michael Stern's user avatar
0 votes
0 answers
33 views

DisableFormatting for a single instance of Grid, but format expressions inside that Grid

I have an expression like: Grid[{{ HoldForm[ ... Grid[...] ... ] },{ ... Grid[...] ... }}] This almost gives what ...
Travis Bemrose's user avatar
0 votes
0 answers
131 views

How to Hold a Form function

For Example Hold[HoldForm[FullForm[x]]] ...
Rainb's user avatar
  • 295
0 votes
0 answers
62 views

Create a function from another by substituting arguments

Suppose I have a function f[x, coeff] ...
Max's user avatar
  • 291
0 votes
0 answers
113 views

Evaluating function of two variables inside NMinimize with respect to second argument

Consider three functions: f[t_, 1] := {Cos[t], 1, 0} f[t_, 2] := {Sin[2 t], 1, 0} f[t_, 3] := {Cos[t - 2], 1, 0} For each $k=1,2,3$, let $g(\cdot,k)$ be the ...
Matteo Raffaelli's user avatar
0 votes
0 answers
51 views

Best way to simplify a polynomial before making it the body of a function?

So, I'm dealing with iterated polynomials of a single variable—say they're anonymous functions labeled as $p_i$, i.e. p[1], p[2],...
thorimur's user avatar
  • 9,010
0 votes
0 answers
43 views

Inactivate Prints inside function?

If one has a piece of code with some prints, he can inactivate them using inactivate, like Inactivate[Print["test"];,Print]; (*returns nothing*) Hower, I ...
Giorgio Busoni's user avatar
0 votes
0 answers
117 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 ...
Nilabh's user avatar
  • 55
0 votes
0 answers
59 views

Evaluation control inside Compile

I have the following function ...
ThunderBiggi's user avatar
  • 1,195
0 votes
0 answers
176 views

Replace Integrate with NIntegrate

I have a symbolic integral with a pretty complex expression. I need it in symbolic form because I want to compute its derivative. ...
Girildo's user avatar
0 votes
0 answers
46 views

Editing the function argument

I'd like to construct a function, that changes its own input. The code ...
Leo's user avatar
  • 1,155
0 votes
0 answers
68 views

Trouble with UpSet(Delayed) and IgnoringInactive

I'm having problems setting an upvalue for a symbol that is supposed to ignore Inactive: IgnoringInactive[f[g[x]]] ^:= match; ...
QuantumDot's user avatar
  • 19.7k
0 votes
0 answers
39 views

Imitate Integrate's behavior with regard to the integrand parameter (scoping/naming)

Using Integrate, I can do any of the following: ...
rogerl's user avatar
  • 4,209
0 votes
0 answers
47 views

Evaluating multiple processes and sort the results

I would like to evaluate the code below and sort the two parameters {f2, M}. Say that i runs from 1 to 10 ...
MMA13's user avatar
  • 4,702