Zero out sensitivities of one independent variable to another
Current behavior
Presently, if we have a dependency graph like this:
graph TD;
A-->x;
B-->y;
x-->y;
and we ask for \frac{\partial \{A,B\}}{\partial \{x,y\}}
, then we ask that \frac{\partial x}{\partial y}
be calculated.
This is an interesting situation since A
depends on both x
and y
, but x
and y
are both independent variables. It also seems somewhat self contradictory to ask for \frac{\partial x}{\partial y}
when both are independent variables.
The problem
However, we have examples of where this occurs in our codes. For example, if we choose T,\rho,y_i
as independent variables for purposes of composing a Jacobian then we also have the situation where T
depends on composition. However, we want \left.\frac{\partial \phi}{\partial T}\right|_{\rho,y_i}
.
Proposed new behavior
Consider changing the graph introspection so that if any path between the declared independent variables is found, then the resulting sensitivity is zeroed. In other words, if we request \frac{\partial \phi_i}{\partial x_j}
then this will actually imply \left.\frac{\partial \phi_i}{\partial x_j}\right|_{x_{i\ne j}}
.