Example #1
0
 public BaseOperator(IEquation x, IEquation y, Func _fn, string _symbol)
 {
     LHS = x;
     RHS = y;
     fn = _fn;
     symbol = _symbol;
 }
        public Point[] Calculate(IEquation e, double start, double end)
        {
            List<Point> results = new List<Point>();
            equation ef = e.f;
            CalculateZeros cs = new CalculateZeros(ef);

            cs.FindZerosInRange(start, end);
            results = cs.Zeros;
            return results.ToArray();
        }
Example #3
0
 public MultiplyOperation(IEquation x, IEquation y)
     : base(x, y, (a, b) => a * b, "x")
 {
 }
Example #4
0
 public MinusOperation(IEquation x, IEquation y)
     : base(x, y, (a, b) => a - b, "-")
 {
 }
Example #5
0
 public DivideOperation(IEquation x, IEquation y)
     : base(x, y, (a, b) => a / b, "/")
 {
 }
Example #6
0
 public AddOperation(IEquation x, IEquation y)
     : base(x, y, (a,b) => a + b, "+")
 {
 }
 public CalculateValues(IEquation _myFunc)
 {
     segmentWidth = 0.01d;
     values = new List<Point>();
     myFunc = _myFunc;
 }
Example #8
0
        protected void ParseEquation(string equation)
        {
            equation = CheckForEvenOdd(equation);
            formula = Equations.CreateEquation<int>(equation);

            if (!ParsedEquationCache.TryGetValue(equation, out cacheInfo))
            {
                cacheInfo = new CacheInfo();
                cacheInfo.MatchingIndices = new HashSet<int>();
                ParsedEquationCache[equation] = cacheInfo;
            }
        }
Example #9
0
        /// <summary>
        /// Parse the equation text into in IEquation, or obtain from the cache if available
        /// </summary>
        /// <param name="equationText"></param>
        protected void ParseEquation(string equationText)
        {
            CheckForSimpleNumber(equationText);

            if (IsJustNumber)
            {
                return;
            }

            equationText = CheckForEvenOdd(equationText);

            if (!ParsedEquationCache.TryGetValue(equationText, out cacheInfo))
            {
                cacheInfo = new CacheInfo();
                Equation = cacheInfo.Equation = GetEquation(equationText);
                ParsedEquationCache.TryAdd(equationText, cacheInfo);
            }
            else
            {
                Equation = cacheInfo.Equation;
            }          
        }
 //================================================================
 //Getter and Setter
 //================================================================
 public void Equation(IEquation equation)
 {
     this.equation = equation;
 }
Example #11
0
 internal Function1P(Func <float, float> function, IEquation x0, Func <float, Action <string>, bool> validityChecker = null)
 {
     this.function        = function;
     this.x0              = x0;
     this.validityChecker = validityChecker;
 }
 public MandelbrotSet(IEquation equationIn)
     : this()
 {
     myEquation = equationIn;
 }
Example #13
0
 public void SetEquation(IEquation eq)
 {
     Equation = eq;
     Debug.Log("Changed equation");
 }
Example #14
0
 void Start()
 {
     Equation  = new SinusEquation();
     Transform = GetComponent <Transform>();
     Origin    = transform.position;
 }
Example #15
0
 internal Equation(IEquation equation)
 {
     this.equation = equation;
 }
Example #16
0
 internal LambdaFunction(Func <float, float, float> function, IEquation s, IEquation d, IEquation i, IEquation eq)
 {
     this.function = function;
     this.s        = s;
     this.d        = d;
     this.i        = i;
     this.eq       = eq;
 }