1
$\begingroup$

For composite functions (in this case q), is it necessary to list all the variables of the inner functions? For example, in the line below Column[, cant we just write q[z], or must we write q[z[x,y[x]]? Wouldn't it be really troublesome if our composite function has many layers?

y[x_] := x^2;
z[x_, y_] := y - x;
q[z_] := z^2;

Manipulate[
 {
  Column[
   {x, y[x], z[x, y[x]], q[z]}
   ]
  },
 {x, 1, 2}
 ]
$\endgroup$
  • 1
    $\begingroup$ Could use a With[]: With[{zz = z[x, y [x]]}, {zz, q[zz]}] $\endgroup$ – J. M. will be back soon Sep 27 '17 at 15:47
0
$\begingroup$
ClearAll[x, y, z, q]
With[{y = x^2}, {z = y - x}, {q = z^2},
 Manipulate[Column[{x, y, z, q}], {x, 1, 2}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.