# Homework 10 - Alex Gentul OK to share info1:=proc(); print(`guesAlg(sequence L,symbol P,variable x,integer deg)`); end: info1(); # 2 - diagToAlg(function R,variable x,variable y,symbol P,t,deg) that inputs a rational function R of the two variables x and y, and outputs a guessed algebaric equation F(P,t) such that if you do mtaylor to R (do the two-dimensional Taylor expansion of R about the origin) and call its Taylor coefficients ai,j, then if diagToAlg:=proc(R,x,y,P,t,deg) local A,B: A:=mtaylor(R,{x,y}, 3*deg): B:=[subs({x=0,y=0},R),seq(coeff(coeff(A,x^i),y^i),i=1..2*deg)]: GuessAlg(L,P,t,deg); end: ##### from c10.txt: GuessAlg:=proc(L,P,x, MaxDegP) local g,DegP: for DegP from 1 to MaxDegP do g:=GuessAlg1(L,P,x,DegP): if g<>FAIL then RETURN(g): fi: od: FAIL: end: GuessAlg1:=proc(L,P,x, DegP) local g,Degx: for Degx from 0 while (1+Degx)*(1+DegP)FAIL then RETURN(g): fi: od: FAIL: end: GuessAlg11:=proc(L,P,x, DegP, Degx) local g, F,a, i,j, var,P1,F1,eq, var1,v: F:=add(add(a[i,j]*x^i*P^j,i=0..Degx),j=0..DegP): var:={seq(seq(a[i,j],i=0..Degx),j=0..DegP)}: P1:=add(L[i]*x^(i-1),i=1..nops(L)): F1:=expand(subs(P=P1,F)): eq:={seq( coeff(F1,x,i)=0, i=0..nops(L)-1)}: var1:=solve(eq,var): F:=subs(var1,F): if F=0 then RETURN(FAIL): else F:=subs({seq(v=1, v in var)},F): F:=add(factor(coeff(F,P,i))*P^i,i=0..degree(F,P)): RETURN(F): fi: end: