0
$\begingroup$

This question already has an answer here:

Another novice problem encountered. I am going to need a cardiology surgery. :(

For a simple example,

a = #1 &;
b = #2 &;
f = a^2 + b^2;
f

results in

(#1 &)^2 + (#2 &)^2

However, my goal is

(#1 )^2 + (#2 )^2

I know it can be done as

f=(#1)^2+(#2)^2

But still, substitution is necessary in my work, which means the step of a and b cant be neglected.

So what do I miss? Thanks:)

$\endgroup$

marked as duplicate by m_goldberg, J. M. is away Aug 1 '17 at 15:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    $\begingroup$ This is doable, e.g. f = Evaluate[a[#^2] + b[Null,#2^2]]&, but the fact that things have gotten so messy for something so simple is a sign that you're approaching whatever you want to do in the wrong way. What's wrong with not binding anything to a and b and then using a ReplaceAll or something? $\endgroup$ – b3m2a1 Aug 1 '17 at 3:03
  • $\begingroup$ Looks like a duplicate: 142072, do you agree? $\endgroup$ – Kuba Aug 1 '17 at 5:21

Browse other questions tagged or ask your own question.