private double evaluate(Node node) throws Exception {
		double value = 0.0;

		if (node == null) {
			throw new Exception("evaluate: Failed because of null node!");
		}

		switch (node.type) {

		case Node.GROUP:
			value = evaluate(node.left);
			break;
		case Node.OP:
			value = evaluateOp(node);
			break;
		case Node.INTRINSIC:
			value = evaluateIntrinsic(node);
			break;
		case Node.VALUE:
			value = node.value;
			break;
		case Node.INDEPENDENT:
			if (node.op == X) {
				value = x;
			}
			else {
				if (node.op == Y) {
					value = y;
				}
				else {
					if (node.op == Z)
						value = z;
				}
			}
			break;
		default:
			throw new Exception("evaluate: Unknown type!");
		}

		return value;

	}