public DefaultDependencyResolverTest()
        {
            this.simplifier     = new Simplifier();
            this.differentiator = new Differentiator();

            this.resolver = new DefaultDependencyResolver(
                new Type[] { typeof(ISimplifier), typeof(IDifferentiator) },
                new object[] { this.simplifier, this.differentiator });
        }
        public DefaultDependencyResolverTest()
        {
            this.simplifier = new Simplifier();
            this.differentiator = new Differentiator();

            this.resolver = new DefaultDependencyResolver(
                new Type[] { typeof(ISimplifier), typeof(IDifferentiator) },
                new object[] { this.simplifier, this.differentiator });
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Processor" /> class.
        /// </summary>
        /// <param name="lexer">The lexer.</param>
        /// <param name="parser">The parser.</param>
        /// <param name="simplifier">The simplifier.</param>
        /// <param name="differentiator">The differentiator.</param>
        /// <param name="parameters">The collection of parameters.</param>
        public Processor(ILexer lexer, IParser parser, ISimplifier simplifier, IDifferentiator differentiator, ExpressionParameters parameters)
        {
            Lexer          = lexer;
            Simplifier     = simplifier;
            Differentiator = differentiator;
            Parser         = parser;

            Parameters    = parameters;
            NumeralSystem = NumeralSystem.Decimal;
            DoSimplify    = true;
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Derivative" /> class.
        /// </summary>
        /// <param name="differentiator">The differentiator.</param>
        /// <param name="simplifier">The simplifier.</param>
        /// <param name="args">The arguments.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="args"/> is null.</exception>
        public Derivative(IDifferentiator differentiator, ISimplifier simplifier, IExpression[] args)
            : base(args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            this.Differentiator = differentiator;
            this.Simplifier     = simplifier;
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Processor"/> class.
 /// </summary>
 /// <param name="lexer">The lexer.</param>
 /// <param name="parser">The parser.</param>
 /// <param name="simplifier">The simplifier.</param>
 /// <param name="differentiator">The differentiator.</param>
 public Processor(
     ILexer lexer,
     IParser parser,
     ISimplifier simplifier,
     IDifferentiator differentiator)
     : this(
         lexer,
         parser,
         simplifier,
         differentiator,
         new TypeAnalyzer(),
         new ExpressionParameters(AngleMeasurement.Degree, new ParameterCollection(), new FunctionCollection()))
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="LS2EliteStrategyGenerator"/> class.
        /// </summary>
        /// <param name="dimensions">The dimensions to fit generated sparks into.</param>
        /// <param name="polynomialFit">The polynomial fit.</param>
        /// <param name="differentiation">A function differentiator.</param>
        /// <param name="solver">A polynomial function solver.</param>
        /// <exception cref="System.ArgumentNullException"> if <paramref name="differentiation"/>
        /// or <paramref name="solver"/> is <c>null</c>.
        /// </exception>
        public LS2EliteStrategyGenerator(IEnumerable <Dimension> dimensions, IFit polynomialFit, IDifferentiator differentiation, ISolver solver)
            : base(dimensions, polynomialFit)
        {
            if (differentiation == null)
            {
                throw new ArgumentNullException(nameof(differentiation));
            }

            if (solver == null)
            {
                throw new ArgumentNullException(nameof(solver));
            }

            this.differentiation = differentiation;
            this.solver          = solver;
        }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpressionFactory"/> class.
 /// </summary>
 public ExpressionFactory(IDifferentiator differentiator, ISimplifier simplifier)
 {
     this.differentiator = differentiator;
     this.simplifier     = simplifier;
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Del"/> class.
 /// </summary>
 /// <param name="differentiator">The differentiator.</param>
 /// <param name="simplifier">The simplifier.</param>
 /// <param name="expression">The expression.</param>
 public Del(IDifferentiator differentiator, ISimplifier simplifier, IExpression expression)
     : base(expression)
 {
     this.Differentiator = differentiator;
     this.Simplifier     = simplifier;
 }
Beispiel #9
0
        public void LS2EliteStrategyGenerator_NegativeParams_ArgumentNullExceptionThrown(IEnumerable <Dimension> dimensions,
                                                                                         IFit polynomialFit,
                                                                                         IDifferentiator differentiation,
                                                                                         ISolver solver,
                                                                                         string expectedParamName)
        {
            ArgumentNullException actualException = Assert.Throws <ArgumentNullException>(() => new LS2EliteStrategyGenerator(dimensions, polynomialFit, differentiation, solver));

            Assert.NotNull(actualException);
            Assert.Equal(expectedParamName, actualException.ParamName);
        }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DoubleUnaryFunction"/> class.
 /// </summary>
 /// <param name="f">A function delegate that takes a double value as a parameter and returns a double value.</param>
 /// <param name="d">The <see cref="IDifferentiator"/> to use.</param>
 /// <param name="i">The <see cref="IIntegrator"/> to use.</param>
 public DoubleUnaryFunction(MathFunctions.DoubleUnaryFunction f, IDifferentiator d, IIntegrator i)
 {
     _function       = f;
     _differentiator = d;
     _integrator     = i;
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DoubleUnaryFunction"/> class.
 /// </summary>
 /// <param name="f">
 /// A function delegate that takes a double value as a parameter and returns a double value.
 /// </param>
 public DoubleUnaryFunction(MathFunctions.DoubleUnaryFunction f)
 {
     _function       = f;
     _differentiator = null;
     _integrator     = null;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FloatUnaryFunction"/> class.
 /// </summary>
 /// <param name="f">
 /// A function delegate that takes a float value as a parameter and returns a float value.
 /// </param>
 public FloatUnaryFunction(MathFunctions.FloatUnaryFunction f)
 {
     _function       = f;
     _differentiator = null;
     _integrator     = null;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FloatUnaryFunction"/> class.
 /// </summary>
 /// <param name="f">A function delegate that takes a float value as a parameter and returns a float value.</param>
 /// <param name="d">The <see cref="IDifferentiator"/> to use.</param>
 /// <param name="i">The <see cref="IIntegrator"/> to use.</param>
 public FloatUnaryFunction(MathFunctions.FloatUnaryFunction f, IDifferentiator d, IIntegrator i)
 {
     _function = f;
     _differentiator = d;
     _integrator = i;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FloatUnaryFunction"/> class.
 /// </summary>
 /// <param name="f">
 /// A function delegate that takes a float value as a parameter and returns a float value.
 /// </param>
 public FloatUnaryFunction(MathFunctions.FloatUnaryFunction f)
 {
     _function = f;
     _differentiator = null;
     _integrator = null;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Derivative" /> class.
 /// </summary>
 /// <param name="differentiator">The differentiator.</param>
 /// <param name="simplifier">The simplifier.</param>
 /// <param name="expression">The expression.</param>
 /// <param name="variable">The variable.</param>
 /// <param name="point">The point of derivation.</param>
 public Derivative(IDifferentiator differentiator, ISimplifier simplifier, IExpression expression, Variable variable, Number point)
     : this(differentiator, simplifier, new[] { expression, variable, point })
 {
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Derivative" /> class.
 /// </summary>
 /// <param name="differentiator">The differentiator.</param>
 /// <param name="simplifier">The simplifier.</param>
 /// <param name="expression">The expression.</param>
 public Derivative(IDifferentiator differentiator, ISimplifier simplifier, IExpression expression)
     : this(differentiator, simplifier, new[] { expression })
 {
 }