Hi,  you need to get the derivative with respect to both inputs.  That’s why func 3 does not work.  If you just differentiate the product you get qdp and pdq, partial derivatives with respect to inputs requires both p and q