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