#!/usr/local/bin/maple # -*- maplev -*- # Nathaniel Shar # HW 12 # Experimental Mathematics # It is okay to link to this assignment on the course webpage. Help := proc(): print(`GuessDE(L,x,D,max), GuessDE1(L,x,D,n), AlgToSeq(F,P,x,K,f0:=1), AlgToDE(F,P,x,D,K)`): end: ############# # Problem 2 # ############# # I have no idea. ############# # Problem 3 # ############# GuessDE := proc(L,x,D,max) local i, oper: if nops(L) < max + 7 then: printf("List must contain at least %d elements\n", max+7): return: fi: for i from 0 to max do: oper := GuessDE1(L,x,D,i): if oper <> FAIL then: return oper: fi: od: FAIL: end: GuessDE1 := proc(L,x,D,n) local a,i,j, oper, vars, eqns, solns: vars := {seq(seq(a[i,j],j=0..i),i=0..n)}: oper := add(add(a[i,j]*x^(i-j)*D^(j), j=0..i), i=0..n): eqns := { seq( add( add( coeff( coeff(oper, D,j), x, k ) *L[i+j+1-k]*factorial(i+j-k)/factorial(i-k), k=0..i ), j=0..n ) = 0, i=0..n+7 ) }: solns := solve(eqns, vars): oper := simplify(subs(solns, oper)): if oper = 0 then: return FAIL: fi: return subs({seq(v=1, v=vars)}, oper): end: ############# # Stuff from class 12: AlgToSeq:=proc(F,P,x,K,f0:=1) local H,F1,i,f,L,m: H:=coeff(F,P,1): if subs(x=0,H)=0 then RETURN(FAIL): fi: #a0(x)+H(x)*P(x)+a2(x)*P(x)^2+...=0 #P(x)=-(a0(x)+a2(x)*P(x)^2+....)/H(x) F1:=(P*H-F)/H: #start at f(x)=1 and iterate f(x)->F1(f(x)) f:=f0: L:=[f0]: for i from 1 to K do f:=subs(P=f,F1): f:=taylor(f,x=0,i+1): L:=[op(L),coeff(f,x,i)]: f:=add(coeff(f,x,m)*x^m,m=0..i): od: L: end: ############# # Problem 4 # ############# AlgToDE := proc(F,P,x,D,K) return GuessDE(AlgToSeq(F,P,x,K+1),x,D,K-6): end: