#March 7, 2024 C15.txt Help:=proc(): print(`S(x,y), aS(a), OurPF(R,t), aSr(a) , `):end: #S(x,y): maps a pair of lists of numbers of the same length, n, say, #and outputs a list of numbers of length 2*n #[x[1]+....+x[n],x[1]*y[1]+...+x[n]*y[n],...., x[1]*y[1]^(2*n-1)+.. x[n]*y[n]^(2*n-1)] S:=proc(x,y) local n,i,r: if not (type(x,list) and type(y,list) and nops(x)=nops(y)) then RETURN(FAIL): fi: n:=nops(x): [ seq(add(x[i]*y[i]^r,i=1..n),r=0..2*n-1)]: end: #aS(s): reverse S(x,y) using Maple's solve command. #inputs a list of length 2*n and outputs lists x,y of #length n, such that S(x,y)=a aS:=proc(a) local n,x,y,X,Y,i,eq,var,r: if not( type(a,list) and nops(a) mod 2=0) then RETURN(FAIL): fi: n:=nops(a)/2: eq:={seq(add(x[i]*y[i]^r,i=1..n)=a[r+1],r=0..2*n-1)}: var:={seq(x[i],i=1..n),seq(y[i],i=1..n)}: var:=solve(eq,var)[1]: [[seq(subs(var,x[i]),i=1..n)],[seq(subs(var,y[i]),i=1..n)]]: end: #corrected after class #OurPF(R,t): inputs a rational function of t outputs the #partial fraction decomopition over the complex numbers of the form #[a1,r1],..., [an,rn] where 1/r1,..., 1/rn are the complex roots of the #bottom OurPF:=proc(R,t) local n,Top,Bot,zer,Y,i: Top:=numer(R): Bot:=denom(R): zer:=[solve(Bot,t)]: n:=nops(zer): Y:=sort([seq(1/zer[i],i=1..nops(zer))]): [[seq(-Y[i]*subs(t=1/Y[i],Top)/subs(t=1/Y[i],diff(Bot,t)),i=1..n)],Y]: end: #aSr(a): solves the system of Ramanujan using his method with partial fractions #outputs the rational function whose partial fraction would solve the system #modified after class aSr:=proc(a) local n,A,B,i,Top,Bot,f,eq,var,t: if not( type(a,list) and nops(a) mod 2=0) then RETURN(FAIL): fi: n:=nops(a)/2: Top:=add(A[i+1]*t^i,i=0..n-1): Bot:=1+add(B[i]*t^i,i=1..n): #Top/Bot=add(a[i]*t^(i-1),i=1..2*n): f:=expand(Top-Bot*add(a[i]*t^(i-1),i=1..2*n)): eq:={seq(coeff(f,t,i),i=0..2*n-1)}: var:={seq(A[i],i=1..n),seq(B[i],i=1..n)}: var:=solve(eq,var): OurPF(normal(subs(var,Top)/subs(var,Bot)),t): end: