## Discrete Mathematics

In[118]:=
`Needs["DiscreteMath`RSolve`"]`
In[119]:=
```sol = Simplify[RSolve[
{fb[n+2]==fb[n+1]+fb[n], fb[0]==0, fb[1]==1}, fb[n], n ]]```
Out[119]=
```               1   Sqrt[5] n    1   Sqrt[5] n
{{fb[n] -> ((-(- - -------)  + (- + -------) )
2      2         2      2

If[n >= 1, 1, 0]) / Sqrt[5]}}```
In[120]:=
`fib = fb[n] /. sol[[1]]`
Out[120]=
```   1   Sqrt[5] n    1   Sqrt[5] n
(-(- - -------)  + (- + -------) ) If[n >= 1, 1, 0]
2      2         2      2
---------------------------------------------------
Sqrt[5]```
In[121]:=
`Table[ Simplify[fib /. n->k], {k,1,10} ]`
Out[121]=
`{1, 1, 2, 3, 5, 8, 13, 21, 34, 55}`
グラフ理論のパッケージから，完全グラフの表示の例．
In[122]:=
`Needs["DiscreteMath`Combinatorica`"]`
In[123]:=
`ShowGraph[ K[7] ]`
Out[123]=
`-Graphics-`

In[124]:=
`Needs["DiscreteMath`ComputationalGeometry`"]`
In[125]:=
`PlanarGraphPlot[ Table[{Random[],Random[]},{15}] ]`
Out[125]=
`-Graphics-`

In[126]:=
`<< myFiniteAutomata.m`
In[127]:=
```m = MakeAutomaton[DFA,
{q0,q1},
{{q0,a,q1},{q0,b,q0},{q1,a,q0},{q1,b,q1}},
q0, {q0}, {a,b} ]```
Out[127]=
`- Automaton -`
In[128]:=
`ShowAutomaton[ m ]`
Out[128]=
`-Graphics-`
In[129]:=
`ShowExecution[ m, {a,b,a,b} ]`

Dept. CS / Faculty of Eng. / Kobe Univ. / Naoyuki Tamura