Example 7.2 (A Sequence Alignment Problem)
This worksheet requires the DiagonalAsymptotics/Kronecker package available at http://diagasympt.gforge.inria.fr
| > | # Import Kronecker package
read "Kronecker.mpl"; # Define the rational function F := (x^2*y^2 - x*y + 1)/(1 - (x + y + x*y - x*y^2 - x^2*y + x^2*y^3 + x^3*y^2)); # Compute dominant asymptotics of the main power series diagonal A, U := DiagonalAsymptotics(numer(F),denom(F),[x,y],u,n): |
| (1) |
| > | # Asymptotics are represented by the symbolic expression
A; |
| (2) |
| > | # When u is the unique root of the polynomial
op(1,U[1]); |
| (3) |
| > | # Whose decimal expression begins
evalf(op(2,U[1]),10); |
| (4) |
| > | # As usual, random choices are used to output this result. Rerun the code to get
# different expressions which yield the same asymptotic behaviour. # Because u is an algebraic number of degree 5, we give the leading asymptotic with numeric approximations evalf(evala(Normal(subs(u=U[1],A)))); |
| (5) |
| > |