Linked Questions

22 votes
2 answers
1k views

How to inject an evaluated expression into a held expression? [duplicate]

I know that there are methods to structurally manipulate held expressions (discussed e.g. here), but I failed to apply those for this particular problem: ...
István Zachar's user avatar
3 votes
1 answer
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 ...
Saran Tunyasuvunakool's user avatar
1 vote
0 answers
158 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 ...
Suzan Cioc's user avatar
  • 2,023
0 votes
1 answer
90 views

Evaluate part inside HoldForm [duplicate]

What I want to do is pretty straight forward: Entere something like this: HoldForm[Sum[la /. a -> b, {l, 0, N}]] and get something like this Σ lb Generally spoken, holding the sum but evaluating ...
John D.'s user avatar
2 votes
1 answer
78 views

ToString with delayed replacement [duplicate]

I want a toString method that replaces each occurrence of f[x_]. ...
H.v.M.'s user avatar
  • 1,093
2 votes
0 answers
62 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 ...
user13253's user avatar
  • 8,666
3 votes
0 answers
51 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 ...
user13253's user avatar
  • 8,666
603 votes
19 answers
157k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
47 votes
3 answers
3k views

What are all the "magic" symbols in the Mathematica language?

Leonid Shifrin once wrote (excerpted): (Unevaluated) is one of a very few "magic symbols", along with Sequence and <...
Mr.Wizard's user avatar
  • 272k
8 votes
7 answers
3k views

How to display very small numbers in Mathematica?

I am trying to evaluate the function: $$f(x) = \cos(x) - \mathrm{e}^{-2.7 x}$$ at $x = 1.7 \times 10^{-25}$ and Mathematica keeps returning '0.' How do I evaluate the expression in a better way?
Ray_56's user avatar
  • 81
18 votes
5 answers
737 views

Is it possible to construct a fullform trace function

Is it possible to construct a FullFormTrace function that takes an arbitrary expression and prints a sequence (or returns a list) of the evaluation steps in full ...
Bob Ueland's user avatar
  • 1,069
19 votes
3 answers
999 views

Generating assignments and transforming code inside held forms when generating code

I have been playing with slightly above trivial code manipulations in Mathematica. I thought Mathematica would be great for this kind of work because of rule replacement and expression manipulation, ...
Manuel Odendahl's user avatar
19 votes
4 answers
699 views

Replacing parts of a held expression with held parts of another expression

I'm applying the Trott-Strzebonski technique in order to replace inside a held expression. ...
Andrew Cheong's user avatar
22 votes
2 answers
2k views

Does Set vs. SetDelayed have any effect after the definition was done?

I was always assuming that the only difference between Set (=) and SetDelayed (...
celtschk's user avatar
  • 19.2k
10 votes
4 answers
335 views

Hold expression with RandomInteger

One more question for today: I'm trying to show two random integers with a plus (+) sign between them, in an unevaluated form. I know how Hold and HoldForm work, but they hold everything, including ...
Gabriel's user avatar
  • 1,877

15 30 50 per page
1
2 3 4 5