nerdamer.setVar('M', 'matrix([a, b], [x^2, y-4])'); var x = nerdamer('a*x*M'); console.log(x.toString());