I know function subexpr, which automatically selects the common subexpression (I can not define my subexpression), and it uses exp(z).
subexpr(df)
sigma =
exp(-z)
ans =
sigma/(sigma + 1)^2
, and rewrite, which uses predefined functions like sin or exp
, and has, which only says if that subexpr exist in the function!
has(df,f)
ans=
1
also the following does not work:
syms a
subs(df,1/(1+exp(-z)),a)
ans =
a^2*exp(-z)