public DualNumberFunction(Variable[] variables)
        {
            // Check for repeated use of the same variable.
            this.variables = ImmutableVariableCollection.Create(variables);

            // Important to have the values cached to avoid recomputing when the value, the gradient, and the Hessian are requested after each other.
            values = new PointCache<DualNumber>();
        }
        /// <summary>
        /// Creates a new instance of the derivative tester.
        /// </summary>
        /// <param name="function">The function to test.</param>
        /// <param name="variables">The variables to test.</param>
        public DualNumberDerivativeTest(Function function, params Variable[] variables)
        {
            this.function = function;
            this.variables = ImmutableVariableCollection.Create(variables);

            n = variables.Length;
            tolerance = 0.0001;
            perturbation = 1.0e-6;
            showAll = false;
            showNames = false;
        }
 public DualNumberTransform(Dictionary<Variable, DualNumber> transform, ImmutableVariableCollection variables)
 {
     this.transform = transform;
     this.variables = variables;
 }