0
$\begingroup$

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$
2
  • 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, 2017 at 3:03
  • $\begingroup$ Looks like a duplicate: 142072, do you agree? $\endgroup$
    – Kuba
    Aug 1, 2017 at 5:21

0

Browse other questions tagged or ask your own question.