Esempio n. 1
0
        public Measure Divide(DerivedMeasure d)
        {
            if (d == this)
            {
                return(new BaseMeasure());
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power = -c.Power;
                a.Add(c);
            }
            a.RemoveAll(x => x.Power == 0);
            return(new DerivedMeasure(a));
        }
Esempio n. 2
0
        public Measure Multiply(DerivedMeasure m)
        {
            var t = new MeasureTerms();

            t.Add(new MeasureTerm(this, 1));
            foreach (var e in m.Terms)
            {
                t.Add(new MeasureTerm(e.Measure as BaseMeasure, e.Power));
            }
            return(new DerivedMeasure(t));
        }
Esempio n. 3
0
        public Measure Multiply(DerivedMeasure d)
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
Esempio n. 4
0
        public Measure Multiply(DerivedMeasure d)
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
Esempio n. 5
0
        public Measure Reciprocal()
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                c.Power = c.Power * -1;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
Esempio n. 6
0
        public Measure Divide(DerivedMeasure d)
        {
            if (d == this)
            {
                return(Empty);
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = Clone(e);
                c.Power = -c.Power;
                a.Add(c);
            }
            a.RemoveAll(x => x.Power == 0);
            return(new DerivedMeasure(a));
        }
Esempio n. 7
0
        public Measure Reciprocal()
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power *= -1;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
Esempio n. 8
0
        public Measure Exponentiation(int i)
        {
            if (i == 0)
            {
                return(Empty);
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                c.Power = c.Power * i;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
Esempio n. 9
0
        public Measure Exponentiation(int i)
        {
            if (i == 0)
            {
                return(new BaseMeasure());
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power *= i;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }