Linked Questions

3
votes
1answer
36 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 ...
3
votes
1answer
171 views

Evaluate an expression with variable values stored in the form “variable name” + val

Consider an expression exp = a^2 + b + c which has variables a, b, and ...
3
votes
1answer
244 views

different situations with Compilation of ConstantArray

First, we load some tools related to Compile for analysis. ...
2
votes
1answer
56 views

any way to stop all the following evaluations?

I often slect the whole notebook to evaluate. Sometimes some functions may return wrong parameters, which may happen, for example, I may have forgotten to specify values to some variables in the ...
2
votes
1answer
125 views

NMinimize works only if expression is pasted directly

Niminize works fine if I copy the minimized function directly by hands, but doesn't work if I try to do something like this: ...
2
votes
1answer
1k views

How to evaluate some parts of an expression inside Hold? [duplicate]

I want to return a Hold expression but with some parts pre-evaluated. The easiest way to explain this is probably through code example. Here is what I have ...
1
vote
1answer
93 views

How do I defer evaluate in conditional expressions when the arguments are list elements?

I'm trying to take a conditional expression like "3 > 1" as an argument for a function but without its evaluation before being passed. HoldForm works fine in situations like this: ...
1
vote
1answer
83 views

Emulating Case Pattern replacement

As most regular users, I have developed utility functions complementing the Wolfram language for frequent tasks. In particular, I have variations on Cases (see ...
1
vote
1answer
894 views

Collect and simplify both the coefficents and the matched patterns

(This is a far tighter version of a previous question I asked) The problem with Collect is that while Collect[exp, pattern, Simplify] will simplify the coefficients,...
0
votes
1answer
131 views

How to apply Set to held symbols listed in a variable?

I have a variable states that contains a list of held symbols: ...
0
votes
1answer
233 views

Extracting graphics primitives from a Graphics expression with ReplaceAll

If we have a graphics object, plt = Plot[Sin[x], {x, 0, Pi}] and we need to retrieve the discrete point data from it. This can be easily done by using ...
0
votes
1answer
1k 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 ...
3
votes
0answers
49 views

How does the code idiom for replacing part of a held expression work? [duplicate]

I've seen this idiom used in different programs but never fully understand why it is necessary. Could someone explain? Is it still the recommended way to replace some part of a held expression to its ...
2
votes
0answers
58 views

Purpose of construct `With[{var=myComputation[…]}, var/;True]`? [duplicate]

Could someone please give an illustrative example showing the purpose of construct of form With[{var=myComputation[...]}, var/;True]? Also, I wonder what kind of ...
1
vote
0answers
119 views

How to substitute inside Hold? How to create table of summation (with Sigma symbol) expressions? [duplicate]

I would like to create table of summation expressions, which are not evaluated, but summation limits are substituted. I can't accomplish this so far. If I write I get summation expanded. If I ...

15 30 50 per page
1 2 3 4 5