#hw9.txt, February 21, 2014, Frank Wagner Help:=proc(): print(` ApplyUmbra(P,x,U,m), PnG(n,x,U,m) `) : end: ################### #####Problem 1##### ################### ApplyUmbra:=proc(P,x,U,m) local i,H,n: n:=degree(P,x): H:=[seq(coeff(P,x,i),i=0..n)]: add(H[i]*subs(m=i-1,U),i=1..n+1): end: ################### #####Problem 2##### ################### PnG:=proc(n,x,U,m) local P,i,a,var,eq: P:=x^n+add(a[i]*x^i,i=0..n-1): var:={seq(a[i],i=0..n-1) }: eq:={ seq( ApplyUmbra(P*x^i,x,U,m)=0, i=0..n-1) }: sort(subs(solve(eq,var),P)): end: ################### #####Problem 3##### ################### ########Old stuff needed for this problem####### #GuessRF1(L,d,n): inputs a list of numbers (or expressions) #L, a non-neg. integer d, and a (discrete) variable name #n and tries to guess a rational function of n of degree #d, such that L[i]-R(i)=0 for all i from 1 to nops(L) GuessRF1:=proc(L,d,n) local R,a,b,i,j,eq,var: if nops(L)<=2*d+6 then RETURN(FAIL): fi: R:=(n^d+add(a[i]*n^i,i=0..d-1))/add(b[j]*n^j,j=0..d): var:={seq(a[i],i=0..d-1), seq(b[j],j=0..d)}: eq:={seq( numer(L[i]-subs(n=i,R)) =0,i=1..2*d+6)}: var:=solve(eq,var): if var=NULL then RETURN(FAIL): fi: R:=subs(var , R): if {seq( numer(L[i]-subs(n=i,R)),i=1..nops(L))}<>{0} then print(`It worked up to`, 2*d+6, `terms, but that's life `): FAIL: else R: fi: end: #GuessRF(L,n): inputs a list of numbers (or expressions) #L, and a (discrete) variable name #n and tries to guess a rational function of n of degree #<=(nops(L)-6)/2 such that L[i]-R(i)=0 for all i from 1 to nops(L) GuessRF:=proc(L,n) local d, katie: for d from 0 to (nops(L)-6)/2 do katie:=GuessRF1(L,d,n): if katie<>FAIL then RETURN(katie): fi: od: FAIL: end: ########End old stuff eneded for this problem######## GuessCoeff:=proc(n,i,U,m) local L,j,x,k: k:=1: L:=[seq(coeff(PnG(j,x,U,m),x,j-i),j=1..k)]: while GuessRF(L,n)=FAIL do k:=k+1: L:=[seq(coeff(PnG(j,x,U,m),x,j-i),j=1..k)]: od: GuessRF(L,n): end: #For GuessCoeff(n,i,1/(m+1),m), the function returns: # # i=0: 1 # i=1: (-1/2)n # i=2: (n^3-2*n^2+n)/(8*n-4) # i=3: (n^4-5*n^3+8*n^2-4*n)/(-48*n+24) # i=4: (n^6-11*n^5+47*n^4-97*n^3+96*n^2-36*n)/(384*n^2-768*n+288) # i=5: (n^7-17*n^6+117*n^5-415*n^4+794*n^3-768*n^2+288*n)/(-3840*n^2+7680*n-2880) # i=6: (n^9-27*n^8+312*n^7-2010*n^6+7869*n^5-19083*n^4+27818*n^3-22080*n^2+7200*n)/ # (46080*n^3-207360*n^2+264960*n-86400) # i=7: (n^10-36*n^9+564*n^8-5034*n^7+28119*n^6-101514*n^5+235556*n^4-336216*n^3+264960*n^2-86400*n)/ # (-645120*n^3+2903040*n^2-3709440*n+1209600) # #For GuessCoeff(n,i,1/(m+3),m), the function returns: # # i=0: 1 # i=1: (n^2+2*n)/(-2*n-2) # i=2: (n^3+n^2-2*n)/(8*n+4) # i=3: (n^4-n^3-4*n^2+4*n)/(-48-24) # i=4: (n^6-5*n^5+3*n^4+17*n^3-28*n^2+12*n)/(384*n^2-96) # i=5: (n^7-10*n^6+31*n^5-10*n^4-116*n^3+200*n^2-96*n)/(-3840*n^2+960) # i=6: (n^9-18*n^8+126*n^7-408*n^6+429*n^5+978*n^4-3436*n^3+3768*n^2-1440*n)/ # (46080*n^3-69120*n^2-11520*n+17280) # i=7: (n^10-26*n^9+278*n^8-1544*n^7+4445*n^6-4214*n^5-11348*n^4+38904*n^4+38904*n^3-43776*n^2+17280*n)/ # (-645120*n^3+967680*n^2+161280*n-241920) # #For GuessCoeff(n,i,eval(m!),m), the function returns: # # i=0: 1 # i=1..7: MAPLE CRASHED