(* ::Package:: *) (************************************************************************) (* This file was generated automatically by the Mathematica front end. *) (* It contains Initialization cells from a Notebook file, which *) (* typically will have the same name as this file except ending in *) (* ".nb" instead of ".m". *) (* *) (* This file is intended to be loaded into the Mathematica kernel using *) (* the package loading commands Get or Needs. Doing so is equivalent *) (* to using the Evaluate Initialization Cells menu command in the front *) (* end. *) (* *) (* DO NOT EDIT THIS FILE. This entire file is regenerated *) (* automatically each time the parent Notebook file is saved in the *) (* Mathematica front end. Any changes you make to this file will be *) (* overwritten. *) (************************************************************************) (* par Marcel D\[EAcute]l\[EGrave]ze *) BeginPackage["Tableaux`"] fusionneColonnes::usage= "fusionneColonnes[a,b] assemble le tableau (\[NegativeThinSpace]\*GridBox[{ {a}, {b} }]\[NegativeThinSpace])." fusionneLignes::usage= "fusionneLignes[a,b] assemble le tableau (\[NegativeThinSpace]\*GridBox[{ {a, b} }]\[NegativeThinSpace])." fusionneTableaux::usage= "fusionneTableaux[a, b, c, d] assemble le tableau {{a, b}, {c, d}}." afficheTableau::usage= "afficheTableau[l, c, t] affiche le tableau {{Null, c}, {l, t}} o\[UGrave]\n l est la liste des en-t\[EHat]tes de lignes,\n c est la liste des en-t\[EHat]tes de colonnes et\n t est un tableau bidimensionnel.\n\nafficheTableau[l, c, t, f] affiche le tableau au format num\[EAcute]rique f." afficheTableauTitre::usage="afficheTableauTitre[e, l, c, t] affiche le tableau {{e, c}, {l, t}} o\[UGrave]\n e d\[EAcute]signe le titre du tableau,\n l est la liste des en-t\[EHat]tes de lignes,\n c est la liste des en-t\[EHat]tes de colonnes et\n t est un tableau bidimensionnel.\n\nafficheTableauTitre[e, l, c, t, f] affiche le tableau {{e, c}, {l, t}} au format num\[EAcute]rique f." tableauGraph::usage= "tableauGraph[t] affiche le tableau bidimensionnel t tourn\[EAcute] d'un quart de tour;\nafficheTableau[l, c, t] affiche le tableau {{Null, c}, {l, t}} tourn\[EAcute] d'un quart de tour o\[UGrave]\n l est la liste des en-t\[EHat]tes de lignes,\n c est la liste des en-t\[EHat]tes de colonnes et\n t est un tableau bidimensionnel." arrondis::usage= "arrondis[x, f] arrondit le nombre (ou la liste) x \[AGrave] un nombre entier de fois f." prodCart::usage= "prodCart[a, b] construit un tableau qui est le produit cart\[EAcute]sien\n des lignes de a et b." prodCartTrans::usage= "prodCartTrans[a, b] construit un tableau qui est le produit\n cart\[EAcute]sien transpos\[EAcute] des lignes de a et b." Begin["`Private`"] fusionneColonnes[a_List,b_List]:=Join[a,b] fusionneColonnes[a_List,b_List,c__List]:=fusionneColonnes[fusionneColonnes[a,b],c] fusionneLignes[a_List,b_List]:=Transpose[Join[Transpose[a],Transpose[b]]] fusionneLignes[a_List,b_List,c__List]:=fusionneLignes[fusionneLignes[a,b],c] fusionneTableaux[a_List,b_List,c_List,d_List]:=fusionneColonnes[fusionneLignes[a,b],fusionneLignes[c,d]] arrondis[Null,f_]:=Null; arrondis[x_List,f_]:=Map[Function[t,arrondis[t,f]],x]; arrondis[x_,f_]:=f Floor[x/f+1/2] cellule[Null]=ToBoxes[""]; cellule[{}]=ToBoxes["{}"]; cellule[x_List]:=GridBox[Map[cellule,x,{2}],RowLines->True,ColumnLines->True]/; SameQ[Head[x[[1]]],List]; cellule[x_]:=ToBoxes[x] apparence[x_List]:=Map[Function[v,StyleBox[cellule[v],FontFamily->"Courier",FontWeight->"Bold",FontSlant->"Oblique"]],x,{1}] form[t_List,f_List]:=Module[{tt},tt=Transpose[t];Transpose[Table[Map[f[[j]],tt[[j]],{1}],{j,1,Length[tt]}]]] form[t_List,f_]:=Map[f,t,{2}] formLigne[t_List,f_List]:=Table[Map[f[[j]],t[[j]],{1}],{j,1,Length[t]}] formLigne[t_List,f_]:=Map[f,t,{2}] afficheTableau[None, None,t_List,f_:Identity]:=FrameBox[GridBox[Map[cellule,form[t,f],{2}],RowLines->True,ColumnLines->True]]//DisplayForm afficheTableau[None, c_List,t_List,f_:Identity]:=FrameBox[GridBox[fusionneColonnes[{apparence[c]},Map[cellule,form[t,f],{2}]],RowLines->True,ColumnLines->True]]//DisplayForm afficheTableau[l_List, None,t_List,f_:Identity]:=FrameBox[GridBox[fusionneLignes[Transpose[{apparence[l]}],Map[cellule,formLigne[t,f],{2}]],RowLines->True,ColumnLines->True]]//DisplayForm afficheTableau[l_List, c_List,t_List,f_:Identity]:=FrameBox[GridBox[fusionneTableaux[{{""}},{apparence[c]},Transpose[{apparence[l]}],Map[cellule,form[t,f],{2}]],RowLines->True,ColumnLines->True]]//DisplayForm afficheTableauTitre[e_,l_List, c_List,t_List,f_:Identity]:=FrameBox[GridBox[fusionneTableaux[{{StyleBox[cellule[e],FontFamily->"Courier",FontWeight->"Bold",FontSlant->"Oblique"]}},{apparence[c]},Transpose[{apparence[l]}],Map[cellule,form[t,f],{2}]],RowLines->True,ColumnLines->True]]//DisplayForm tableauGraph[tb_List]:=Module[{m,n,bLn,cLn,\[CapitalDelta]Col,bCol,cCol,i,j,t}, {m,n}=Dimensions[tb,2]; t=Map[ToString,tb,{2}]; bLn=Range[0,m]; cLn=Table[(bLn[[i]]+bLn[[i+1]])/2,{i,1,m}]; \[CapitalDelta]Col=3+Map[Max,Map[StringLength,Transpose[t],{2}]]; bCol=Table[Apply[Plus,\[CapitalDelta]Col[[Range[j]]]],{j,0,n}]; cCol=Table[(bCol[[j]]+bCol[[j+1]])/2,{j,1,n}]; Show[Graphics[{{Thickness[0.001], Table[Line[{{bLn[[i]],bCol[[1]]},{bLn[[i]],bCol[[n+1]]}}],{i,1,m+1}], Table[Line[{{bLn[[1]],bCol[[j]]},{bLn[[m+1]],bCol[[j]]}}],{j,1,n+1}]},Table[Text[t[[i]][[j]],{cLn[[i]],cCol[[j]]},{0,0},{0,1}],{i,1,m},{j,1,n}]}, PlotRange->All,ImageSize->{18 m,6bCol[[n+1]]},AspectRatio->(6bCol[[n+1]])/(18 m)]]] tableauGraph[el_,ec_,ta_]:=tableauGraph[fusionneTableaux[{{""}},{ec},Transpose[{el}],ta]] prodCart[a_List,b_List]:=Flatten[Table[Join[a[[i]],b[[j]]],{i,1,Length[a]},{j,1,Length[b]}],1] prodCartTrans[a_List,b_List]:=Flatten[Table[Join[a[[i]],b[[j]]],{j,1,Length[b]},{i,1,Length[a]}],1] End[] EndPackage[]