For example, in a large program, there are two variables, m and n. I want to know if the two variables will affect each other. Is there a classic study in this area?
If you can collect pairs of variable values (n_i, m_i), then you can treat n and m as random variables and compute correlation coefficient (https://en.wikipedia.org/wiki/Correlation_and_dependence) its value gives answer if variables are dependent (but NOT if they are independent).
Hi Xiaohan, I'm not quite sure if I understand your question but if I assume that of the two variables, one is independent (explanatory), and the other is dependent (response). As such, you could use regression analysis to establish a relationship (correlation) or you could use a one-way Analysis of Variance (ANOVA) if the two variables are independent. In that case, there must be a third variable that is dependent and measured on a continuous scale.
Are the values of the two program "variables" derived from input? In that case the question of their interdependence is a statistical matter involving the nature of the variables as measures of some kind. The previous suggestions are applicable.
If you are talking about dependencies of two variables in a computer program -- that is, dependencies in the computation itself, that's a different kind of thing. If there are inputs that add variation, you are back to a version of the first case. If not, I suppose you need to find something that develops dependency graphs for the programming language used.
There has been such analysis available in spreadsheet software, for example.
There are also some classic approaches from analysis of programming language grammars and other problems. These are not statistical in nature. This involves creation of dependency matrices around immediate dependencies and then derivation of the transitive closure. That works even for mutual dependency. This creates either a sort of Boolean dependency (yes or no) or a shortest-path dependency, and there are some "classic" solutions. I think the greatest effort may be deriving the data for such analysis if the dependency is not obvious from inspection.