Programming Reaction Diffusion Models

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 มิ.ย. 2023
  • Learn how to program reaction-diffusion models in Java. Reaction-diffusion models are simple models of chemical interactions incorporating reactions between multiple chemicals and diffusion between cells. This video covers the classic Gray-Scott model used to generate beautiful, organic patterns. It teaches how to program diffusion (and image kernels), 2D arrays, and wrapping.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 27

  • @BenjeevRendhava
    @BenjeevRendhava 6 หลายเดือนก่อน +3

    Fantastic video! You've explained the diffusion and reaction parts of the equation so clearly. Thx!

    • @programmingchaos8957
      @programmingchaos8957  6 หลายเดือนก่อน

      I'm really glad you enjoyed it. If you have suggestions for other topics let me know.

  • @paulbesancon3963
    @paulbesancon3963 2 หลายเดือนก่อน

    Greetings from France. Thanks a ton for this amazing video. You explained this very well, it was exactly what I was looking for. ✌️

    • @programmingchaos8957
      @programmingchaos8957  2 หลายเดือนก่อน

      Hi from the US. Glad the video was helpful! If there happen to be any other topics/projects you're interested in, let me know.

  • @Fabian-ci4cb
    @Fabian-ci4cb ปีที่แล้ว

    Oh thank you so much that you responded to my recommendation! I am looking forward to watching the video after work today 😊

    • @programmingchaos8957
      @programmingchaos8957  ปีที่แล้ว

      It was a great recommendation. I'm afraid I forget to check if you wanted credit for the recommendation, so I didn't mention you in the video. But if you're okay with it, I'd like to do a minor edit to give you credit for the suggestion.

    • @Fabian-ci4cb
      @Fabian-ci4cb ปีที่แล้ว

      @@programmingchaos8957 oh that is super kind of you but I don't need credit for that, really no need to edit it in 😊

  • @chillcompany1028
    @chillcompany1028 ปีที่แล้ว

    Thanks! I would like to see more complex mathematics and numerical calculation methods for building various models :)

    • @programmingchaos8957
      @programmingchaos8957  ปีที่แล้ว

      Glad you like it. Any particular models you're interested in?

  • @clixsyt
    @clixsyt 2 หลายเดือนก่อน

    Amazing

  • @jaibhimadevi5805
    @jaibhimadevi5805 11 หลายเดือนก่อน

    Great channel! I first became interested in programs like these with early chaos/fractal software; later, Rudy Rucker's CAPOW and others kept exploration interesting. One of the bits of Javascript I'd saved (and lost) was a relatively small applet that would simply open a (relatively) small animated grayscale graphics window, displaying what looked very reminiscent of TEM images of bacteria etc., only with a pseudo-3D, transparency aspect to the "layers".. can't remember what it was called or what site it came from, but many versions of Java ago, when Processing was still New And Shiny.

    • @programmingchaos8957
      @programmingchaos8957  11 หลายเดือนก่อน +1

      Thanks! The transmission electron microscope (TEM) images of bacteria I looked up are very cool. I couldn't (with a very brief search) find a method to procedurally generate anything like them though. If I come across - or anyone else can point me towards - a method I could turn it into a video.

    • @jaibhimadevi5805
      @jaibhimadevi5805 11 หลายเดือนก่อน

      @@programmingchaos8957 Found it! Can't recall where it came from, but it's a .jar file from 2012 called "Multiscale Turing" :)

  • @arindampal4214
    @arindampal4214 12 วันที่ผ่านมา

    Good evening sir, its really very interesting project. I like to know which IDE you have used for the above project? Can I get the code in a text file?

    • @programmingchaos8957
      @programmingchaos8957  12 วันที่ผ่านมา

      I'm glad you enjoyed it. The IDE is processing, free from processing.org, and very easy to download and install (basically download, unzip, and you're ready to go). I'll have to dig up the original code to send.

  • @limboreversible
    @limboreversible 3 หลายเดือนก่อน

    THIS CODE IS INSANE !! Thank you ! (that's one I liked right here //d1=1,d2=0.5,f=0.079,k=0.058)

    • @programmingchaos8957
      @programmingchaos8957  3 หลายเดือนก่อน

      Thank you! I'm glad you enjoyed it. I've spent (wasted?) a lot of time looking for interesting parameter sets.

    • @limboreversible
      @limboreversible 3 หลายเดือนก่อน

      It's really a very sensitive system. It's curious though how the system reaches a static state. What would you randomize or change over time in a way that the system it's always dynamic?

    • @programmingchaos8957
      @programmingchaos8957  2 หลายเดือนก่อน +1

      Interesting question. I haven't tested it, but maybe very small changes to the parameters at each time step. Especially progressive changes the oscillate. .E.g. the parameters at a given point are something like d2 = 0.5+0.01*sin(frameCount*0.01). So you get a small, slow oscillation in the parameter. If you get a chance to try it, let me know if it works. @@limboreversible

    • @limboreversible
      @limboreversible 2 หลายเดือนก่อน

      @@programmingchaos8957 I tried exactly that but with f and k. Didn't really work. I'll try with d1 and d2 when I have a chance ! thanks !

  • @RogovAB
    @RogovAB 11 หลายเดือนก่อน

    I am not sure how this formula for divergence correlates with real diffusion. What if the central cell (source0)? Would implementation of such an operator contradict the second law of thermodynamics? May be I missed something.

    • @programmingchaos8957
      @programmingchaos8957  11 หลายเดือนก่อน

      Excellent question, I scratched my head about that one as well. I think part of the answer is that because the rules are always applied to every cell, if the central cell has a lower concentration it still receives a net influx of the 'chemical' from the neighboring cells. On the other hand if the center cell has a high concentration and the surrounding cells have zero concentration all of the 'chemical' from the central cell is diffused because the central value of the kernel is 0. So, I think the rules are more ones that are well know to produce nice patterns then the most physically realistic.

    • @RogovAB
      @RogovAB 11 หลายเดือนก่อน

      ​@@programmingchaos8957 The pattern is nice, but I am trying to figure out what is the difference between such simplified approach and real 2D implicit approach requiring Gauss elimination for the matrix. Can we use it as a first approximation? In fact, as you pointed with empty cell, this scheme is not a diffusion. Ideally it should not go further then equal concentration within all nine cells. Probably it is possible add simple conditional correction like: if concentration is lower/higher than average, than it is just average.
      Any way, thank you for your videos, for me they are interesting because you show direct implementation using only plain programming, without dodgy libraries, python or matlab...

    • @programmingchaos8957
      @programmingchaos8957  10 หลายเดือนก่อน

      I think this is a passable first approximation. But how 'good' the model is depends on the goal. This model has been used to show that you can, in theory, generate complex patterns from reaction-diffusion systems, which encouraged biologists to look at it as a possible mechanism for zebra stripes, etc.. If the goal were to have a model with predictive value it would have to be a lot more sophisticated.

  • @lesbaws
    @lesbaws ปีที่แล้ว

    Awesome video! Can you put a link to a gist with the source code?

    • @programmingchaos8957
      @programmingchaos8957  ปีที่แล้ว +3

      Thanks! The idea behind these videos is that they are largely for my students to learn from and I feel (perhaps incorrectly) that a big part of the learning process is typing out the code. It forces them to think about each line of code, how it works, what the syntax is, if there's a different/better way to code it, and how it fits into the program as a whole. Something they can't get from just cutting and pasting. So, I've avoided posting the code. It is of course all visible in the project. At some point I may be convinced to change my mind, but for now I've avoided posting it.