Extracting variable name from Equation output
Posted: Tue Sep 23, 2014 4:08 am
Hi!
I am creating a program that generate a large amount of equation using variables C (constant) X1 X2 X3 X4 X5 and dependent variable IMPORTS.
The program generates equation using all variables or only few of them. C is present in all equations.
What I wish to do is keep track of how many times the coefficient of each variables is negative. So I created a vector to count if a coefficient is negative. In order to make sure the program is counting for the right variable, I need to extract the name of the coefficient from the equations (thus identify if the coefficient of X1 or X4 is negative).
Given an equation with varlist: IMPORTS C X1 X4 X5 and knowing that coefficient C(3) is negative -> this means that the coefficient of X4 is negative.
How would one go about this?
I am creating a program that generate a large amount of equation using variables C (constant) X1 X2 X3 X4 X5 and dependent variable IMPORTS.
The program generates equation using all variables or only few of them. C is present in all equations.
What I wish to do is keep track of how many times the coefficient of each variables is negative. So I created a vector to count if a coefficient is negative. In order to make sure the program is counting for the right variable, I need to extract the name of the coefficient from the equations (thus identify if the coefficient of X1 or X4 is negative).
Given an equation with varlist: IMPORTS C X1 X4 X5 and knowing that coefficient C(3) is negative -> this means that the coefficient of X4 is negative.
How would one go about this?