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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }