ComplexRationalPolynomialMatrixRealImag.java
01 /*
02  * $Id: ComplexRationalPolynomialMatrixRealImag.java,v 1.6 2008/02/02 05:53:02 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap17;
08 
09 import org.mklab.nfc.matrix.Matrix;
10 import org.mklab.nfc.matrix.RationalPolynomialMatrix;
11 import org.mklab.nfc.scalar.DoubleComplexNumber;
12 import org.mklab.nfc.scalar.Polynomial;
13 import org.mklab.nfc.scalar.RationalPolynomial;
14 import org.mklab.tool.matrix.Simplify;
15 
16 
17 /**
18  @author koga
19  @version $Revision: 1.6 $, 2004/04/19
20  */
21 public class ComplexRationalPolynomialMatrixRealImag {
22 
23   /**
24    * メインメソッド
25    
26    @param args コマンドライン引数
27    */
28   @SuppressWarnings("nls")
29   public static void main(String[] args) {
30     Polynomial s = new Polynomial("s");
31     RationalPolynomial a11 = s.multiply(new DoubleComplexNumber(11)).add(new DoubleComplexNumber(13)).divide(s.add(2));
32     RationalPolynomial a12 = s.multiply(new DoubleComplexNumber(11)).add(new DoubleComplexNumber(35)).divide(s.add(4));
33     RationalPolynomial a21 = s.multiply(new DoubleComplexNumber(11)).add(new DoubleComplexNumber(57)).divide(s.add(6));
34     RationalPolynomial a22 = s.multiply(new DoubleComplexNumber(11)).add(new DoubleComplexNumber(71)).divide(s.add(8));
35     RationalPolynomialMatrix a = new RationalPolynomialMatrix(new RationalPolynomial[][] { {a11, a12}{a21, a22}});
36     Matrix re = Simplify.simplify((RationalPolynomialMatrix)a.getRealPart());
37     Matrix im = Simplify.simplify((RationalPolynomialMatrix)a.getImagPart());
38     re.print("Re(a)");
39     im.print("Im(a)");
40   }
41 }