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*

6
  • $\begingroup$ The OP has the arguments a,b,c in a list. How do you get them from there into the part Hold[a,b,c] of your code at the end (without literally pasting them there of course)? $\endgroup$ Commented Mar 22, 2013 at 19:46
  • $\begingroup$ @SjoerdC.deVries I interpreted the problem so that it is not important how there are initially stored. One could start with the arguments: Unevaluated[{a,b,c}]/.{args__}:> ({a_,b_,c_} /. {patt___} :> SetDelayed @@ Hold[int[patt]], NIntegrate[f[args], {x, 0, 1}]]). Does this address your concern? $\endgroup$ Commented Mar 22, 2013 at 19:55
  • $\begingroup$ Actually not. Apart from the syntax error (Hold[int[patt]] has a ] too much), you again paste the arguments in the code instead of using the variable (argument) that contains them. I really believe that you should work from the named list as this seems part of the question (the OP mentions a really lengthy list). $\endgroup$ Commented Mar 22, 2013 at 20:09
  • $\begingroup$ @SjoerdC.deVries Sorry for the syntax, I did not test this one (usually I always test). To address your objection: Hold[argument]/.OwnValues[argument]/.Hold[{args__}]:>..., the rest the same as before. $\endgroup$ Commented Mar 22, 2013 at 20:11
  • $\begingroup$ Great, works as a charm. $\endgroup$ Commented Mar 22, 2013 at 20:25