Discrete Functions Vs Continuous Functions Khan Academy

Martha L. Abell , James P. Braselton , in Mathematica by Example (Fifth Edition), 2017

2.3.5 Miscellaneous Comments

Clearly, Mathematica's graphics capabilities are extensive and volumes could be written about them. You can see many commands that we haven't discussed here by using ? to see those commands that contain the string Plot.

Be sure to take advantage of MathWorld for a huge number of resources related to graphics and Mathematica.

You can obtain detailed information regarding any of these commands from the Documentation Center by clicking on the command's name.

For now, we briefly mention a few of the ones that were not discussed previously. To plot lists of numbers or lists of ordered pairs, use ListPlot or ListLinePlot, which are discussed in more detail in Chapter 4. For matrices and other arrays use commands such as MatrixPlot or ArrayPlot that are discussed in more detail in Chapter 4.

Example 2.38 Cellular Automaton

Very loosly speaking, a cellular automaton is a discrete function that assigns values to subsequent rows based on the values of the cells in the previous row(s). For a concise discussion of cellular automaton refer to Weisstein (Weisstein, Eric W. "Cellular Automaton." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/CellularAutomaton.html ), CellularAutomatan is a powerful command that allows you to investigate (quite complicated) cellular automaton. In its simplest form,

CellularAutomaton[rule,initialvalues,n]

returns the first n generations of the cellular automaton following the specified rule and having the indicated initial values.

The simplest cellular automaton are called elementary cellular automaton (Weisstein, Eric W. "Elementary Cellular Automaton." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/ElementaryCellularAutomaton.html ). Based on basic counting principals, there are 256 elementary cellular automaton. They are cataloged by number. With

CellularAutomaton [ 146 , { { 1 } , 0 } , 5 ]

{ { 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 } , { 0 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 } , { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } , { 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 } }

{ { 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 } ,

{ 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 } , { 0 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 } ,

{ 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } , { 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 } }

we calculate the first five generations of the elementary cellular automaton with a 1 at position 0 on generation 0 using Rule 146. To calculate the first 100 generations, we use CellularAutomaton[146, {{1},0}, 100]. The resulting array is rather large so we use ArrayPlot to visualize it in Fig. 2.37 (a). Using our color scheme, the cells with value 1 are shaded in red and those with 0 are in light green.

Figure 2.37

Figure 2.37. The evolution of two cellular automaton evolving according to Rule 146.

a1 = ArrayPlot [ CellularAutomaton [ 146 , { { 1 } , 0 } , 100 ] ,

ColorFunction "NeonColors" , AspectRatio 1 ]

In this case the grid is initially spaced so that positions 1, 11, 21, 31, and 41 have the value one. The first three generations using Rule 146 are calculated.

CellularAutomaton [ 146 ,

{ SparseArray [ { 1 1 , 11 1 , 21 1 , 31 1 , 41 1 } ] , 0 } , 3 ]

{ { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,

0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 } ,

{ 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,

0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 } ,

{ 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 ,

1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 } ,

{ 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 1 ,

0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 } }

To see how the situation evolves over 100 generations is more easily seen using ArrayPlot. See Fig. 2.37 (b)

a2 = ArrayPlot [ CellularAutomaton [ 146 ,

{ SparseArray [ { 1 1 , 11 1 , 21 1 , 31 1 , 41 1 } ] , 0 } , 100 ] ,

ColorFunction "NeonColors" , AspectRatio 1 ]

Show [ GraphicsRow [ { a1 , a2 } ] ]

Of the 256 elementary cellular automaton, many are equivalent. To see that some of them are equivalent, we create a plot of the 256 elementary cellular automaton for 50 generations as done with Rule 146. All 256 plots are shown on the left in Fig. 2.38 (a). With Union, we remove and sort the ones that are identically equal. Those are shown on the right in Fig. 2.38 (b).

Figure 2.38

Figure 2.38. (a) The first 50 generations for the 256 elementary cellular automaton. (b) Removal of the identical ones.

t1 = Table [ ArrayPlot [ CellularAutomaton [ i , { { 1 } , 0 } , 50 ] ] ,

{ i , 0 , 255 } ] ;

t2 = Partition [ t1 , 16 ] ;

p1 = Show [ GraphicsGrid [ t2 ] ] ;

t3 = Union [ t1 ] ;

t4 = Partition [ t3 , 12 ] ;

p2 = Show [ GraphicsGrid [ t4 ] ] ;

Show [ GraphicsRow [ { p1 , p2 } ] ]

To see the plots together with the rule number, use Table. Each ordered pair returned consists of the rule number and the 50 generation plot. To display the ordered pairs in an organized fashion, we use Grid. Of course, the result is quite large so just a portion of the actual grid is displayed in Fig. 2.39.

Figure 2.39

Figure 2.39. Seeing the automaton together with its rule number.

t5 = Table [ { i , ArrayPlot [ CellularAutomaton [ i , { { 1 } , 0 } , 50 ] ] } ,

{ i , 0 , 255 } ] ;

t6 = Partition [ t5 , 16 ] ;

Grid [ t6 ]

Note that MatrixPlot and ArrayPlot are discussed in more detail in Chapter 5.

For graphs that involve points or nodes or connecting them by edges (graph theory), you can use GraphPlot to help investigate some problems. For trees, use TreePlot.

Image 24

Example 2.39

Graceful graphs don't have multiple edges or loops.

We generate O with GraphPlot and display the result in Fig. 2.40 (a).

Figure 2.40

Figure 2.40. (a) O. (b) C 4.

gp1 = GraphPlot [ { { 0 - > 12 , "12" } , { 12 - > 1 , "11" } , { 1 - > 0 , "1" } , { 0 - > 9 , "9" } ,

{ 1 - > 9 , "8" } , { 1 - > 6 , "5" } , { 12 - > 6 , "6" } , { 2 12 , "10" } ,

{ 0 - > 2 , "2" } , 6 - > 9 , 9 10 , 10 6 } ,

VertexLabeling True , AspectRatio 1 ]

C 4 is shown in Fig. 2.40 (b).

gp2 = GraphPlot [ { 0 4 , 4 2 , 2 3 , 3 0 } , DirectedEdges True ,

VertexLabeling True , AspectRatio 1 ]

Replacing GraphPlot with TreePlot gives us Fig. 2.41.

Figure 2.41

Figure 2.41. Using TreePlot instead of GraphPlot.

tp1 = TreePlot [ { { 0 - > 12 , "12" } , { 12 - > 1 , "11" } , { 1 - > 0 , "1" } , { 0 - > 9 , "9" } ,

{ 1 - > 9 , "8" } , { 1 - > 6 , "5" } , { 12 - > 6 , "6" } , { 2 12 , "10" } ,

{ 0 - > 2 , "2" } , 6 - > 9 , 9 10 , 10 6 } ,

VertexLabeling True , AspectRatio 1 ]

tp2 = TreePlot [ { 0 4 , 4 2 , 2 3 , 3 0 } , DirectedEdges True ,

VertexLabeling True , AspectRatio 1 ]

conleyteryiest.blogspot.com

Source: https://www.sciencedirect.com/topics/computer-science/discrete-function

0 Response to "Discrete Functions Vs Continuous Functions Khan Academy"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel