情報構造入門 第7回 (20011116) 講義予定

 

   テキスト:Mathemaicaの利用 

.関数編から 

多項式・有理式・代数方程式  p16p17 

の組み込み関数について概説する.

   

本メールのテキストを表示させておき,Mathematicaも起動しておく.

次のプログラムを1つの改行の単位毎にMathematicaのワークシートに

貼り付けて実行すること.

 

Expand[(a+b)^3]

 

Expand[(a+2b+3c)^10]

 

Factor[x^3-y^3]

Factor[x^105-1]

 

f = x^2 y + x^3 y^2 + a x^2 + b y + 3

 

Collect[f, x]

Collect[f, y]

 

Coefficient[f, y]

CoefficientList[f, y]

 

poly1 = x^10 + 4x^3 + 1;

poly2 = x^4 + 5x + 2;

 

quot = PolynomialQuotient[poly1, poly2, x]

rem = PolynomialRemainder[poly1, poly2, x]

 

poly2 quot + rem // Expand

 

 

 

rat = (x^3 + y^3 + z^3 - 3 x y z)/(x + y + z)

 

bunsi = Numerator[rat]

bunbo = Denominator[rat]

 

Expand[rat]

 

rat2 = bunbo/bunsi

rat3 = 1/rat

 

Cancel[rat2]

 

 

文法編から

   繰り返しをさせる方法 For  p40p41

 

s = 0;

For[k = 1, k <= 10, k++,

  s = s + k]

s

 

s = 0;

For[k = 1, k <= 10, k++,

  s = s + k^2]

s

 

For[n = 1, n <= 10, n++,

  Print[n, "! =", n!]]

 

For[n = 1, n <= 6, n++,

  Print[n, " ", Integrate[Cos[x]^n, {x, 0, Pi/2}]]]

 

(A = {{1.1, 1.2}, {2.1, 2.2}}) // MatrixForm

For[n = 1, n <= 6, n++,

  Print[n, "   ", MatrixPower[A, n] // MatrixForm]]

 

 テキスト:情報処理入門の演習問題

線形代数の諸問題 p169-171 

 Excelで計算すること

Mathematicaで計算すること 

解答例 Mathematicaの利用 p56p58