###################################################################### ## EM19Proj1.txt Save this file as EM19Proj1.txt to use it, # # stay in the # ## same directory, get into Maple (by typing: maple ) # ## and then type: read EM19Proj1.txt: # ## Then follow the instructions given there # ## # ## Written by students of Dr. Z.'s Math 640 , Spring 2019, class # ## Coordinated by Yukun Yao, yao@math.rutges.edu # ##################################################################### with(CurveFitting): read `DATA.txt`: Help:=proc() if args=NULL then print(` EM19Proj1.txt: A Maple package for Analyzing Data in Maple given in terms of an ABT `): print(`with the format [FirstName,LastName,Featues , ... ]`): print(`The MAIN procedures are: ExtractFields, SubLists `): print(` `): elif nargs=1 and args[1]=ExtractFields then print(`ExtractFields(L,M): inputs a list of lists L and a list M , produces a list of sublists with only the features given by M in that order`): print(`For example, try:`): print(`ExtractFields(MR,[7,1,2]);`): elif nargs=1 and args[1]=SubLists then print(`SubLists(L,I1,J1): given a list L of lists where in each item, the I1-th list describes a categorical featues from 1 to J1`): print(`outputs the individual lists for each of the categorical features. Try:`): print(`SubLists(MR,3,4);`): print(``): else print(`There is no such thing as`, args): fi: end: #SubLists(L,I1,J1): given a list L of lists where in each item, the I1-th list describes a categorical featues from 1 to J1 #outputs the individual lists for each of the categorical features. Try: #SubLists(MR,3,4); SubLists:=proc(L,I1,J1) local T,J1A,K: if not (type(L,list) and {seq(type(L[K],list),K=1..nops(L))}={true} and nops({seq(nops(L[K]),K=1..nops(L))})=1 ) then print(`Bad input`): RETURN(FAIL): fi: if {seq(L[K][I1],K=1..nops(L))} minus {seq(K,K=1..J1)}<>{} then print(`Bad input`): RETURN(FAIL): fi: for J1A from 1 to J1 do T[J1A]:=[]: od: for K from 1 to nops(L) do T[L[K][I1]]:= [op(T[L[K][I1]]),L[K]]: od: [seq(T[K],K=1..J1)]: end: #ExtractFields(L,M): inputs a list of lists L and a list M , produces a a list with only the features given by M in that order #and sorted #For example, try: #ExtractFields(MR,[7,1,2]); ExtractFields:=proc(L,M) local K1,K2: sort([seq([seq(L[K1][M[K2]],K2=1..nops(M))],K1=1..nops(L))]): end: