/// <summary> /// Gets Besselian elements values for specified Juluan Day. /// </summary> /// <param name="jd">Julian Day of interest</param> /// <returns></returns> internal InstantBesselianElements GetInstantBesselianElements(double jd) { //if (jd < From || jd > To) // throw new ArgumentException($"Polynomial Besselian elements valid only for Julian Day in range [{From} ... {To}].", nameof(jd)); // difference, with t0, in step units double t = (jd - JulianDay0) / Step; return(new InstantBesselianElements() { X = X.Select((x, n) => x * Pow(t, n)).Sum(), Y = Y.Select((y, n) => y * Pow(t, n)).Sum(), L1 = L1.Select((l1, n) => l1 * Pow(t, n)).Sum(), L2 = L2.Select((l2, n) => l2 * Pow(t, n)).Sum(), D = D.Select((d, n) => d * Pow(t, n)).Sum(), Mu = To360(Mu.Select((mu, n) => mu * Pow(t, n)).Sum()), F1 = F1.Select((f1, n) => f1 * Pow(t, n)).Sum(), F2 = F2.Select((f2, n) => f2 * Pow(t, n)).Sum(), dX = Derivative(X, t), dY = Derivative(Y, t), dL1 = Derivative(L1, t), dL2 = Derivative(L2, t), dD = Derivative(D, t), dMu = Derivative(Mu, t) }); }
static void Main(string[] args) { var tree = new List <List <List <Foo> > > { new List <List <Foo> > { new List <Foo> { new Foo("a"), new Foo("b") }, new List <Foo> { new Foo("c") } }, new List <List <Foo> > { new List <Foo> { new Foo("x"), new Foo("y") } } }; IEnumerable <Tuple <Foo, int> > result = tree.SelectMany((L1, i) => L1.SelectMany(L2 => L2.Select(k => Tuple.Create(k, i)))); foreach (var si in result) { Console.WriteLine(si.Item1.s + ' ' + si.Item2); } }
static void Main(string[] args) { var tree = new List <List <List <string> > > { new List <List <string> > { new List <string> { "a", "b" }, new List <string> { "c" } }, new List <List <string> > { new List <string> { "x", "y" } } }; IEnumerable <Tuple <string, int> > result = tree.SelectMany((L1, i) => L1.SelectMany(L2 => L2.Select(k => Tuple.Create(k, i)))); foreach (var si in result) { Console.WriteLine(si.Item1 + ' ' + si.Item2); } }