#!/usr/local/bin/maple # -*- maplev -*- # Nathaniel Shar # HW 6 - 16 Feb 2014 # Experimental Mathematics with(LinearAlgebra): # From class: GuessRFd := proc(L, dtop, dbot, n) local R, N, D, i, eqns, vars, solns: if nops(L) <= dtop + dbot +7 then: error "Not enough terms to guess": fi: N := add(A[i]*n^i, i=0..dtop): D := add(B[i]*n^i, i=0..dbot): eqns := {seq(denom(L[i])*subs({n=i}, N) = numer(L[i])*subs({n=i}, D), i=1..nops(L)), A[dtop] = 1}: vars := {seq(A[i], i=0..dtop), seq(B[i], i=0..dbot)}: solns := solve(eqns, vars): if solns = NULL then: return FAIL: fi: R := subs(solns, N/D): if {seq(simplify(subs({n=i}, R)- L[i]), i=1..nops(L))} <> {0} then: return FAIL: fi: return factor(normal(R)): end: GuessRF := proc(L, n) local cand, dtop, dbot: dtop := 0: dbot := 0: while true do: cand := GuessRFd(L, dtop, dbot, n, r): if cand <> FAIL then: return cand: else: if dtop = 0 then: dtop := dbot + 1: dbot := 0: else: dtop := dtop - 1: dbot := dbot + 1: fi: fi: od: end: ############# # Problem 1 # ############# H := proc(a, n, r): return Matrix(n, (x,y)->a(r+x+y-1)): end: h := proc(a, n, r): return Determinant(H(a,n,r)): end: GuessRatioRatio := proc(a, n, r, terms := 16) local i: return GuessRF(Ratios(Ratios([seq(h(a, i, r), i=1..terms+2)])), n): end: Ratios := proc(L) local i: return [seq(L[i+1]/L[i], i=1..nops(L)-1)]: end: ############# # Problem 2 # ############# ProveConj := proc(a, n, r) local conj, s, hg: conj := GuessRatioRatio(a, n, r): s := (x,y)->product(subs({n=i, r=y}, conj), i=0..x-1)*h(a, 1, y): hg := (x,y)->product(s(i,y), i=0..x): return simplify(hg(n+2, r)*hg(n, r+2) - (hg(n+1, r)*hg(n+1, r+2) - hg(n+1, r+1)^2)): # If this is zero, the conjecture is true. # Unfortunately, in the cases I tried, Maple doesn't seem to be # smart enough to simplify this all the way to 0, even though it # IS zero. end: ############# # Problem 4 # ############# # See GuessRF, above. ############# # Problem 5 # ############# GuessDoubleRF := proc(L, m, n): return GuessRF([seq(GuessRF(L[i], n), i=1..nops(L))], m): end: # it seems to work