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 * 複素有理多項式行列の実部と虚部のサンプルです。
19 * @author koga
20 * @version $Revision: 1.6 $, 2004/04/19
21 */
22 public class ComplexRationalPolynomialMatrixRealImag {
23
24 /**
25 * メインメソッド
26 *
27 * @param args コマンドライン引数
28 */
29 @SuppressWarnings("nls")
30 public static void main(String[] args) {
31 Polynomial s = new Polynomial("s");
32 RationalPolynomial a11 = s.multiply(new DoubleComplexNumber(1, 1)).add(new DoubleComplexNumber(1, 3)).divide(s.add(2));
33 RationalPolynomial a12 = s.multiply(new DoubleComplexNumber(1, 1)).add(new DoubleComplexNumber(3, 5)).divide(s.add(4));
34 RationalPolynomial a21 = s.multiply(new DoubleComplexNumber(1, 1)).add(new DoubleComplexNumber(5, 7)).divide(s.add(6));
35 RationalPolynomial a22 = s.multiply(new DoubleComplexNumber(1, 1)).add(new DoubleComplexNumber(7, 1)).divide(s.add(8));
36 RationalPolynomialMatrix a = new RationalPolynomialMatrix(new RationalPolynomial[][] { {a11, a12}, {a21, a22}});
37 Matrix re = Simplify.simplify((RationalPolynomialMatrix)a.getRealPart());
38 Matrix im = Simplify.simplify((RationalPolynomialMatrix)a.getImaginaryPart());
39 re.print("Re(a)");
40 im.print("Im(a)");
41 }
42 }
|