RANDOMNESS AND CONTROL IN CONTEMPORARY CODE ART

Download 11 May 2017 ... Randomness and Control in Contemporary. Code Art. Jiayue Gu. U5541622. Supervisors: Dr Tim Brook, Dr Ben Swift. A thesis su...

0 downloads 682 Views 2MB Size
Randomness and Control in Contemporary Code Art Jiayue Gu U5541622 Supervisors: Dr Tim Brook, Dr Ben Swift

A thesis submitted in partial fulfilment of the degree of Bachelor of Advanced Computing (Honours) at The Research School of Computer Science Australian National University

May 2017

Declaration I declare that, to the best of my knowledge, this thesis is my own original work and does not contain any material previously published or written by another person except where otherwise indicated.

2

Acknowledgements I would like to convey my highest respect and deepest gratitude to everyone who helped me to complete this individual project and report. Above all, I would like to thank Dr Tim Brook sincerely who was my supervisor for his clear instructions and patient guidance throughout my entire project period. I would also like to thank Dr Ben Swift for offering help on my report and giving advice to solve issues. Last but not least, sincere thanks to Prof Weifa Liang who was the course convener of COMP4560. Thank you for providing us with the tutorial room and teaching us about presentations and report writing.

3

Abstract “Randomness” can represent different things in different domains. In computer science, randomness can be considered as unpredictability of numbers with varying degrees. In art, randomness makes fresh to express the emotion of artists. In mathematics, randomness could sometimes make a number change to any number from a set of probabilities. This paper aims to have a basic understand of randomness, especially Markov chains by combining computer science with art, which I made a program to show how Shanghai has changed a lot in the past 100 years. The results will show the principle of Markov chains in a fresh pattern, which could bring a distinctive experience to viewers. Keywords: randomness, art, computer science, Markov chains

4

Table of Contents Declaration ................................................................................................................................ 2 Acknowledgements ................................................................................................................... 3 Abstract ..................................................................................................................................... 4 Introduction ............................................................................................................................... 7 Overview ............................................................................................................................... 7 Outline ................................................................................................................................... 8 Chapter 1. Background and Literature Review ......................................................................... 9 1.1 Background ..................................................................................................................... 9 1.1.1 Random Process ....................................................................................................... 9 1.1.2 Markov chain .......................................................................................................... 10 1.2 Literature review ............................................................................................................11 1.2.1 Randomness in science ............................................................................................11 1.2.2 Randomness in art .................................................................................................. 12 Chapter 2. The artwork of Great Change ................................................................................ 15 2.1 Preparation..................................................................................................................... 15 2.2 Process of the work ....................................................................................................... 16 2.2.1 Collection of photos ............................................................................................... 16 2.2.2 Implementation of the work ................................................................................... 17 2.3.3 Improvement and optimization............................................................................... 19 2.3 Discussion ..................................................................................................................... 20 Chapter 3. Future Work ........................................................................................................... 22 Chapter 4. Conclusion ............................................................................................................. 23 Reference ................................................................................................................................. 24 Appendix 1 .............................................................................................................................. 26 Appendix 2 .............................................................................................................................. 27 Appendix 3 .............................................................................................................................. 28 Appendix 4 .............................................................................................................................. 29 5

Appendix 5 .............................................................................................................................. 30 Appendix 6 .............................................................................................................................. 31

6

Introduction Overview The viewer of an animated artwork may feel bored when something appears in a regular pattern or lose interest in events that are too predictable. That is why artists are tend to use randomness since everyone is curious about unknow events, which supports a feeling of freshness.

Some people may consider that randomness is a kind of coincidence. However, in mathematics, randomness can be considered as a kind of probability because random process is a mathematical object usually defined as a collection of random variables not following a deterministic pattern which means that people are able to predict the result (Randomness 2017). Moreover, many random models such as Monte Carlo simulation, Bayesian classification and Markov chains are used as tools to get an approximate result of uncertain issues in computer science. According to Deni, Jemain et al. (2009), Markov chain models are applied to predict the daily rainfall because they are found to fit the observed data in a certain country.

On the other hand, Díaz (2011) indicates that in the early twentieth century, artists used randomness to create art that expressed their opposition to society and critiqued traditional notions of artistic mastery. In addition, many artists use randomness to challenge traditional conceptions of art and demonstrate that art also relied on arbitrary decision-making (National Gallery of Art, Dada 2006). For instance, Kelly (1999) re-arranged the pieces of drawings that she cut up in a random process, which added a visual liveliness absent in her minimalist drawings.

To explore randomness in both computer science and art aspects, I wrote a Java program to randomly show the difference between Shanghai now and one hundred years ago through a circle which can automatically change the position and the size. The change of the circle was based on Markov chains. Since Shanghai is my hometown, I want to make more people realize how Shanghai has changed a lot over 100 years.

7

Outline The structure of this report is as follows: Chapter One discusses the background of the method that I have applied to my artwork which is show great changes in Shanghai and literature related to the research topic both in computer science and art aspects. Chapter Two will show the processes of the experiments about the exhibition of my art work. The future work of randomness both in art and computer science will be demonstrated in Chapter Three, and Chapter Four presents the conclusion of the study.

8

Chapter 1 Background and Literature Review 1.1 Background 1.1.1 Random Processes A random process (stochastic process) can be defined as a collection of random variables X = {X(t): t ∈ T}, indexed by some mathematical set T, which means that each random variable of the stochastic process is uniquely associated with an element in the set (Gikhman and Skorokhod 1969). The random process should be defined on a common probability space (Ω, ₣, ₽), where X(t) takes values in a mathematical space S for each t ∈ T and X(t) is random variable representing a value observed at time t. (Stochastic process, 2017). A random process can be viewed as a function X(t, ω) of the time t ∈ T and the outcome ω ∈ Ω. There are two ways to view random process. Firstly, for fixed t, X(t, ω) is a random variable over Ω, where the random process is an index collection of random variables. Secondly, for fixed ω, X (t, ω) is a deterministic function of t, called a sample function, as shown in Figure 1 (Random process, 2017).

Figure 1. Sample functions of a random process (cited from https://web.stanford.edu/class/ee278/lectures_EE178/lect06-2.pdf)

Random processes can be used to model random experiments developing in time such as scores of an NBA team in consecutive games, the winning and losing of a gambler, the trend of stock and many other events. When interpreted as time, if the index set T of a random 9

process has a countable number of elements such as N = {0, 1, 2, …}, then the random process is said to be a discrete-time random process (Borovkov, 2013).

1.1.2 Markov chains A Markov process is a random process that satisfies the Markov property which refers to memoryless property of a random process.

A Markov chain is a type of Markov process that has either discrete state space or discrete index set (Markov chain 2017). Markov chains hop from one state to another. In addition, on top of the state space, Markov chains describe the probability of the transition from one state to another. Figure 2 presents a simple 2-state Markov chain.

A a

B Figure 2. a simple 2 state Markov chain.

With two states A and B in the state space, there can be four possible transitions: A goes to either A or B, B goes to either B or A. Figure 3 shows a matrix of the probability.

A

B

A



1- Ω

B

1-β

β

Figure 3. the matrix of transition probability

The elements in the first row of the matrix in figure 3 represents the probability for the next states after state A. Similarly, elements in the second row shows the probability for the next states after state B. Additionally, the sum of each column in the array is one. Such an array is called a transition matrix. 10

1.2 Literature r eview 1.2.1 Randomness in science Probability theory provides both the foundation and the frame of reference for data modelling and statistical inference (Spanos 1999). Moss (2014) states that any realistic model of a realworld phenomenon should consider the possibility of randomness. He also mentions that people are interested in the possibility of randomness being unpredictable in advance but exhibit an inherent variation that should be considered by the probability model. Similarly, Spanos (1999) shows that a probability model summarises and exhibits the important features of particular data set in a readily comprehensive form involving the presentation of data in tables, graph, charts and so on.

Randomness as a quality of a random series of events can be seen as the result of many trivial causes producing small influence which affect other events in the series unpredictably. (International Encyclopedia of the Social Sciences 2008) Such series of internal events influencing each other leads to numerous final results indeterminately but final results will approach a certain range based on the probability theory. A discrete random process may be thought of as a collection or complex discrete sequences of time or space (Marple 1987).

Markov chains has many applications as statistical models of real-world process such as population growths of certain animal species (Meyn and Tweedie 2009) and predict the optimum order of daily rainfall (Deni, Jemain et al. 2009).

Take weather as an example to illustrate what happens next in Markov chain that only depends on the current state of the system.

Figure 4. the transition matrix of weather (cited from https://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter11.pdf)

11

Figure 4 shows three states of Rainy, Nice and Snowy and the transition probabilities. It is obvious that if it is rainy today, there will be three possible weather tomorrow with different probability. Let us say it will be nice two days later, and two cases occur. Firstly, it is rainy tomorrow and nice two days later. Secondly, it is snowy tomorrow and nice two days later. We should notice that the successive nice weather will never happen. According to the transition matrix P, cases above can be simplified to p11p12 and p13p32. Thus, we can have the equation: p12(2) = p11p12 + p13p32. In general, if a Markov chain has n states, then we could have Pij(2) = ∑𝑛𝑘=1 PikPkj

In physics, Markovian systems appear extensively in statistical mechanics, whenever probabilities are used to represent unknow details of the system, if it can be assumed that the dynamics are time-invariant, and no relevant history need be considered which is not already included in the state description (Markov chain, 2017).

1.2.2 Randomness in art During working on the project, I did visual diaries every week to explore how and why artists apply randomness in art (An example is shown in Appendix 6). Here are several examples about artists using randomness in art from my visual diary and the literature review.

Kostner (2010) explained two new aspects of art production by introducing randomness and uncertainty in artworks. On one hand, the origin of art was shifted from being a result that concept was planned totally to a more accidental consequence within the random process. On the other hand, this kind of randomness challenged the viewer in accepting fresh pattern of art work rather than those in regular or traditional way, where viewers should deal with ambiguous and inconsistent situations.

Lostritto (2015) stated that surprise is often a necessity in an art or design process and designers and artists have been constructing situations where they can surprise themselves since they have been sketching and drawing. Additionally, new relationships, orders, and conditions emerge together because an accidental blip in an otherwise straight line might look 12

like something important that the author had not previously considered. He also mentioned that random values can fill in the unimportant blanks. For instance, random values can be used to place blades of grass on the ground where a random function directly generates some aspects of the work.

In 1950s, Cage generated random music by tossing coins and I Ching fortune-telling process (Ham, 2009). Comparing to western music conventions that imposing a general structure on compositions such as the key or time signature, Cage would start a work by randomly determining the broadest aspects of a composition and then proceed to his notes, which made his musical phrase sometimes sound conventional but most of the time the music was reminiscent as a cat walking on a keyboard.

Cage used randomness in his art as well (Spiegelhalter, 2010). The Kettles Yard exhibition featured a list of computer-generated random numbers which determined which row of stones to be chosen, which brush to use, and the position of the stone on the paper. Cage also dictated the use of chance in the form of the exhibition, and Kettles Yard used computergenerated coordinates to determine the heights and positions of the pictures, removing and adding pieces during the exhibition using a random process (As seen in Figure 5).

Figure 5. Cage at Kettles Yard

13

(cited from https://understandinguncertainty.org/node/1066)

Moreover, Markov chains can also be used in algorithmic music composition. According to McAlpine (1999), the states of the system become note values, and a probability vector for each note is constructed, completing a first-order transition probability matrix. An algorithm is constructed to produce output note values based on the transition matrix weightings, which could be MIDI note values, frequency (Hz), or any other desirable metric.

Figure 5. 1st-order matrix (cited fromhttps://en.wikipedia.org/wiki/Markov_chain#Music)

14

Chapter 2 The artwork of Great Change This chapter will present the process of the implementation of my work including preparation, the processes and discussion on the result.

2.1 Preparation The main aim of this project is to show the great change in Shanghai because most people may only have an impression that Shanghai has a great development but they may not realize how Shanghai has changed over 100 years. Thus, I would like to use a different pattern to present the change in Shanghai so as to make people know such change easily and impressively.

To understand the expression of art such as what does artists want viewers to know about, and get new ideas for the work, I did the visual diary every week during the semester including searching and reviewing images on websites and visiting galleries for artwork. Through the weekly visual diary, I found that many artists put their artwork into a specific context without too many descriptions. For example, I could know that a painting of sunrise can be related to the battle when I walked into a gallery whose theme was war. In my artwork, a circle used as zoom will move through the background image which shows the current Shanghai, and what Shanghai looked like in different time will appear when the circle zooms in or zooms out. At first, I wanted viewers to control the movement of the circle through mouse or keyboard. However, I found such pattern could influence the viewing experience because viewers may not focus on observing the change of Shanghai, but how to move the circle. Thus, the movement and the size of the circle will change automatically and unpredictably based on the Markov chain transition matrix, which can make people feel fresh about the artwork. The values in the matrix can be controlled and I can get a rough range about the position where the circle often appears after a period of time. Through realizing the artwork, I can understand the principle of Markov chains and exhibit how a Markov works in the form of art.

In general, it is an artwork to show how Markov chains work in Java. As a result, I need to have a clear structure on the whole work, which includes classes for the Markov chain, transition matrix and image presentation on JPanel. 15

2.2 Processes of the work 2.2.1 Collection of photos To show the large difference between Shanghai now and one hundred years ago, I collected abundant photos about both current and old Shanghai (Examples show in figure 6 and figure 7). Some of them were collected from websites, others were asked from my friends or my parents (See in appendix 4). I stored photos in Dropbox so that my supervisor could view and select photos for me more easily. Additionally, I used Photoshop to modify few old photos since old photos with low resolution may influence the viewing effect.

Figure 6. Shanghai 1900 (cited from: http://www.wenxuecity.com/news/2015/04/17/4197774.html)

Figure 7. Shanghai 2017

16

2.2.2 Implementation of the work First of all, I set a photo of current Shanghai as background image because I want to present the large change in flashback, which means that I will compare the difference between the background image and photos in the circle. To make sure that the image can be shown in a window, several values should be set in the frame, including the path of the background image, the size and the title for the window, the close operation for window, which are based on the Java library. After that, the background image can be shown.

Secondly, a circle served as zoom was added onto the background which could randomly move through the background image and change the size without control. The reason why I use a circle rather than a rectangle or a triangle is that the edge of a circle can smoothly merge the background and images in the circle and a circle is also easy to control the size which only needs the radius. In order not to influence the view of the artwork, I set moderate sizes for the circle which means not too large to occupy the window or too small to see the circle. In Java, I can easily draw a circle according to its radius and centre. Also, it is convenient to make the circle move in terms of keeping its centre changing in a random pattern, and so is the change of its size. Then, I should ensure that the circle can show and move on the background image. To realize that, I created a class for the background and draw the circle in that class, and then applied the class to JPanel. In addition, I wrote another two classes for the change of the location and size of the circle. In the end, I added JPanel into JFrame and the background with a changing circle can be shown in the window.

Above steps can be considered as the preparation for the change. Now, I am going to make Shanghai change.

Thirdly, I put old photos into the circle to reflect the change against the background. With the help of the Java library, I just used setClip() method to ensure that different photos of Shanghai in different times can be shown in the circle, and each of them was given a value in setComposite() method which was used to determine when photos will disappear and disappear. Since some old photos has low resolution that sometimes are hard to watch, I made older photos in bigger size of the circle so that viewers can see the change more clearly as far as possible. Relatively, the newer ones will be shown in smaller size of the circle. As a result, I let values in photos have corresponding change with the size of the circle. Such pattern 17

could make viewers feel like using a magnifier that a magnifier shows detailed content when it is close to something. In my artwork, the bigger the circle is, the more clearly viewers can know what Shanghai looked like long ago (As shown in figure 8).

Figure 8. Effect of transparency

Finally, I imported the Markov chain transition matrix (according to Dr Tim Brook’s work for Noise) to generate following states where the circle will go next. To ensure that the circle could go through the background, I divided the whole background into several states which were destinations of the circle (as shown in figure 9, the crossing represents states). Since the next state generated by transition matrix is unpredictable, viewers are unable to predict the movement of the zoom, which may make them feel fresh (as shown in figure 9, there will be six possible directions where the circle will go). However, the probability of each direction can be controlled because I can change values in the matrix which determine the following state, and I will show how the matrix works in section 2.3.

Figure 9. Unpredictable movement

18

2.3.3 Improvement and optimization Since my first attempt of background image was fixed in a size (as shown in figure 10), I should make it change with the size of window. As a result, I set three situations, centre, tile and stretch, for background image so that background image will keep completeness with any resolution (as shown in figure 11).

Figure 10. Effect of the background image before improvement

Figure 11. Effect of the background image after improvement

In order to avoid the situation that the circle will disappear out of the window or half circle is on the top of the window and half circle is at the bottom (as shown in figure 12), I set values for the coordinates that the circle will rebound when it moves to sides of the window (as shown in figure 13). In addition, I used repaint() method in actionPerformed class to make the movement smoothly and the change will not be interrupted.

19

Figure 12. Effect of zoom movement before improvement

Figure 13. Effect of zoom movement after improvement

2.3 Discussion Figure 12 shows the transition matrix which determines the next state that the circle will go based on Robert Sedgewick and Kevin Wayne’s work on generating value from Markov chains using the random method in Java.

Since I want the circle move to nearby states instead of jumping to remote states, I only set the nearby states with probability. For example, the current state is one, the next possible state can only be selected from state one, two, five and six since the probabilities to other states are zero. In addition, the total probability in one state should keep to 1 which means 100%. If the circle goes to state six frome state one, which has many ways for moving from state one to state six and each method has various probability and cost different time, the next state will not be state four, eight and twlve. We can see that the following state can only be determined by the current state without the influence of the previous and next states, and each state with value is possible to arrive.

20

Although the movement of the circle is unpredicatable, I can get a rough range where the circle will often stay after a period of time according to the values I set in tansition matrix because the circle is more likely to move to states with high probability. In this situation, states in center of the backgound have high value because what I mainly want to show is the change of Shanghai rather than let viewers see the sky or the river most.

Figure 12. Transition matrix

21

Chapter 3 Future Work The most important part of future work is to apply Markov chians to the change of the size of the circle since this artwork only apply that to the movement. Doing more research on Markov chains is also important since this project is a simple work to understand how Markov chains work. With more researches and examples, it is helpful for me to apply Markov chains in certain circumstance more easily in future. For example, being familiar with Markov chains enables me to do predictions about weather, finance or any other domains.

Secondly, it is a good chance for me to understand new knowledge in an art way because it is relatively obvious and interesting to observe the consequence, although this project is just a simple attempt to Markov chains. I would like to use some art factors such as painting or music pattern in future research, which could be both beneficial to viewers and me.

Furthermore, I can try other random process models such as Martingale, Random field and Point process, which are related to the probability theory with art methods. I should study more knowledge about probability theory as well, which I think will be useful in future.

22

Chapter 4 Conclusion This project was based on the interest on randomness, art and java coding, and inspiration from literatures about randomness in art. With the help of weekly visual diary, I learnt how to infer the emotion of artists and absorb fresh elements in order to apply to the work. The processes of experiments enabled me to be more familiar with Java in construction, method, library and so on since I was a novice of Java. Moreover, this project deepened my understanding of probability theory especially random process models because random process can be widely used in different areas.

In conclusion, it is a meaningful and helpful project for me to extend knowledge for art and randomness, and skill of coding and doing research. Furthermore, this project is useful for me in the future development.

23

References Borovkov, A. A. (2013). Probability Theory. New York;London;, Springer. Carl Lostritto The Value of Randomness in Art and Design. 19 Oct 2015, https://www.fastcodesign.com/3052333/the-value-of-randomness-in-art-and-design David Spiegelhalter Pure Randomness in Art. 13 Dec 2010, https://understandinguncertainty.org/node/1066 Deni, S. M., et al. (2009). Fitting optimum order of Markov chain models for daily rainfall occurrences in Peninsular Malaysia. Theoretical and Applied Climatology 97(1-2): 109-121. Díaz, L. (2011), ‘By chance, randomness and indeterminacy methods in art and design’, Journal of Visual Art Practice 10: 1, pp. 21–33, doi: 10.1386/jvap.10.1.21_1 Gikhman, I. I. and A. V. Skorokhod (1969). Introduction to the theory of random processes. Book, W. B. Saunders Co. Ham, E. (2009). Randomness, Chance, & Art. In Handbook of Research on Computational Arts and Creative Informatics (pp. 85-102). IGI Global. Kostner, M., Schubert, F., & Schönlieb, C. B. (2010). Chaos, Noise, Randomness and Coincidence as Constitutional for Generative Art. In Proceedings of Bridges 2010: Mathematics, Music, Art, Architecture, Culture (pp. 467-470). Tessellations Publishing. McAlpine, K., E. Miranda and S. Hoggar (1999). "Making Music with Algorithms: A Case-Study System." Computer Music Journal 23(2): 19-30. Meyn, S. P. and R. L. Tweedie (2009). Markov chains and stochastic stability. Cambridge;New York;, Cambridge University Press. Markov chain. (2017, May 4). In Wikipedia, The Free Encyclopedia. Retrieved 11:13, May 11, 2017, from https://en.wikipedia.org/w/index.php?title=Markov_chain&oldid=778696374 Marple, S. L. (1987). Digital spectral analysis: with applications, Prentice-Hall Englewood Cliffs, NJ. National Gallery of Art (2006), ‘Dada’, 19 February–14 May 2006, http://www.nga.gov/exhibitions/2006/dada/techniques/chance.shtm#null. Accessed 2 October 2010.

"Randomness." International Encyclopedia of the Social Sciences. . Retrieved May 14, 2017 from Encyclopedia.com: http://www.encyclopedia.com/social-sciences/appliedand-social-sciences-magazines/randomness 24

Spanos, A. (1999). Probability theory and statistical inference: econometric modeling with observational data, Cambridge University Press. Stochastic process. (2017, May 3). In Wikipedia, The Free Encyclopedia. Retrieved 19:17, May 12, 2017, from https://en.wikipedia.org/w/index.php?title=Stochastic_process&oldid=778447568

25

Appendix 1

26

Appendix 2

27

Appendix 3

28

Appendix 4

29

Appendix 5 Dropbox

30

Appendix 6 Visual diary:

31