using System.Collections.Generic;
public static void Main()
var points = SweepingMethod(0.01);
foreach (var point in points) {
Console.WriteLine("({0:0.000}; {1})", point.X, point.Y);
public static List<Point> SweepingMethod(double step)
var mus = new List<double> { 0.0 };
var lambdas = new List<double> { 0.0 };
while (x + step < 1 - Tolerance)
var l = -1.0 / (-2.0 - step * step + lambdas.Last());
var m = (Q(x) * step * step - mus.Last()) / (lambdas.Last() - 2.0 - step * step);
var lambda = lambdas.Last();
var y = (-step*(Math.Exp(1.0) - 1.0/(Math.Exp(1.0)) + 12.0)) / (lambda - 1.0);
var ys = new List<double> { y };
for (var i = lambdas.Count - 1; i > 0; i--)
y = lambdas[i] * ys.Last() + mus[i];
return ys.Select((element, index) => new Point(index * step, element)).ToList();
private static double Q(double x)
return 12.0 * x * (1.0 - x) + 26.0;
private const double Tolerance = 0.000001;
public double X { get; set; }
public double Y { get; set; }
public Point(double x, double y)