Math Adventures With Python

Math Adventures With Python — page 7
6 Creating oscillations with trigonometry 103 Using Trigonometry for Rotations and Oscillations 105 Writing Functions to Draw Polygons 106 Drawing a Hexagon with Loops 107 Drawing an Equilateral Triangle 109 Making Sine Waves 110 Leaving a Trail 113 Using Python’s Built-in enumerate Function 114 Creating a Spirograph Program 116 Drawing the Smaller Circle 117 Rotating the Smaller Circle 117 Making Harmonographs 120 Writing the harmonograph Program 121 Filling the List Instantly 123 Two Pendulums Are Better Than One 124 Summary 126 7 Complex numbers 127 The Complex Coordinate System 128 Adding Complex Numbers 129 Multiplying a Complex Number by i 130 Multiplying Two Complex Numbers 131 Writing the magnitude Function 132 Creating the Mandelbrot Set 132 Writing the mandelbrot Function 135 Adding Color to the Mandelbrot Set 139 Creating the Julia Set 141 Writing the julia Function 141 Summary 143 8 Using Matrices for Computer Graphics 145 and systems of equations What Is a Matrix 146 Adding Matrices 146 Multiplying Matrices 147 Order Matters in Matrix Multiplication 151 Drawing 2D Shapes 151 Transforming Matrices 154 Transposing Matrices 156 Rotating Matrices in Real Time 160 Creating 3D Shapes 161 Creating the Rotation Matrix 162 Solving Systems of Equations with Matrices 166 Gaussian Elimination 167 Writing the gauss Function 168 Summary 172 Contents in Detail