Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    $\begingroup$ If I'm understanding what you're asking for, the answer is "no". Variables don't really hold any contents. The Set (=) construct creates a rewrite rule in the environment. thing doesn't really have a value, it's not a reference to a memory location, for example. It's just something that the evaluator will replace according to the rewrite rule. Having said that, if the evaluator is running and encounters thing, it will immediately replace it, which is effectively "pasting its contents". However... $\endgroup$ Commented Nov 2, 2022 at 0:19
  • 1
    $\begingroup$ Just in case this might be what you want, there is an Iconize feature. If you select your (a+x) y expression and bring up the context menu, you can choose to iconize it. There is also the Iconize symbol. You can copy/paste this thing around the notebook. $\endgroup$ Commented Nov 2, 2022 at 0:21
  • 1
    $\begingroup$ So, for examle, execute Iconize[(a + x) y, "thing"]. Now you can copy/paste that icon into your NIntegrate expression. It'll look like a little gray thing labeled "thing", but it will really be the expression (a+x)y. $\endgroup$ Commented Nov 2, 2022 at 0:32
  • 1
    $\begingroup$ @user293787 yes I meant with underscores. I'll fix that right now. $\endgroup$ Commented Nov 2, 2022 at 8:14
  • 1
    $\begingroup$ As the question is a common issue it might be helpful for other people searching for this problem to include the use case in the title. For example "define function using SetDelayed with a global variable as though it was pasted" $\endgroup$ Commented Nov 3, 2022 at 13:24