二項係数(パスカルの定理)

パスカルの三角形の図を描く.

#ref error :ご指定のファイルが見つかりません。ファイル名を確認して、再度指定してください。 (title=)

binomial_theorem.zip

Factorial(n):=(
 if (n>0,
  product(1..n);
 ,
  1
 );
);
//n!の関数を定義する.
Combi(n,r):=(
 Factorial(n)/(Factorial(n-r)*Factorial(r));
);
//組合せの関数を定義する.
BinomL(n):=(
 apply(0..n, Combi(n,#));
);
//二項係数のリストを作る.
Ketinit();
Addax(0);
Putpoint("A",[3,3]);
Setcolor([1,0,0,0]);
forall(1..5,j,
 m=0.2+0.7*(j-1);
 forall(1..j,
  Listplot(text(j)+text(#)+"1",A.x-m+1.4*(#-1),A.y-m],[A.x-m+1.4*(#-1)-0.3,A.y-m-0.3);
//左下への線を描く.
  Listplot(text(j)+text(#)+"2",A.x+m-1.4*(#-1),A.y-m],[A.x+m-1.4*(#-1)+0.3,A.y-m-0.3);
//右下への線を描く.
 );
);
Setcolor([0,0,0,1]);
forall(1..7,j,
 m=0.7*(j-1);
 if(j<7,
  (forall(1..j,
   Expr([[A.x-m+1.4*(#-1),A.y-m],"c",text(BinomL(j-1)_#)]);
  );
  Expr([[A.x-0.7*7,A.y-m],"c","n="+text(j-1)]);
 )
 ,
 Expr([[A.x-0.7*7,A.y-m],"c","\vdots",[A.x,A.y-m],"c","\vdots"]););
);
//二項係数を描く.最後の行は…を描く.
最終更新:2016年10月30日 13:35
|新しいページ |検索 |ページ一覧 |RSS |@ウィキご利用ガイド |管理者にお問合せ
|ログイン|