package net.woodyfolsom.msproj.ann2.math;

public class Tanh extends ActivationFunction{
	public static final Tanh function = new Tanh();
	
	public Tanh() {
		super("Tanh");
	}
	
	@Override
	public double calculate(double arg) {
		return Math.tanh(arg);
	}

	@Override
	public double derivative(double arg) {
		double tanh = Math.tanh(arg);
		return 1 - Math.pow(tanh, 2);
	}

}
