> #THE NUMBER OF ATTENDANCE QUESTIONS WERE: 3 > ; > #Q1 ; > ; > #LIST THE SET OF ALL YOUR SIBLINGS AND FIRST COUSINS ; > #FOR EACH OF THEM LIST THEIR AGE. ; > #i)FIND THE WEIGHT-ENUMERATOR ACCORDING TO AGE ; > #ii)According to height ; > ; > #Siblings := {Yuchen, Jerry, Jonason, Dong} ; > #for a(n) := number of members in Siblings whose age is n, a(13)=1, a(10)=1, a(24)=1, a(11)=1 ; > #Weight-Enumerator of S according to the age using the formal variable x is ; > f := x^13+x^10+x^24+x^11 f := x^24+x^13+x^11+x^10 ; > sort(f) x^24+x^13+x^11+x^10 ; > #for h(n) := number of members in Siblings whose age is n cm, a(170)=1, a(160)=1, a(156)=1, a(159)=1 ; > #Weight-Enumerator of S according to the age using the formal variable x is ; > ff := x^170+x^160+x^156+x^159 ff := x^170+x^160+x^159+x^156 ; > sort(ff) x^170+x^160+x^159+x^156 ; > ; > #Q2 ; > ; > #LOOK UP IN WIKIPEDIA THE LIST OF AGES AT DEATH PRESIDENTS OF USA ; > #(i) WHAT IS THE WEIGHT-ENUMERATOR OF THE SET OF FIRST 10 DEAD PRESIDENTS ; > #(ii)WHAT IS THE WEIGHT-ENUMERATOR OF THE SET OF LAST 10 DEAD PRESIDENTS ; > #ACCORDING TO AGE AT DEATH ; > #(iii)CONSIDER THE ARTIFICIAL SET P1xP2 with 100 elements and define the F(EarlyPresident, LatePresident) = sum of their ages when they died ; > #Found the weight-enumerator of the set P1xP2 according to F ; > #(iv)How many such pairs have combined ages 120?140?160? ; > ; > #First10: 67,83,90,73,85,68,78,80,53,65 ; > #Last10: 94,93,93,81,64,88,78,90,46,63 ; > ; > first := x^67+x^83+x^90+x^73+x^85+x^68+x^78+x^80+x^53+x^65 first := x^90+x^85+x^83+x^80+x^78+x^73+x^68+x^67+x^65+x^53 ; > last := x^94+x^93+x^93+x^81+x^64+x^88+x^78+x^90+x^46+x^63 last := x^94+2*x^93+x^90+x^88+x^81+x^78+x^64+x^63+x^46 ; > sort(last) x^94+2*x^93+x^90+x^88+x^81+x^78+x^64+x^63+x^46 ; > ; > #F(E,L) = 161,176,183,154,149,156,156,170,99,128 ; > #weight-enumeratir of P1xP2 according to F is ; > sort(x^161+x^176+x^183+x^154+x^149+x^156+x^156+x^170+x^99+x^128) x^183+x^176+x^170+x^161+2*x^156+x^154+x^149+x^128+x^99 ; > #120->9, 140->8, 160->4 ; > ; > #Q3 ; > ; > #Look up in the internet the TOP TEN DEAD ROCK SINGERS OF ALL TIME ; > #FIND THE AVERAGE AGE AT DEATH, THE VARIANCE(2ND moment about the mean) call it m2 ; > ; > #THE FOURTH MOMERNT ABOUT THE MEAN CALL IT m4 ; > ; > #Then Find m4/m2^2 (KURTOSIS) ; > ; > Death := {40,28,27,28,42,45,27,58,32,32} Death := {27, 28, 32, 40, 42, 45, 58} ; > Ave:=proc(L) local i: > add(L[i],i=1..nops(L))/nops(L): > end: > kthMoment:=proc(L,k) local mu,i: > mu:=Ave(L): > add((L[i]-mu)^k,i=1..nops(L))/nops(L): > end: > AveClever:=proc(L) local f,x: > f:=WtEn(L,x): > subs(x=1,diff(f,x))/subs(x=1,f): > end: > kthMomentClever:=proc(L,k) local x,mu,f,f1,i: > f:=WtEn(L,x): > mu:=AveClever(L): > f1:=f/x^mu: > for i from 1 to k do > f1:=expand(x*diff(f1,x)): > od: > subs(x=1,f1)/nops(L): > end: > m2 := kthMoment(Death,2) m2 := 5046/49 ; > m4 := kthMoment(Death,4) m4 := 58886286/2401 ; > m4/m2^2 9814381/4243686 ; > ;