01 /*
02 * $Id: ComplexRationalPolynomialSample3.java,v 1.5 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.scalar.DoubleComplexNumber;
10 import org.mklab.nfc.scalar.Polynomial;
11 import org.mklab.nfc.scalar.RationalPolynomial;
12
13
14 /**
15 * 複素有理多項式の実部と虚部のサンプルです。
16 * @author koga
17 * @version $Revision: 1.5 $, 2004/04/16
18 */
19 public class ComplexRationalPolynomialSample3 {
20
21 /**
22 * メインメソッド
23 *
24 * @param args コマンドライン引数
25 */
26 @SuppressWarnings("nls")
27 public static void main(String[] args) {
28 Polynomial s = new Polynomial("s");
29 Polynomial n = s.multiply(new DoubleComplexNumber(1, 1)).add(new DoubleComplexNumber(1, 4));
30 Polynomial d = s.multiply(2).add(3);
31 RationalPolynomial cr = n.divide(d);
32 RationalPolynomial re = cr.getRealPart();
33 re.print("Re(cr)");
34 RationalPolynomial im = cr.getImaginaryPart();
35 im.print("Im(cr)");
36 }
37 }
|