> #Attendence Q1: > #List the set of all your sibilings and first cousins for each of them list their age. Find the weight-enumerator ; > #(i) find the weight-enumerator according to age. ; > #(ii) according to height ; > #Assume: > #s1: 14yr, 155cm; s2: 15ye, 160cm; s3: 18yr, 180cm ; > #According to age, f = x^14+x^15+x^18 ; > #According to height, f = x^155+x^160+x^180 ; > ; > ; > ; > #Attendence Q2: > #Look up the wikipedia the list of ages at death of deat 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? ; > #(iii) Consider the artificial set P1xP2 with 100 elements and define the F(EarlyPresident, LastPresident) = Sum of their age when they died. Find the weight-enumerator of the set P1xP2 according to F ; > #(iv) How many such pairs have combined ages 120? 140? 160? ; > f_P1:= sort(x^67+x^90+x^83+x^85+x^73+x^80+x^78+x^79+x^68+x^71) Typesetting:-mprintslash([(f_P1 := x^90+x^85+x^83+x^80+x^79+x^78+x^73+x^71+x^68 +x^67)],[x^90+x^85+x^83+x^80+x^79+x^78+x^73+x^71+x^68+x^67]) ; > f_P2:=sort(x^94+x^93+x^93+x^81+x^64+x^46+x^78+x^88+x^63+x^90) Typesetting:-mprintslash([(f_P2 := x^94+2*x^93+x^90+x^88+x^81+x^78+x^64+x^63+x^ 46)],[x^94+2*x^93+x^90+x^88+x^81+x^78+x^64+x^63+x^46]) ; > f_P1 x^90+x^85+x^83+x^80+x^79+x^78+x^73+x^71+x^68+x^67 ; > f_P2 x^94+2*x^93+x^90+x^88+x^81+x^78+x^64+x^63+x^46 ; > #F= x^(90+94)+x^(90+93)+x^(90+93)+ ... + x^(90+46) ; > # + x^(85+94)+x^(85+93)+x^(85+93)+ ... + x^(85+46) ; > # + x^(83+94)+x^(83+93)+x^(83+93)+ ... + x^(83+46) ; > # + ... ... ; > # + x^(67+94)+x^(67+93)+x^(67+93)+ ... + x^(67+46) ; > #sort(F); > ; > expand(f_P1*f_P2) x^184+2*x^183+x^180+x^179+3*x^178+x^177+2*x^176+x^175+x^174+5*x^173+3*x^172+4*x ^171+x^170+x^169+3*x^168+2*x^167+4*x^166+x^165+3*x^164+2*x^163+x^162+7*x^161+3* x^160+2*x^159+2*x^158+2*x^157+2*x^156+x^155+2*x^154+x^153+x^152+x^151+3*x^149+2 *x^148+x^147+2*x^146+x^145+x^144+2*x^143+2*x^142+x^141+x^137+2*x^136+x^135+x^ 134+x^132+3*x^131+x^130+x^129+x^126+x^125+x^124+x^119+x^117+x^114+x^113 ; > ; > coeff(expand(f_P1*f_P2),x^120) 0 ; > coeff(expand(f_P1*f_P2),x^140) 0 ; > coeff(expand(f_P1*f_P2),x^160) 3 ; > ; > ; > ; > #Attendence Q3: > #Look up in the internet the top ten dead rock singer of all time ; > #Find the average age at death, the variance(2nd moment about the mean called m2) and the 4th-moment about the mean called m4 ; > #Then find m4/m2 (In other words, find the Kurtosis ) ; > ; > L:= [1966,1978,1973,1999,2004,1988,1999,1993,1993,2004] Typesetting:-mprintslash([(L := [1966, 1978, 1973, 1999, 2004, 1988, 1999, 1993 , 1993, 2004])],[[1966, 1978, 1973, 1999, 2004, 1988, 1999, 1993, 1993, 2004]]) ; > WtEn:=proc(L,x) local i: > add(x^L[i],i=1..nops(L)): > end: > WtEn(L,x) 2*x^2004+2*x^1999+2*x^1993+x^1988+x^1978+x^1973+x^1966 ; > AveClever:=proc(L) local f,x: > f:=WtEn(L,x): > subs(x=1,diff(f,x))/subs(x=1,f): > end: > AveClever(L) 19897/10 ; > 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: > ; > kthMomentClever(L,2) 15841/100 ; > ;