public static double 連続分布の相加平均(double x, XY[] items)
 {
     if (!items.Any()) throw new ArgumentException();
     if (x > items.Last().X) throw new ArgumentException();
     if (1 == items.Length)
     {
         return items[0].Y;
     }
     return Func6( x, items ) / ( items.Last().X - Math.Max( x, items.First().X ) );
 }
 public Interval(XY a, XY b)
 {
     A = a;
     B = b;
 }
 // x以降の面積
 public static double Func6(double x, XY[] items)
 {
     if (x <= items.First().X)
     {
         var intervals = Interval.GetIntervals(items);
         return Func7(intervals);
     }
     else
     {
         var intervals = Interval.GetIntervals(items).SkipWhile(a => x < a.A.X || x > a.B.X).ToArray();
         var first = intervals.First();
         first.A = new XY(x, CalcY(x, first.A.X, first.A.Y, first.B.X, first.B.Y));
         return Func7(intervals);
     }
 }