Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Working with rational polynomials in Maple

  1. Jul 18, 2011 #1

    Could someone please explain how to best handle rational polynomials in Maple?
    I have matrix of rational polynomials and for some reason Maple keeps grumbling
    "error, (in, linearalgebra:- HermiteForm) expecting a matrix of rational polynomials"

    The matrix I am working with is of the form (lets assume for simplicity its a 2x2)

    with(LinearAlgebra); with(MatrixPolynomialAlgebra)
    TF :=Matrix(2, 2, [a/s^2, -b/(s^2+1), c/(s^2+d), c/(s^2+d)]).
    % just for good measure
    M := convert(evalf(TF, 5), rational)
    H := HermiteForm[column](M, s)

    where a, b, c, d are rational numbers

    Now each of the elements of the matrix are rational polynomials so I fail to see the issue. I need to be able to work with matrices in this form in maple/matlab/Magma as its no longer practical to continue to solve these probs by hand, especially for the larger matrices.

    Would really appreciate any pointers
  2. jcsd
  3. Jul 18, 2011 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    If you look at the help entry on HermiteForm you will see that the matrix M is assumed to be a polynomial in s (although the answer may well contain rational polynomials in s). One way around the problem is to factor out the denominators, by looking at N = s^2*(s^2+1)*(s^2+d)*M, then getting its HermiteForm. Presumably, since N and M differ by an overall polynomial, you can then get the HermiteForm of M in terms of that of N. This works well in Maple 9.5 although, for some reason, N as defined above prints out as a matrix without actually being a matrix; it is necessary to look at N1 = <<N[1,1]|N[1,2]>,<N[2,1]|N[2,2]>> and then do HermiteForm[column](N1,s). I haven't tried it on higher versions of Maple.

  4. Jul 18, 2011 #3

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I tried it in Maple 11 and the simple form N = f*M works, where f = least common multiple of all denominators in M. To automate the procedure, you can do this: f = 1; for i from 1 to n do for j from 1 to n do f:=lcm(f,denom(simplify(M[i,j]))): end do: end do: Then take N:=f*M. Now you can do Hn:=HermiteForm(N,s) with no difficulty (except maybe for very large and time-consuming calculations). I guess once you have N, you can get the Hermite form of M as Hm = Hn/f.

  5. Jul 20, 2011 #4
    Hi Ray,

    Thanks for your help!
    From what I understand the right hermite normal form is actually determined based on the relative degree of the respective elements (rational entries). i.e. the column operations are performed to reduce the relative degree of the lower triangular entries and insure that the upper triangular entries are zero

    Clearly Maple applies a different definition..?
  6. Jul 20, 2011 #5

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    As far as I have been able to find out in books, notes, etc., the Hermite normal form applies to *polynomial* matrices (not to rational polynomial matrices?) Could you cite a reference to this more general form of Hermite?

  7. Jul 20, 2011 #6
    Yes certainly,
    Bodson's text "Adaptive control: stability convergence and robustness" briefly describes the form of the right (column) Hermite normal form on page 284 of the following link

    where the hermite normal form is defined by P(s)=H(s)U(s) with unimodular matrix U. P(s) is in this instance defined as a square matrix whose elements are rational functions of s with real coefficients (page 278) i.e. is a transfer function matrix of proper polynomials.

    If your interested in the right hermite forms you may like to have a look at page 621 of this paper http://www.cs.ucf.edu/~qu/J39.pdf [Broken]
    It provides some steps for computing the right hermite normal form which is great..
    However, computing the hermite using these steps on a very simple example I have my doubts about the resultant matrix. I would have expected the resultant matrix to be a lower triangular not diagonal (I don't think the system is decoupled?)

    For instance assume P(s) = Matrix(2,2 [2.806*s^2, -2.806*s^2, .3946/(s^2+1.192), .3946/(s^2+1.192)])
    the solution would appear to be H(s) = Matrix(2,2[2.806*x^2, 0, 0, .3946/(s^2+1.192)]) for which U(s) is indeed unimodular (U = U1*U2 = [1, 1; 0, 1]*[1, 0; -.5, .5]) i.e. has a non-zero constant determinant.

    However, the definition seems to indicate that the numerator of each element should be unity? There is a formal discussion on how one might choose the factors for the column operations required to calculate the hermite in Raghuvansh Prasad Singh's thesis entitled "Stable multivariable adaptive control systems" however the concepts of euclidean domains, and polynomial rings escape me..

    Bit of a journal; apologies, got a little carried away.

    thanks again Ray for the Maple code snippets in the prior post. I'm new to maple so it was much appreciated.

    Last edited by a moderator: May 5, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook