public void setFunction(int f_index) {
		switch (f_index) {
		case 0:
			f = new Function("sin(x)") {

				@Override
				public double evaluate(double x) {
					return Math.sin(x);
				}
			};
			break;
		case 1:
			f = new Function("exp(x)") {

				@Override
				public double evaluate(double x) {
					return Math.exp(x);
				}
			};
			break;
		case 2:
			f = new Function("1/(1+x^2)") {

				@Override
				public double evaluate(double x) {
					return 1.0 / (1 + x * x);
				}
			};
			break;
		default:
			f = new Function("0") {

				@Override
				public double evaluate(double x) {
					return 0;
				}
			};
			break;
		}
		repaint();
	}