I'm trying to make a function where I'm making a derivative of a polynomial but it does not work as I expect. Consider this example
poly1=a*x^2 + t
poly2=D[poly1,x]
fun1[x_,t_]:=D[a*x^2 + t,x]
fun2[x_,t_]:=D[poly1,x]
fun3[x_,t_]:=poly2
now if I put
fun1[y,z]
or
fun3[y,z]
the result is what I want/expect:
$2ay$
but if I put
fun2[y,z]
the result is
$0$
Why is that?
I have a very long polynomial which I want to define as a function of derivatives of some polynomials of x and t. how I can solve the issue?
P.S. I have absolutely no idea what should I put as tag here!
y
tofun2
in thex
slot, it tries to differentiatepoly1
with respect toy
, which of course is zero. It works if you makepoly1
a function:poly1[x_, t_] := a*x^2 + t
(and call it appropriately). $\endgroup$