> #ok to post ; > #Yifan Zhang, 12/1/2020 ; > ; > #Q1. ; > #(i) How many labeled ROOTED trees are there with 67 vertices and 12 leaves? (recall that a leaf is a vertex with no children) (ii) How many labeled connected graphs are there with 40 vertices and 43 edges? > #[Added Nov. 30, 2020: The procedure TreeSeqL(N,t) counts ROOTED labelled trees, according to the number of leaves, and not as (possibly) stated erroneusly in the lecture, unrooted trees]. > ; > read `M22.txt`; > ; > coeff(TreeSeqL(67, t)[67],t,12); 762668035595791008261768918050546247626868131307789154916300139847357281766830345010754357481701376000000000000000 ; > #the number of labeled rooted trees with 67 vertices and 12 leaves. > ; > ATreeSeq(40,4)[40]; 90324445150366623501655158316607196285055246080819484164096000000000 ; > #the number of labeled connected graphs with 40 vertices and 43 edges. ; > ; > #Q2. ; > #Write a procedure SeqRTchild(S,N), that inputs a finite set of positive integers, S, and a positive integer N, and outputs the first N entries in the lhe list enumerating rooted labeled trees where every vertex is either a leaf (i.e. 0 children) or has a number of children that must be in the set S. > #Output SeqRTchild(S,30) for the following sets S if it is in the OEIS, state the A-number. If it is not, say so. > > #(i) S={1,2} > > #(ii) S={1,2,3} > > #(iii) S={1,2,3,4} > > #(iv) S={1,3,4} > > #(v) S={2,3,4} > ; > SeqRTchild:=proc(S,N) local i, r, z, L: > r:=1; > > for i from 1 to nops(S) do > > r:= r+ (z^S[i]/S[i]!); > > od: > > L:=FunEqToSeq(r,z,N): > [seq(L[i]*i!, i=1..N)]; > > end: > ; > SeqRTchild({1,2}, 20);#A036774 [1, 2, 9, 60, 540, 6120, 83790, 1345680, 24811920, 516650400, 11992503600, 307069963200, 8598348158400, 261387760233600, 8573572885878000, 301809119163552000, 11349727401396384000, 454104511068656448000, 19261139319649202976000, 863322072620761353600000] ; > SeqRTchild({1,2,3}, 20);#A036775 [1, 2, 9, 64, 620, 7620, 113610, 1992480, 40194000, 916927200, 23341071600, 655922836800, 20169411662400, 673645440468000, 24285190867938000, 939899116892736000, 38870133445791648000, 1710655202853140544000, 79826043011286892320000, 3936948118406837614080000] ; > SeqRTchild({1,2,3,4}, 20);#A036776 [1, 2, 9, 64, 625, 7770, 117390, 2088520, 42771960, 991090800, 25635767850, 732235165200, 22890759391500, 777398836414200, 28501053507927000, 1121908690738836000, 47194400446765572000, 2112854517933207048000, 100302903229033765260000, 5032863920347902999360000] ; > SeqRTchild({1,3,4}, 20);#NOT IN OEIS [1, 2, 6, 28, 205, 2070, 25410, 359800, 5798520, 105663600, 2155645800, 48657886200, 1202586485100, 32282071621800, 935338118715000, 29098128631572000, 967482670702548000, 34237946556613800000, 1284878182355343576000, 50967054449973501840000] ; > SeqRTchild({2,3,4}, 20);#NOT IN OEIS [1, 0, 3, 4, 65, 300, 4200, 37240, 567000, 7459200, 130873050, 2248785000, 45820074300, 960718558800, 22551581052000, 554522292324000, 14815285064580000, 416528503687296000, 12512460971526516000, 395230114168409520000] ; > ; > #Q3. ; > #Write a procedure SeqRTchildNone(S,N), that inputs a finite set of positive integers, S, and a positive integer N, and outputs the first N entries in lhe list enumerating rooted labeled trees where every vertex is either a leaf (i.e. 0 children) or has a mumber of children that must NOT be in the set S (otherwise it can have any number of children) > #Output SeqRTchildNone(S,30) for the following sets S if it is in the OEIS, state the A-number. If it is not, say so. > > #(i) S={1,2} > > #(ii) S={1,2,3} > > #(iii) S={1,2,3,4} > > #(iv) S={1,3,4} > > #(v) S={2,3,4} > ; > ; > ; > SeqRTchildNone:=proc(S,N) local i, r, z, L: > r:=exp(z); > > for i from 1 to nops(S) do > > r:= r- (z^S[i]/S[i]!); > > od: > > L:=FunEqToSeq(r,z,N): > [seq(L[i]*i!, i=1..N)]; > > end: > ; > SeqRTchildNone({1,2}, 15);#NOT IN OEIS [1, 0, 0, 4, 5, 6, 427, 1968, 6561, 220510, 2129171, 13847736, 337904437, 5156062926, 54298310445] ; > SeqRTchildNone({1,2,3}, 15);#NOT IN OEIS [1, 0, 0, 0, 5, 6, 7, 8, 2529, 11350, 36971, 104556, 10182757, 99054970, 632882265] ; > SeqRTchildNone({1,2,3,4}, 15);#NOT IN OEIS [1, 0, 0, 0, 0, 6, 7, 8, 9, 10, 13871, 60996, 195637, 546560, 1411425] ; > SeqRTchildNone({1,3,4}, 15);#NOT IN OEIS [1, 0, 3, 0, 60, 6, 3157, 1184, 319545, 275410, 53033321, 83703456, 13098092449, 33167158220, 4510571784825] ; > SeqRTchildNone({2,3,4}, 15);#NOT IN OEIS [1, 2, 6, 24, 120, 726, 5299, 47776, 546921, 7889140, 136394401, 2665805088, 56527983109, 1272143206894, 30092542593975] ; > ; > #Q4. ; > #By using procedure TreeSeqL(N,x) and procedure AveAndMoms(f,x,K) with K=6, added after class, try to > #(i) Estimate the limit of the average number of leaves in a labelled tree with vertex n divided by n > > #(ii) Estimate the limit of the standard-deviation of the number of the random variable ` number of leaves in a labelled tree with vertex n', divided by n > > #The third, fourth, fifth, and sixth scaled moments > ; > f:=TreeSeqL(6,t)[6]; f := 6*t^5+450*t^4+3000*t^3+3600*t^2+720*t ; > ; > AveAndMoms(f,t,6)/6; [.4018775720, .1233425370, 0.1304227277e-1, .4613071085, .1343595885, 1.940449677] ; > ; > f:=TreeSeqL(7,t)[7]; f := 7*t^6+1302*t^5+18900*t^4+54600*t^3+37800*t^2+5040*t ; > AveAndMoms(f,t,6)/7; [.3965694566, .1149906649, 0.9162479703e-2, .4021062583, 0.9182986553e-1, 1.765109249] ; > ; > f:=TreeSeqL(8,t)[8]; f := 8*t^7+3528*t^6+101136*t^5+588000*t^4+940800*t^3+423360*t^2+40320*t ; > AveAndMoms(f,t,6)/8; [.3926959038, .1080523762, 0.6963795701e-2, .3555393622, 0.6905021615e-1, 1.597170504] ; > ; > f:=TreeSeqL(31,t)[31]: > AveAndMoms(f,t,6)/31; [.3739270013, 0.5579735455e-1, 0.7590775184e-3, 0.9560338023e-1, 0.7535668803e-2, .4666742365] ; > ; > f:=TreeSeqL(50,t)[50]: > AveAndMoms(f,t,6)/50; [.3716017144, 0.4399940582e-1, 0.3688814676e-3, 0.5955226392e-1, 0.3671986026e-2, .2933962654] ; > ; > #the estimate for average number of leaves in a labelled tree with vertex n divided by n is 0.36; > #the estimate for the standard-deviation of the number of the random varialbe number of leaves in a labeled tree with vertex n divided by n is 0; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ; > ;