title
Coding Challenge #12: The Lorenz Attractor in Processing

description
In this coding challenge, I show you how to visualization the Lorenz Attractor in Processing. Code: https://thecodingtrain.com/challenges/12-lorenz-attractor ๐Ÿ•น๏ธ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/pwr_7FUUq ๐ŸŽฅ Previous video: https://youtu.be/IKB1hWWedMk?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH ๐ŸŽฅ Next video: https://youtu.be/BV9ny785UNc?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH ๐ŸŽฅ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH References: ๐Ÿ“‘ Lorenz System on Wikipedia: https://en.wikipedia.org/wiki/Lorenz_system ๐Ÿ“– Lorenz Attractor: http://paulbourke.net/fractals/lorenz/ ๐Ÿ“š PeasyCam library: http://mrfeinberg.com/peasycam ๐Ÿ’ป beginShape(): https://processing.org/reference/beginShape_.html ๐Ÿงพ What is a differential equation?: https://www.myphysicslab.com/explain/what-is-a-diff-eq-en.html ๐Ÿ“• My NOC class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info Videos: ๐Ÿ”ด Livestream Archive: https://youtu.be/gw_TR1tycWQ?t=2202s Related Coding Challenges: ๐Ÿš‚ #13 Reaction Diffusion Algorithm: https://youtu.be/BV9ny785UNc ๐Ÿš‚ #160 Spring Forces: https://youtu.be/Rr-5HiXquhw Timestamps: 0:00 Introducing today's topic 0:55 Differential Equations 2:30 Lorenz systems 3:36 Non-linear, chaotic systems 4:30 Start Coding! 6:07 Every cycle through draw is 1 unit of time 6:30 Add formulas to code 8:19 Change of time per frame 10:10 Modify the inputs 12:48 Plot the system 14:08 Scale the scene 14:42 Add an array list to store the data 16:00 Write an enhanced loop 17:00 Add beginShape() and endShape() to connect the points 17:52 Change to HSB mode and add color 19:07 Add an offset 20:06 Conclusion and design possiblities Editing by Mathieu Blanchette Animations by Jason Heglund Music from Epidemic Sound ๐Ÿš‚ Website: http://thecodingtrain.com/ ๐Ÿ‘พ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide ๐Ÿšฉ Suggest Topics: https://github.com/CodingTrain/Suggestion-Box ๐Ÿ’ก GitHub: https://github.com/CodingTrain ๐Ÿ’ฌ Discord: https://discord.gg/hPuGy2g ๐Ÿ’– Membership: http://youtube.com/thecodingtrain/join ๐Ÿ›’ Store: https://standard.tv/codingtrain ๐Ÿ–‹๏ธ Twitter: https://twitter.com/thecodingtrain ๐Ÿ“ธ Instagram: https://www.instagram.com/the.coding.train/ ๐ŸŽฅ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH ๐ŸŽฅ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA ๐Ÿ”— p5.js: https://p5js.org ๐Ÿ”— p5.js Web Editor: https://editor.p5js.org/ ๐Ÿ”— Processing: https://processing.org ๐Ÿ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new #math #lorenzattractor #processing #java

detail
{'title': 'Coding Challenge #12: The Lorenz Attractor in Processing', 'heatmap': [{'end': 238.791, 'start': 214.439, 'weight': 1}], 'summary': 'Tutorial covers implementing the lorenz attractor in 3d using processing, emphasizing the concept of chaotic nonlinear systems, differential equations, modeling and implementing equations in code, time steps in animation, debugging, and drawing the full lorenz attractor shape in 3d.', 'chapters': [{'end': 244.773, 'segs': [{'end': 30.351, 'src': 'embed', 'start': 0.389, 'weight': 1, 'content': [{'end': 3.03, 'text': 'Hello, and welcome to another coding challenge.', 'start': 0.389, 'duration': 2.641}, {'end': 9.353, 'text': 'In this coding challenge, I am going to implement the system you see over here on the right called the Lorenz attractor.', 'start': 3.371, 'duration': 5.982}, {'end': 16.117, 'text': 'Visualize that in 3D, in processing, all in one session here, which will hopefully be about 10 to 20 minutes.', 'start': 9.694, 'duration': 6.423}, {'end': 17.497, 'text': "We'll see how long it takes.", 'start': 16.577, 'duration': 0.92}, {'end': 18.798, 'text': "I've got a timer running up there.", 'start': 17.537, 'duration': 1.261}, {'end': 23.803, 'text': 'Okay, so before I start actually writing the code for it, I want to talk about what this system is.', 'start': 19.278, 'duration': 4.525}, {'end': 30.351, 'text': 'why does it exist, why is it interesting and how does the math behind it work on a kind of higher level?', 'start': 23.803, 'duration': 6.548}], 'summary': 'Implementing the lorenz attractor in 3d using processing, aiming for a 10 to 20-minute session.', 'duration': 29.962, 'max_score': 0.389, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk389.jpg'}, {'end': 84.462, 'src': 'embed', 'start': 57.85, 'weight': 2, 'content': [{'end': 63.072, 'text': 'I could easily be here for like the rest of the day talking about differential equations and confusing myself over and over again.', 'start': 57.85, 'duration': 5.222}, {'end': 72.357, 'text': 'But the basic idea of a differential equation is an equation that looks at how a certain variable changes according to other variables.', 'start': 63.352, 'duration': 9.005}, {'end': 76.318, 'text': 'How the rate of change of a variable is affected by other variables in a system.', 'start': 72.397, 'duration': 3.921}, {'end': 78.379, 'text': 'That rate of change being a differential.', 'start': 76.558, 'duration': 1.821}, {'end': 84.462, 'text': 'So let me give you an actual practical real world example that might help solidify this understanding.', 'start': 78.599, 'duration': 5.863}], 'summary': 'Differential equations describe variable change rates in systems.', 'duration': 26.612, 'max_score': 57.85, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk57850.jpg'}, {'end': 202.467, 'src': 'embed', 'start': 174.547, 'weight': 0, 'content': [{'end': 184.353, 'text': "So if I look at those values, the state x, y, z over time, and draw them with colors and lines, I'm going to see this particular system.", 'start': 174.547, 'duration': 9.806}, {'end': 186.874, 'text': 'So why is this system interesting?', 'start': 184.573, 'duration': 2.301}, {'end': 196.901, 'text': 'It turns out that the Lorenz system, which was invented or discovered in 1963 by Edward Edward, Edward, Edward Edward Lorenz.', 'start': 187.155, 'duration': 9.746}, {'end': 202.467, 'text': 'He was studying meteorological conditions, the flow of the atmosphere, this type of thing.', 'start': 197.562, 'duration': 4.905}], 'summary': 'The lorenz system, discovered in 1963, models meteorological conditions and atmosphere flow.', 'duration': 27.92, 'max_score': 174.547, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk174547.jpg'}, {'end': 241.392, 'src': 'heatmap', 'start': 214.439, 'weight': 1, 'content': [{'end': 219.384, 'text': "It's a deterministic system that will produce an exact result every time with the same inputs.", 'start': 214.439, 'duration': 4.945}, {'end': 224.666, 'text': 'But if you change the input ever so slightly, you could get a wildly different output.', 'start': 219.824, 'duration': 4.842}, {'end': 225.586, 'text': "It's nonlinear.", 'start': 224.726, 'duration': 0.86}, {'end': 228.807, 'text': 'A tiny change to the input makes a large change to the output.', 'start': 225.706, 'duration': 3.101}, {'end': 230.248, 'text': 'This is the butterfly effect.', 'start': 229.067, 'duration': 1.181}, {'end': 238.791, 'text': 'A little butterfly flaps its wings, changing the air just a tiny bit in the outside on one side of the world.', 'start': 230.528, 'duration': 8.263}, {'end': 241.392, 'text': 'And on the other side of the world, a giant volcano erupts.', 'start': 239.011, 'duration': 2.381}], 'summary': 'Deterministic system with nonlinear behavior exhibits the butterfly effect.', 'duration': 26.953, 'max_score': 214.439, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk214439.jpg'}], 'start': 0.389, 'title': 'Implementing lorenz attractor in 3d and understanding chaotic nonlinear systems', 'summary': 'Discusses the implementation of the lorenz attractor in 3d using processing, aiming for completion in 10 to 20 minutes and explains the concept of differential equations and their relevance to the system. it also explains differential equations and the lorenz system, a chaotic nonlinear system discovered in 1963, which illustrates the butterfly effect and the sensitivity to initial conditions.', 'chapters': [{'end': 78.379, 'start': 0.389, 'title': 'Implementing lorenz attractor in 3d', 'summary': 'Discusses the implementation of the lorenz attractor in 3d using processing, aiming for completion in 10 to 20 minutes, and explains the concept of differential equations and their relevance to the system.', 'duration': 77.99, 'highlights': ['The chapter discusses the implementation of the Lorenz attractor in 3D using processing, aiming for completion in 10 to 20 minutes.', 'It explains the concept of differential equations as equations that look at how a certain variable changes according to other variables, and how the rate of change of a variable is affected by other variables in a system.']}, {'end': 244.773, 'start': 78.599, 'title': 'Understanding chaotic nonlinear systems', 'summary': 'Explains differential equations and the lorenz system, a chaotic nonlinear system discovered in 1963, which illustrates the butterfly effect and the sensitivity to initial conditions.', 'duration': 166.174, 'highlights': ['The Lorenz system is a chaotic nonlinear system discovered in 1963, illustrating the butterfly effect and sensitivity to initial conditions. The Lorenz system, discovered in 1963, is a chaotic nonlinear system where a tiny change in the input can result in a wildly different output, known as the butterfly effect.', "Differential equations and the concept of the rate of change are explained, with the example of a spring's position changing over time. The chapter explains differential equations and the concept of the rate of change using the example of a spring's position changing over time, illustrating how the rate of change is a function of the variables in the system itself.", "The practical example of a spring's position changing over time is used to illustrate the concept of differential equations. A practical real-world example of a spring's position changing over time is used to illustrate the concept of differential equations and how the rate of change is based on the position itself."]}], 'duration': 244.384, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk389.jpg', 'highlights': ['The Lorenz system is a chaotic nonlinear system discovered in 1963, illustrating the butterfly effect and sensitivity to initial conditions.', 'The chapter discusses the implementation of the Lorenz attractor in 3D using processing, aiming for completion in 10 to 20 minutes.', 'It explains the concept of differential equations as equations that look at how a certain variable changes according to other variables, and how the rate of change of a variable is affected by other variables in a system.', "Differential equations and the concept of the rate of change are explained, with the example of a spring's position changing over time."]}, {'end': 488.533, 'segs': [{'end': 272.072, 'src': 'embed', 'start': 244.813, 'weight': 0, 'content': [{'end': 253.635, 'text': "It's unpredictable, And a lot of these types of systems exist in nature, and this is one particular example of a model of that type of system.", 'start': 244.813, 'duration': 8.822}, {'end': 260.255, 'text': "Okay so now let's look at these formula and let's try to figure out how we're going to actually make this happen in code.", 'start': 253.635, 'duration': 6.62}, {'end': 261.096, 'text': "I think we're ready.", 'start': 260.255, 'duration': 0.841}, {'end': 264.638, 'text': 'so we know that I need three variables an x, a y and a z.', 'start': 261.096, 'duration': 3.542}, {'end': 272.072, 'text': "so let me go to my program here and I'm going to close this one and I'm going to start writing some code from scratch,", 'start': 264.638, 'duration': 7.434}], 'summary': 'Discussion about modeling a system in code with three variables: x, y, and z.', 'duration': 27.259, 'max_score': 244.813, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk244813.jpg'}, {'end': 317.362, 'src': 'embed', 'start': 291.745, 'weight': 1, 'content': [{'end': 298.07, 'text': "Now, one thing I should mention really briefly as I'm about five minutes into this is that notice I defined those values as floats.", 'start': 291.745, 'duration': 6.325}, {'end': 304.934, 'text': "If you look at examples, you'll find on the internet Often the the data type that will be used as a double,", 'start': 298.49, 'duration': 6.444}, {'end': 307.156, 'text': 'a double being just like a floating-point number,', 'start': 304.934, 'duration': 2.222}, {'end': 312.399, 'text': 'But having more decimal places and sometimes with these systems you really need a high degree of accuracy.', 'start': 307.156, 'duration': 5.243}, {'end': 317.362, 'text': "But I'm just some person here on the internet programming colors and things on the screen.", 'start': 312.399, 'duration': 4.963}], 'summary': 'Defining values as floats for high accuracy in programming.', 'duration': 25.617, 'max_score': 291.745, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk291745.jpg'}, {'end': 400.018, 'src': 'embed', 'start': 371.111, 'weight': 3, 'content': [{'end': 376.913, 'text': "Those formulas, the change in x over time, those formulas are talking about real life time that's continuous.", 'start': 371.111, 'duration': 5.802}, {'end': 380.274, 'text': 'Our time in processing is frame by frame by frame.', 'start': 377.313, 'duration': 2.961}, {'end': 382.994, 'text': 'So every cycle through draw is one unit of time.', 'start': 380.514, 'duration': 2.48}, {'end': 396.035, 'text': "So what I'm going to say is that the change in x equals that constant times what? y minus x, y minus x.", 'start': 383.334, 'duration': 12.701}, {'end': 400.018, 'text': 'And now, x equals x plus that change in x.', 'start': 396.035, 'duration': 3.983}], 'summary': 'Formulas describe real time as continuous, with processing occurring frame by frame.', 'duration': 28.907, 'max_score': 371.111, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk371111.jpg'}, {'end': 488.533, 'src': 'embed', 'start': 458.847, 'weight': 4, 'content': [{'end': 460.888, 'text': 'And now I just need to get some spacing here.', 'start': 458.847, 'duration': 2.041}, {'end': 469.85, 'text': 'And I need to also add two more constants, float b equals 1, float c equals 1.', 'start': 460.928, 'duration': 8.922}, {'end': 471.79, 'text': 'And now I need to just change x, y, and z.', 'start': 469.85, 'duration': 1.94}, {'end': 481.567, 'text': 'x, y, z, x, y, z, y, z, d, y, d, z, okay? So this is the idea.', 'start': 473.96, 'duration': 7.607}, {'end': 486.812, 'text': 'I implement those formulas directly from the Wikipedia page to calculate the change in x, the change in y,', 'start': 481.867, 'duration': 4.945}, {'end': 488.533, 'text': 'the change in z and then actually change them.', 'start': 486.812, 'duration': 1.721}], 'summary': 'Implementing formulas to calculate change in x, y, z.', 'duration': 29.686, 'max_score': 458.847, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk458847.jpg'}], 'start': 244.813, 'title': 'Modeling and implementing equations in code', 'summary': 'Discusses the modeling of natural systems in code, emphasizing the need for three variables (x, y, z) and initial values. it also covers implementing equations for processing, including defining values as floats, adapting real-time formulas for frame-by-frame processing, and calculating the change in x, y, and z.', 'chapters': [{'end': 291.685, 'start': 244.813, 'title': 'Modeling natural systems in code', 'summary': 'Discusses modeling natural systems in code, focusing on the need for three variables (x, y, z) and the initial values required for equations.', 'duration': 46.872, 'highlights': ['The chapter discusses the need for three variables (x, y, z) and the initial values required for equations.', 'The speaker emphasizes the unpredictability of such systems existing in nature.', 'The chapter describes the process of starting to write code from scratch to model natural systems.']}, {'end': 488.533, 'start': 291.745, 'title': 'Implementing equations for processing', 'summary': 'Discusses implementing equations for processing, with a focus on defining values as floats, adapting continuous real-time formulas for frame-by-frame processing, and implementing formulas to calculate the change in x, y, and z.', 'duration': 196.788, 'highlights': ['Defining values as floats allows for a high degree of accuracy, as opposed to using doubles, which have more decimal places (e.g., Sigma, Rho, Beta).', 'Implementing continuous real-time formulas in frame-by-frame processing involves adapting equations to fit the discrete nature of processing time, where every cycle through draw is one unit of time.', 'The chapter explains the process of implementing formulas from a Wikipedia page to calculate the change in x, y, and z, involving constants such as afloat, bfloat, and cfloat, and the iterative calculation of x, y, and z.']}], 'duration': 243.72, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk244813.jpg', 'highlights': ['The chapter discusses the need for three variables (x, y, z) and the initial values required for equations.', 'Defining values as floats allows for a high degree of accuracy, as opposed to using doubles, which have more decimal places (e.g., Sigma, Rho, Beta).', 'The chapter describes the process of starting to write code from scratch to model natural systems.', 'Implementing continuous real-time formulas in frame-by-frame processing involves adapting equations to fit the discrete nature of processing time, where every cycle through draw is one unit of time.', 'The chapter explains the process of implementing formulas from a Wikipedia page to calculate the change in x, y, and z, involving constants such as afloat, bfloat, and cfloat, and the iterative calculation of x, y, and z.', 'The speaker emphasizes the unpredictability of such systems existing in nature.']}, {'end': 660.171, 'segs': [{'end': 541.109, 'src': 'embed', 'start': 514.164, 'weight': 0, 'content': [{'end': 519.33, 'text': 'But in the processing animation world, I have point, point, point, point, point.', 'start': 514.164, 'duration': 5.166}, {'end': 521.53, 'text': 'And I might connect those with a line.', 'start': 520.13, 'duration': 1.4}, {'end': 524.232, 'text': 'So do I want to see my result look like this?', 'start': 521.811, 'duration': 2.421}, {'end': 527.238, 'text': 'Or do I want to see it as more continuous curve?', 'start': 525.256, 'duration': 1.982}, {'end': 529.339, 'text': 'How fine do I want those to be?', 'start': 527.498, 'duration': 1.841}, {'end': 531.681, 'text': "And that's the sort of dt, right?", 'start': 529.56, 'duration': 2.121}, {'end': 534.103, 'text': "If you think about oops, I'm going to come back over here, right?", 'start': 532.122, 'duration': 1.981}, {'end': 537.566, 'text': "Really, I'm saying dx over dt equals something.", 'start': 534.324, 'duration': 3.242}, {'end': 541.109, 'text': 'So what I want to do is actually take that something and multiply it by dt.', 'start': 537.586, 'duration': 3.523}], 'summary': 'Discussion on processing animation and manipulating dt in equations.', 'duration': 26.945, 'max_score': 514.164, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk514164.jpg'}, {'end': 636.494, 'src': 'embed', 'start': 609.334, 'weight': 1, 'content': [{'end': 613.017, 'text': "And if I run this again, we should see, look, I'm getting some interesting values there.", 'start': 609.334, 'duration': 3.683}, {'end': 616.659, 'text': 'Now, are these values producing anything of note? Not really.', 'start': 613.217, 'duration': 3.442}, {'end': 622.243, 'text': 'But why not? Well, because my constants, I just made my constants 1, 1, and 1.', 'start': 617.02, 'duration': 5.223}, {'end': 628.488, 'text': 'So the Lorenz attractor works a particular way based on what those input constants are.', 'start': 622.243, 'duration': 6.245}, {'end': 636.494, 'text': "So if I go back to the Wikipedia page, I could sort of find somewhere on here, it's going to give me some values I could use.", 'start': 629.088, 'duration': 7.406}], 'summary': 'Testing different constants for lorenz attractor model shows lack of notable results.', 'duration': 27.16, 'max_score': 609.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk609334.jpg'}], 'start': 488.573, 'title': 'Time steps and animation', 'summary': 'Discusses time steps in animation, introducing the variable dt and specifying input constants for the lorenz attractor to work effectively.', 'chapters': [{'end': 660.171, 'start': 488.573, 'title': 'Understanding time steps and animation', 'summary': 'Discusses the concept of time steps in processing animation, introducing the variable dt to scale the change of time for each frame and modify the inputs to produce non-zero values, and specifies the input constants required for the lorenz attractor to work effectively.', 'duration': 171.598, 'highlights': ['The chapter introduces the concept of time steps in processing animation, emphasizing the need to consider whether to visualize results as a continuous curve or a series of points connected by lines, and introduces the variable dt to scale the change of time for each frame.', 'The speaker modifies the inputs to start with x as 0.01 to ensure the formulas do not produce zero values and specifies the input constants required for the Lorenz attractor to work effectively, including sigma equals 10, rho equals 28, and beta equals 8 divided by 3.']}], 'duration': 171.598, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk488573.jpg', 'highlights': ['The chapter introduces the concept of time steps in processing animation, emphasizing the need to consider whether to visualize results as a continuous curve or a series of points connected by lines, and introduces the variable dt to scale the change of time for each frame.', 'The speaker modifies the inputs to start with x as 0.01 to ensure the formulas do not produce zero values and specifies the input constants required for the Lorenz attractor to work effectively, including sigma equals 10, rho equals 28, and beta equals 8 divided by 3.']}, {'end': 949.5, 'segs': [{'end': 694.917, 'src': 'embed', 'start': 662.079, 'weight': 2, 'content': [{'end': 664.86, 'text': "I'm skeptical, and we should see, ooh, not a number.", 'start': 662.079, 'duration': 2.781}, {'end': 666.9, 'text': 'Okay, so what have I done wrong here?', 'start': 665.14, 'duration': 1.76}, {'end': 673.702, 'text': 'I might have to time out this video to see how long this debugging takes and this might get edited out if this starts to take a really long time.', 'start': 666.98, 'duration': 6.722}, {'end': 674.582, 'text': "but let's look here.", 'start': 673.702, 'duration': 0.88}, {'end': 688.366, 'text': "So what have I done wrong here? X, Y, Z, so let's comment out and just do X for a second and see what I get.", 'start': 675.643, 'duration': 12.723}, {'end': 694.917, 'text': 'Oops, and I just want to look at x.', 'start': 690.854, 'duration': 4.063}], 'summary': 'Debugging process with x, y, z; considering time constraints.', 'duration': 32.838, 'max_score': 662.079, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk662079.jpg'}, {'end': 741.511, 'src': 'embed', 'start': 711.507, 'weight': 0, 'content': [{'end': 712.728, 'text': 'I hope I implemented this right.', 'start': 711.507, 'duration': 1.221}, {'end': 714.569, 'text': 'I have to check my formulas.', 'start': 712.748, 'duration': 1.821}, {'end': 719.919, 'text': "But let's go back here and see if I'm getting some reasonable formulas.", 'start': 716.257, 'duration': 3.662}, {'end': 720.98, 'text': 'OK, good.', 'start': 720.579, 'duration': 0.401}, {'end': 722.66, 'text': 'OK, so this is better.', 'start': 721.76, 'duration': 0.9}, {'end': 724.081, 'text': 'This is what I expected to see.', 'start': 722.921, 'duration': 1.16}, {'end': 724.762, 'text': 'OK, great.', 'start': 724.241, 'duration': 0.521}, {'end': 727.303, 'text': "So now I'm seeing some numbers that make more sense.", 'start': 725.342, 'duration': 1.961}, {'end': 733.726, 'text': "So my issue there was literally just having, and I think that won't get edited out, was just having the number 1.", 'start': 727.323, 'duration': 6.403}, {'end': 736.428, 'text': 'And it just sort of went off to infinity super fast.', 'start': 733.726, 'duration': 2.702}, {'end': 741.511, 'text': "These systems, they don't have a recognizable repeating pattern.", 'start': 736.708, 'duration': 4.803}], 'summary': 'Implementing and checking formulas, achieving expected results and making sense of the numbers.', 'duration': 30.004, 'max_score': 711.507, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk711507.jpg'}, {'end': 806.075, 'src': 'embed', 'start': 774.663, 'weight': 3, 'content': [{'end': 776.383, 'text': "And you could start to see, like, that's something there.", 'start': 774.663, 'duration': 1.72}, {'end': 779.724, 'text': "So I'm actually, we're kind of, like, we're trucking along here.", 'start': 776.724, 'duration': 3}, {'end': 782.545, 'text': "I've got the Lorenz system, like, sort of visualizing right now.", 'start': 779.804, 'duration': 2.741}, {'end': 785.466, 'text': "Really, basically, I'm done.", 'start': 784.565, 'duration': 0.901}, {'end': 788.627, 'text': 'However, I want to make this look like something.', 'start': 786.366, 'duration': 2.261}, {'end': 790.228, 'text': 'I want to make this look like a 3D shape.', 'start': 788.647, 'duration': 1.581}, {'end': 791.649, 'text': 'I want to maybe add some color to it.', 'start': 790.428, 'duration': 1.221}, {'end': 792.889, 'text': 'I want to be able to spin around it.', 'start': 791.669, 'duration': 1.22}, {'end': 794.91, 'text': 'I need to do more with it.', 'start': 793.389, 'duration': 1.521}, {'end': 799.112, 'text': 'Maybe I want to be able to explode it so that all the points just fly off of it and come back.', 'start': 794.95, 'duration': 4.162}, {'end': 806.075, 'text': 'So I want to do, even though in 13 minutes we kind of got the math down, I want to do more with this in terms of the visual output of it.', 'start': 799.332, 'duration': 6.743}], 'summary': 'Visualizing the lorenz system, aims to enhance with 3d shape, color, and interactivity.', 'duration': 31.412, 'max_score': 774.663, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk774663.jpg'}, {'end': 869.564, 'src': 'embed', 'start': 839.582, 'weight': 4, 'content': [{'end': 841.783, 'text': "I'm not going to get this through zooming in and out as well,", 'start': 839.582, 'duration': 2.201}, {'end': 844.964, 'text': 'but I just want all the points to be sort of spaced out a bit more and look a little bigger.', 'start': 841.783, 'duration': 3.181}, {'end': 847.205, 'text': "So I'm going to basically scale everything by five.", 'start': 844.984, 'duration': 2.221}, {'end': 850.848, 'text': 'So we can see, yeah, so this looks, so now I kind of have a bit of a closer view.', 'start': 847.785, 'duration': 3.063}, {'end': 854.671, 'text': 'You can see all the points of Lorenz Tractor are being plotted in 3D.', 'start': 850.868, 'duration': 3.803}, {'end': 856.073, 'text': "Now here's the thing.", 'start': 855.252, 'duration': 0.821}, {'end': 860.116, 'text': "How am I getting all these points on the screen? I'm just drawing one point at a time.", 'start': 856.613, 'duration': 3.503}, {'end': 862.658, 'text': 'Well notice how my background is in setup.', 'start': 860.577, 'duration': 2.081}, {'end': 869.564, 'text': "So this worked just to see that the system was working, but it's not going to be a very good solution for eventually, over time,", 'start': 863.459, 'duration': 6.105}], 'summary': 'Scaling all points by five to visualize lorenz tractor in 3d.', 'duration': 29.982, 'max_score': 839.582, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk839582.jpg'}, {'end': 921.577, 'src': 'embed', 'start': 891.823, 'weight': 5, 'content': [{'end': 897.925, 'text': 'So this is the syntax for something in Java called an array list, which is a flexibly sized array, something I could just add to,', 'start': 891.823, 'duration': 6.102}, {'end': 902.367, 'text': "and I'm calling it points, and the data that I'm going to put into that array list are p vector objects.", 'start': 897.925, 'duration': 4.442}, {'end': 912.712, 'text': "Why do I want a p vector object? It's because every single frame, I'm going to say points.add a new p vector with that x, y, and z.", 'start': 902.627, 'duration': 10.085}, {'end': 921.577, 'text': 'So I want to add a new vector with x, y, and z to that particular array list, and we can see that this is, Still working, nothing is broken yet.', 'start': 912.712, 'duration': 8.865}], 'summary': 'Using java array list to store flexibly sized p vector objects for x, y, and z data.', 'duration': 29.754, 'max_score': 891.823, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk891823.jpg'}], 'start': 662.079, 'title': 'Debugging time travel formula and visualizing lorenz system in 3d', 'summary': 'Involves debugging a time travel formula by correcting a numerical error and discusses visualizing the lorenz system in 3d using a programming language, aiming to enhance the visual output and achieve chaotic motion.', 'chapters': [{'end': 733.726, 'start': 662.079, 'title': 'Debugging time travel formula', 'summary': 'Involves debugging a time travel formula, where the issue was identified as using the number 1 instead of 0.01, resulting in unexpected calculations and small numbers.', 'duration': 71.647, 'highlights': ['Identified issue with using the number 1 instead of 0.01, resulting in unexpected calculations and small numbers', 'Implemented correction to use 0.01, which resulted in seeing numbers that made more sense', 'Skepticism and debugging process while identifying and resolving the formula issue']}, {'end': 949.5, 'start': 733.726, 'title': 'Visualizing lorenz system in 3d', 'summary': 'Discusses visualizing the lorenz system in 3d using a programming language, with a focus on plotting points, scaling the scene, and storing points in an array list for efficient manipulation, aiming to enhance the visual output and achieve a chaotic motion.', 'duration': 215.774, 'highlights': ['Visualizing Lorenz system in 3D The chapter primarily focuses on visualizing the Lorenz system in 3D using a programming language.', 'Plotting points and scaling the scene The author discusses plotting the state of the system over time with x and y coordinates and scaling the scene to stretch out the points, achieving a closer view.', 'Storing points in an array list The chapter emphasizes the need for a data structure to store all the points of the Lorenz attractor efficiently, leading to the use of an array list to store p vector objects containing x, y, and z coordinates.']}], 'duration': 287.421, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk662079.jpg', 'highlights': ['Implemented correction to use 0.01, resulting in more sensible numbers', 'Identified issue with using the number 1 instead of 0.01, leading to unexpected calculations', 'Skepticism and debugging process while identifying and resolving the formula issue', 'Visualizing Lorenz system in 3D using a programming language', 'Plotting points and scaling the scene for a closer view', 'Storing points in an array list efficiently using p vector objects']}, {'end': 1279.719, 'segs': [{'end': 1005.766, 'src': 'embed', 'start': 950.061, 'weight': 0, 'content': [{'end': 963.666, 'text': 'So what I want to do is, instead of just drawing the existing point, what I want to do is say for every vector v in that array list points,', 'start': 950.061, 'duration': 13.605}, {'end': 969.889, 'text': 'draw a point at v.x, v.y and v.z.', 'start': 964.625, 'duration': 5.264}, {'end': 970.809, 'text': "So I'm now saying,", 'start': 970.169, 'duration': 0.64}, {'end': 977.934, 'text': 'instead of just drawing the current point loop through and this is known as an enhanced loop in Java for every vector v in the ArrayList points,', 'start': 970.809, 'duration': 7.125}, {'end': 979.495, 'text': 'draw a point at v.x, v.y, v.y, v.y.', 'start': 977.934, 'duration': 1.561}, {'end': 985.841, 'text': 'Back after a technical hiccup.', 'start': 984.161, 'duration': 1.68}, {'end': 993.723, 'text': 'you can see that the entire Lorenz attractor is drawn with each element as a separate point based on every p vector.', 'start': 985.841, 'duration': 7.882}, {'end': 994.503, 'text': "that's in that array.", 'start': 993.723, 'duration': 0.78}, {'end': 996.564, 'text': "So really, essentially, I'm done.", 'start': 994.743, 'duration': 1.821}, {'end': 997.644, 'text': 'There you go.', 'start': 997.164, 'duration': 0.48}, {'end': 998.564, 'text': "It's in 3D.", 'start': 997.904, 'duration': 0.66}, {'end': 1000.584, 'text': "That's the entire Lorenz attractor shape.", 'start': 998.724, 'duration': 1.86}, {'end': 1005.766, 'text': 'But I do want to add some more things to this and give you some exercises to think about what you might do with this.', 'start': 1000.644, 'duration': 5.122}], 'summary': 'Enhanced loop in java draws 3d lorenz attractor with separate points for each element in the array list.', 'duration': 55.705, 'max_score': 950.061, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk950061.jpg'}, {'end': 1131.601, 'src': 'embed', 'start': 1106.168, 'weight': 3, 'content': [{'end': 1113.752, 'text': 'And now I should get, why not have a rainbow, since this is coding rainbow, a rainbow Lorenz attractor pattern.', 'start': 1106.168, 'duration': 7.584}, {'end': 1118.294, 'text': "So you can see as the color is changing, we've got kind of yellow, red to yellow to orange, and that sort of thing.", 'start': 1113.792, 'duration': 4.502}, {'end': 1121.456, 'text': 'Really, the last thing I want to mention.', 'start': 1119.415, 'duration': 2.041}, {'end': 1131.601, 'text': "So what's interesting about what I'm doing with this particular strategy, separate from the Lorenz attractor algorithm itself,", 'start': 1121.536, 'duration': 10.065}], 'summary': 'Creating a rainbow lorenz attractor pattern with changing colors.', 'duration': 25.433, 'max_score': 1106.168, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk1106168.jpg'}, {'end': 1177.238, 'src': 'embed', 'start': 1150.274, 'weight': 4, 'content': [{'end': 1157.307, 'text': "That's going to give me just a random unit vector of unit, one of length, one pointed in a random direction,", 'start': 1150.274, 'duration': 7.033}, {'end': 1162.731, 'text': 'and I could add that offset to every single vector in the Lorenz attractor.', 'start': 1157.307, 'duration': 5.424}, {'end': 1167.833, 'text': "Now, if I run this, it's kind of going to go crazy, because the unit of I've scaled up by five,", 'start': 1162.931, 'duration': 4.902}, {'end': 1169.974, 'text': "so you can see it's like shaking and jiggling like crazy.", 'start': 1167.833, 'duration': 2.141}, {'end': 1177.238, 'text': 'So what I could do is maybe shrink that offset down quite a bit by, you know, make it 10% of the length of itself.', 'start': 1170.275, 'duration': 6.963}], 'summary': 'Adding a random unit vector to every vector in lorenz attractor and scaling it up by five makes it shake and jiggle, which can be reduced by shrinking the offset to 10% of its length.', 'duration': 26.964, 'max_score': 1150.274, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk1150274.jpg'}, {'end': 1268.173, 'src': 'embed', 'start': 1242.231, 'weight': 5, 'content': [{'end': 1246.316, 'text': 'Can you go to a site and find a different kind of attractor?', 'start': 1242.231, 'duration': 4.085}, {'end': 1247.658, 'text': "that's not the Lorenz one?", 'start': 1246.316, 'duration': 1.342}, {'end': 1251.763, 'text': "There's a lot of these under the category of strange attractors.", 'start': 1248.179, 'duration': 3.584}, {'end': 1254.066, 'text': 'So try to make your own version of this.', 'start': 1252.023, 'duration': 2.043}, {'end': 1259.208, 'text': "be creative, play, experiment, don't worry too much, and share with me your results.", 'start': 1254.846, 'duration': 4.362}, {'end': 1266.732, 'text': "But this has been, hopefully, something you've enjoyed, which is programming the Lorenz Attractor from scratch in processing in 3D.", 'start': 1259.429, 'duration': 7.303}, {'end': 1268.173, 'text': 'Thank you very much for watching.', 'start': 1267.012, 'duration': 1.161}], 'summary': 'Explore and create a different kind of attractor than the lorenz one, in the category of strange attractors, and share the results.', 'duration': 25.942, 'max_score': 1242.231, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk1242231.jpg'}], 'start': 950.061, 'title': 'Drawing and programming lorenz attractor', 'summary': 'Covers drawing the entire lorenz attractor shape in 3d using an enhanced loop in java and programming the lorenz attractor in processing in 3d, emphasizing visual design, color manipulation, real-time point manipulation, and creativity.', 'chapters': [{'end': 1005.766, 'start': 950.061, 'title': 'Drawing lorenz attractor in 3d', 'summary': 'Explains how to draw the entire lorenz attractor shape in 3d using an enhanced loop in java, resulting in each element being drawn as a separate point based on every p vector.', 'duration': 55.705, 'highlights': ['The entire Lorenz attractor is drawn in 3D with each element as a separate point based on every p vector in the array list points.', 'The chapter discusses using an enhanced loop in Java to draw a point at v.x, v.y, and v.z for every vector v in the ArrayList points.', 'The speaker mentions adding more elements and exercises to further enhance the visualization of the Lorenz attractor.']}, {'end': 1279.719, 'start': 1005.806, 'title': 'Programming lorenz attractor in processing', 'summary': 'Introduces how to program the lorenz attractor in processing in 3d, emphasizing the visual design aspects, color manipulation, real-time manipulation of the points, and encourages experimentation and creativity.', 'duration': 273.913, 'highlights': ['The Lorenz Attractor algorithm is demonstrated in Processing, with a focus on visual design and color manipulation, showcasing a turquoisey, greeny hue with a rainbow pattern, created by changing the hue and adding a rainbow Lorenz attractor pattern.', 'The chapter explores real-time manipulation of the points in the Lorenz attractor, demonstrating the addition of a random unit vector offset and its impact on the movement of points, encouraging experimentation with different manipulations such as moving along a sine wave or morphing into other shapes.', 'The audience is encouraged to explore their own design spin on the Lorenz Attractor, experiment with different constants, look up other known constants for the attractor, and try creating different types of strange attractors, emphasizing creativity, play, and sharing of results.']}], 'duration': 329.658, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/f0lkz2gSsIk/pics/f0lkz2gSsIk950061.jpg', 'highlights': ['The entire Lorenz attractor is drawn in 3D with each element as a separate point based on every p vector in the array list points.', 'The chapter discusses using an enhanced loop in Java to draw a point at v.x, v.y, and v.z for every vector v in the ArrayList points.', 'The speaker mentions adding more elements and exercises to further enhance the visualization of the Lorenz attractor.', 'The Lorenz Attractor algorithm is demonstrated in Processing, with a focus on visual design and color manipulation, showcasing a turquoisey, greeny hue with a rainbow pattern, created by changing the hue and adding a rainbow Lorenz attractor pattern.', 'The chapter explores real-time manipulation of the points in the Lorenz attractor, demonstrating the addition of a random unit vector offset and its impact on the movement of points, encouraging experimentation with different manipulations such as moving along a sine wave or morphing into other shapes.', 'The audience is encouraged to explore their own design spin on the Lorenz Attractor, experiment with different constants, look up other known constants for the attractor, and try creating different types of strange attractors, emphasizing creativity, play, and sharing of results.']}], 'highlights': ['The Lorenz system is a chaotic nonlinear system discovered in 1963, illustrating the butterfly effect and sensitivity to initial conditions.', 'The chapter discusses the implementation of the Lorenz attractor in 3D using processing, aiming for completion in 10 to 20 minutes.', 'The chapter introduces the concept of time steps in processing animation, emphasizing the need to consider whether to visualize results as a continuous curve or a series of points connected by lines, and introduces the variable dt to scale the change of time for each frame.', 'The entire Lorenz attractor is drawn in 3D with each element as a separate point based on every p vector in the array list points.', 'The chapter explores real-time manipulation of the points in the Lorenz attractor, demonstrating the addition of a random unit vector offset and its impact on the movement of points, encouraging experimentation with different manipulations such as moving along a sine wave or morphing into other shapes.']}