Solving for variables and constants