c Bo 9780511972942 a 052
-
Upload
komoritakao -
Category
Documents
-
view
217 -
download
0
Transcript of c Bo 9780511972942 a 052
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 1/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 2/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 3/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 4/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 5/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 6/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 7/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 8/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 9/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 10/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 11/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 12/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 13/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 14/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 15/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 16/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 17/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 18/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 19/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 20/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 21/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 22/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 23/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 24/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 25/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 26/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 27/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 28/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 29/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 30/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 31/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 32/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 33/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 34/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 35/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 36/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 37/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 38/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 39/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 40/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 41/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 42/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 43/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 44/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 45/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 46/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 47/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 48/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 49/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 50/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 51/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 52/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 53/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 54/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 55/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 56/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 57/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 58/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 59/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 60/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 61/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 62/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 63/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 64/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 65/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 66/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 67/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 68/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 69/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 70/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 71/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 72/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 73/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 74/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 75/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 76/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 77/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 78/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 79/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 80/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 81/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 82/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 83/87
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 84/87
In[173]:= RandomCompose @20, " Vibraphone " D
Out[173]=
11.25 s
A listener would be hard pressed to find a pattern or any autocorrelation in this “tune” and themusic is quite uninteresting as a result. Melodies generated using this scaling are referred to as1ê f 0 , where the0 loosely refers to the level of correlation.
We leave as an exercise the writing of more sophisticated 1ê f 0 melodies, where the likelihoodof a note being chosen obeys a certain probability distribution.
We now move in the other direction and generate melodies that are overly correlated. The
randomness will be applied to the distance between notes, essentially performing a “randomwalk” through the C major scale. Music generated in such a way is calledBrownian because itbehaves much like the movement of particles suspended in liquid – Brownian motion.
Here is our random walk function, essentially borrowed from Section13.1. We will limit the“distance” any step can take to the range- 4 to 4.
In[174]:= Accumulate @RandomChoice @Range @- 4, 4 D, 12 DDOut[174]= 80, 3, 1, - 1, - 1, - 3, - 2, 1, 4, 2, 5, 1 <
This puts all the pieces together, plus one additional piece to create random durations.
In[175]:= BrownianCompose @steps_Integer , instr_: " Vibraphone " D :=
Module @8 walk , durs <, walk @n_ D : = Accumulate @RandomChoice @Range @- 4, 4 D, nDD;
durs = RandomChoice @Range @1 ê16, 1, 1 ê16 D, 8steps <D;Sound ü
MapThread @SoundNote @Ò 1 , Ò 2 , instr D &, 8 walk @steps D, durs <DDIn[176]:= BrownianCompose @18, " Marimba " D
Out[176]=
10 s
10.4 Examples and applications 445
Downloaded from Cambridge Books Online by IP 157.253.50.50 on Wed May 18 01:20:04 BST 2016.http://dx.doi.org/10.1017/CBO9780511972942.011
Cambridge Books Online © Cambridge University Press, 2016
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 85/87
This melody has a different character from the 1ê f 0 melody produced above. In fact, it is quiteovercorrelated and it is often referred to as 1ê f 2 music as a result of a computed spectral density.Although different in character from 1ê f 0 music, it is just as monotonous. The melody mean-
ders up and down the scale aimlessly without any central theme. The exercises contain a discus-sion of 1ê f music (or noise), that is, music that is moderately correlated. 1ê f noise is quitewidespread in nature and is intimately tied to areas of science that study fractal behavior; seeCasti (1992) or Mandelbrot (1982).
Exercises1. Create a function ComplexListPlot that plots a list of complex numbers in the complex plane
using ListPlot . Set initial options so that thePlotStyle is red, thePointSize is a little largerthan the default, and the horizontal and vertical axes are labeled “Re” and “Im,” respectively. Set itup so that options to ComplexListPlot are inherited from ListPlot .
2. Create a function ComplexRootPlot that plots the complex solutions to a polynomial in theplane. Use your implementation ofComplexListPlot that you developed in the previousexercise.
3. ModifyPathPlot so that it inherits options from Graphics as well as having its own option,PathClosed , that can take on values ofTrue or False and closes the path accordingly byappending the first point to the end of the list of coordinate points.
4. Extend the code forListLinePlot3D so that the rule for multiple datasets incorporates theoptions that were used for the single dataset rule in the text.
5. Although the program SimpleClosedPath works well, there are conditions under which it willoccasionally fail. Experiment by repeatedly computingSimpleClosedPath for a set of ten pointsuntil you see the failure. Determine the conditions that must be imposed on the selection of the basepoint for the program to work consistently.
6. ModifySimpleClosedPath so that the point with the smallest x-coordinate of the list of data ischosen as the base point; repeat but with the largest y-coordinate.
7. Another way of finding a simple closed path is to start with any closed path and progressively makeit simpler by finding intersections and changing the path to avoid them. Prove that this processends, and that it ends with a closed path. Write a program to implement this procedure and thencompare the paths given by your function with those ofSimpleClosedPath given in the text.
8. Following on the framework of theRootPlot example in this section, create a functionShowWalk @ walkD that takes the coordinates of a random walk and plots them in one, two, or threedimensions, depending upon the structure of the argument walk. For example:
In[1]:= << PwM`RandomWalks`
446 Graphics and visualization
Downloaded from Cambridge Books Online by IP 157.253.50.50 on Wed May 18 01:20:04 BST 2016.http://dx.doi.org/10.1017/CBO9780511972942.011
Cambridge Books Online © Cambridge University Press, 2016
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 86/87
In[2]:= ShowWalk @RandomWalk @500, Dimension Ø 1 D,Frame Ø True, GridLines Ø Automatic D
Out[2]=
0 100 200 300 400 500
- 25
- 20
- 15
- 10
- 5
0
5
In[3]:= ShowWalk @RandomWalk @500, Dimension Ø 2 D, Mesh Ø All, MeshStyle Ø Directive @Brown, PointSize @Small DDD
Out[3]=
- 5 5 10
- 12
- 10
- 8
- 6
- 4
- 2
2
In[4]:= ShowWalk @RandomWalk @2500, Dimension Ø 3 D,Background Ø LightGray, BoxRatios Ø 81, 1, 1 <D
Out[4]=
9. UseMesh in a manner similar to its use in theRootPlot function to highlight the intersection oftwo surfaces, say sinH2 x - cosH yLL and sinHx - cosH2 yLL. You may need to increase the value ofMaxRecursion to get the sampling just right.
10. Rewrite TrendPlot to compute a more robust plot range, one based on the minimum andmaximum values of the data together with the minimum and maximum user-specified rates.
10.4 Examples and applications 447
Downloaded from Cambridge Books Online by IP 157.253.50.50 on Wed May 18 01:20:04 BST 2016.http://dx.doi.org/10.1017/CBO9780511972942.011
Cambridge Books Online © Cambridge University Press, 2016
8/15/2019 c Bo 9780511972942 a 052
http://slidepdf.com/reader/full/c-bo-9780511972942-a-052 87/87
11. Modify the graphics code at the end of thePointInPolygonQ example so that GatherBy alwaysorders the two lists so that the list of points that pass occurs before the list of points that fail the test.
12. Write a function pentatonic that generates 1ë f 2 music choosing notes from a five-tone scale. Apentatonic scale can be played on a piano by beginning with C¤, and then playing only the blackkeys: C¤, EŸ, F¤, AŸ, C¤. The pentatonic scale is common to Chinese, Celtic, and Native Americanmusic.
13. Modify the routine for generating 1ë f 0 music so that frequencies are chosen according to a speci-fied probability distribution. For example, you might use the following distribution that indicates anote and its probability of being chosen: C –5%, C¤ – 5%, D –5%, EŸ – 10%, E –10%, F –10%, F¤ –10%, G –10%, AŸ – 10%, A –10%, BŸ – 5%, B –5%, C –5%.
14. Modify the routine for generating 1ë f 0 music so that the durations of the notes obey 1ë f 0 scaling.
15. If you read musical notation, take a musical composition such as one of Bach’sBrandenburg Concertosand write down a list of the frequency intervalsx between successive notes. Then find a functionthat interpolates the power spectrum of these frequency intervals and determine if this function isof the form f HxL= cêx for some constant c. (Hint: To get the power spectrum, you will need to squarethe magnitude of the Fourier transform: take Abs @Fourier @…DD2 of your data.) Compute thepower spectra of different types of music using this procedure.
448 Graphics and visualization