Exemplo n.º 1
0
        public override Term MultiplyWith(Term other)
        {
            var multipliedVals = TermHelper.MultiplyValues(this, other);
            var asdasdasdasd   = Limits.BreakDown(other.Limits).First(lim => lim.IsWithin(Limits) && lim.IsWithin(other.Limits));

            if (Limits is null)
            {
                return((Number)0);
            }
            return(TermHelper.Create(multipliedVals.Numerator, multipliedVals.Denominator, Limits));
        }
Exemplo n.º 2
0
        public override Term[] AddWith(Term other)
        {
            if (Spliceable(other))
            {
                return new[] { Splice(other) }
            }
            ;
            if (!AffectedBy(other))
            {
                return new[] { Clone(), other.Clone() }
            }
            ;
            var added = TermHelper.AddValues(this, other);

            if (Limits == other.Limits)
            {
                return new[] { TermHelper.Create(added.Numerator, added.Denominator, Limits) }
            }
            ;
            var tempList = new List <Term>();

            foreach (var limits in Limits.BreakDown(other.Limits))
            {
                var withinA = limits.IsWithin(Limits);

                var withinB = limits.IsWithin(other.Limits);
                if (withinA && withinB)
                {
                    tempList.Add(TermHelper.Create(added.Numerator, added.Denominator, limits));
                }
                else if (withinA)
                {
                    tempList.Add(TermHelper.Create(Numerator, Denominator, limits));
                }
                else if (withinB)
                {
                    tempList.Add(TermHelper.Create(other.Numerator, other.Denominator, limits));
                }
            }
            return(tempList.ToArray());
        }