public void InverseLinkFunctionConstructorTest() { InverseLinkFunction target = new InverseLinkFunction(); Assert.AreEqual(0, target.A); Assert.AreEqual(1, target.B); for (int i = 0; i < 11; i++) { double x = i / 10.0; double y = 1 / x; Assert.AreEqual(y, target.Function(x), 1e-10); Assert.AreEqual(x, target.Inverse(y), 1e-10); } }
public void InverseLinkFunctionConstructorTest1() { double beta = 3.14; double constant = 2.91; InverseLinkFunction target = new InverseLinkFunction(beta, constant); Assert.AreEqual(constant, target.A); Assert.AreEqual(beta, target.B); for (int i = 0; i < 11; i++) { double x = i / 10.0; double y = (1 / x - constant) / beta; Assert.AreEqual(y, target.Function(x), 1e-10); Assert.AreEqual(x, target.Inverse(y), 1e-10); } }