I am getting the operator & in outputs of pure functions. e.g. with the following code

transl[t0_] := Function[{f, t}, f[t + t0]];

dt = Function[{f}, f']; 

PnUnMinusPnM1UnM1 := 
 Function[{op, t0, t, a, n, p1, p2, pn, u1, u2, un}, op[1] + a transl[t0][op[p1], t] + a^2 (transl[t0][op[p2], t])];

PnUnMinusPnM1UnM1[dt, t0, t, a, n, p1, p2, pn, u1, u2, un]

I am getting the output

$(0\&)+a^2\ \text{p2}'(t+\text{t0})+a\ \text{p1}'(t+\text{t0})$

Does anyone know what is going wrong? Thanks in advance

  • $\begingroup$ Your syntax is jumbled and it is unclear what you are trying to accomplish. Perhaps you could explain what you are trying to do? $\endgroup$
    – MarcoB
    Feb 3, 2022 at 17:39
  • $\begingroup$ I am trying to simplifies some heavy formula and I have just cut part of a line of the code. It is some recurrent formula which require some amount of math to be explained. $\endgroup$
    – Tok Tak
    Feb 3, 2022 at 18:29
  • $\begingroup$ try evaluating 1' remembering that dt[f] is just f' and the first term of the body of your function PnUnMinusPmM1UnM1 (not a good name for a function in a SX question by the way!) is op[1] == dt[1] == 1' $\endgroup$
    – fairflow
    Feb 3, 2022 at 19:10
  • $\begingroup$ I've put some guidance in the comments section but there are things you can do to help yourself here such as simplifying the function to a minimum size to demonstrate the problem. Trace back the execution of your function to see what is happening (Trace is useful here). Perhaps you realise that 0& is a constant function that always returns 0? I doubt you want to add that to other terms as + is not defined out of the box for functions. $\endgroup$
    – fairflow
    Feb 3, 2022 at 19:14

1 Answer 1


The derivative of 1 is 0&. That is, Derivative interprets the argument "1" to be a constant function, and the derivative of a constant function is a constant function that is everywhere 0. That is exactly what 0& is.

  • $\begingroup$ Okay, but how could one simplify formula of the form $16 \left((0\&)^2+1\right)^2 \sin ^4\left(\frac{\pi }{m}\right)$? $\endgroup$
    – Tok Tak
    Feb 3, 2022 at 18:25
  • 1
    $\begingroup$ The question rather is, why are you differentiating a constant function in this way: Function[f, f'][1]? $\endgroup$
    – Alan
    Feb 3, 2022 at 20:20
  • $\begingroup$ 0& needs an argument to be evaluated. $\endgroup$ Feb 4, 2022 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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