Example7-2-SequenceAlignment.mw

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):
 

Typesetting:-mprintslash([F := `/`(`*`(`+`(`*`(`^`(x, 2), `*`(`^`(y, 2))), `-`(`*`(x, `*`(y))), 1)), `*`(`+`(`-`(`*`(`^`(x, 3), `*`(`^`(y, 2)))), `-`(`*`(`^`(x, 2), `*`(`^`(y, 3)))), `*`(`^`(x, 2), `*... (1)
 

> # Asymptotics are represented by the symbolic expression
A;
 

`+`(`/`(`*`(`/`(1, 2), `*`(`^`(`/`(`*`(`+`(`*`(20, `*`(`^`(u, 4))), `-`(`*`(2720, `*`(`^`(u, 3)))), `*`(83772, `*`(`^`(u, 2))), `-`(`*`(1194402, `*`(u))), 72952074)), `*`(`+`(`*`(8, `*`(`^`(u, 4))), `...
`+`(`/`(`*`(`/`(1, 2), `*`(`^`(`/`(`*`(`+`(`*`(20, `*`(`^`(u, 4))), `-`(`*`(2720, `*`(`^`(u, 3)))), `*`(83772, `*`(`^`(u, 2))), `-`(`*`(1194402, `*`(u))), 72952074)), `*`(`+`(`*`(8, `*`(`^`(u, 4))), `...
(2)
 

> # When u is the unique root of the polynomial
op(1,U[1]);
 

`+`(`*`(4, `*`(`^`(_Z, 5))), `-`(`*`(680, `*`(`^`(_Z, 4)))), `*`(27924, `*`(`^`(_Z, 3))), `-`(`*`(597201, `*`(`^`(_Z, 2)))), `*`(72952074, `*`(_Z)), `-`(875917345)) (3)
 

> # Whose decimal expression begins
evalf(op(2,U[1]),10);
 

12.77424753 (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))));
 

`+`(`/`(`*`(.5320597780, `*`(`^`(4.518911369, n))), `*`(`^`(n, `/`(1, 2))))) (5)
 

>