public Function(Member[] members) { foreach (var member in members) this.Members.Add(member); }
public static Function operator /(Function f1, Function f2) { f1.Sort(); f2.Sort(); List<Member> resultMembers = new List<Member>(); if (f1.Members[0].Power < f2.Members[0].Power) throw new Exception("Invalid Division: P1.MaxPower is Lower than P2.MaxPower"); while (f1.Members[0].Power >= f2.Members[0].Power && f1.Members[0].Сoefficient >= f2.Members[0].Сoefficient) { Member NextResult = new Member(f1.Members[0].Power - f2.Members[0].Power, f1.Members[0].Сoefficient / f2.Members[0].Сoefficient); resultMembers.Add(NextResult); Function TempPoly = NextResult; Function NewPoly = TempPoly * f2; f1 = f1 - NewPoly; f1.refreshMembers(); if (f1.Members.Count < 1) break; } return new Function(resultMembers.ToArray()); }