Week 3: Gradient Algorithms and Riparian Zones

Mar 24, 2023

Welcome back, everyone!

This week I continued working on my genetic algorithm, fine-tuning it, then started on a gradient-based algorithm. Gradient algorithms find the minimum of a function by calculating the gradient (slope) at the current point and then taking a step (of prescribed size) in the negative direction. If taking that step doesn’t lead to a lower value in the function at the new point, the step size is reduced until the new point has a lower value. Once around a local minimum, the code will often jump back and forth around the actual minimum value (see image below). The algorithm can also be used to find local maximums by following the gradient rather than going in the opposite direction.

As for my research, I continued reading others’ articles and noting the important findings. I learned it can be fairly easy for water to pass around the riparian zone, not through it, if, for example, a water table is right below the area and just out of reach for the plants’ roots. Water tables are a large concern for buffers’ efficacy in regions with shallow water tables. Also, depending on geography, certain riparian zones can be more important than others in an area. For example, in tidal areas, erosion due to waves and wakes is a large issue, and zone 1 (closest to the water) trees may actually add to bank destabilization when the rising sea level erodes the earth beneath them. Zone 1 trees must be carefully placed so they prevent, rather than add to, erosion along the riverbank.

Until next week,


This is an example of my gradient algorithm. Note the oscillation of the blue line (chosen points) around a solution value (here, -3), while getting closer and closer to that solution. With more iterations, the oscillations won’t even be visible on the plotter. The orange line (cost, here x2+6x) is decreasing, but at a decreasing rate due to the decreasing step size (distance between points). The cost is decreasing towards its minimum, -9, but not oscillating.

3 Replies to “Week 3: Gradient Algorithms and Riparian Zones”

  1. Naga (Sudeep) G. says:

    Hi Daria,
    Your blog for this week seems very fascinating. In particular, I found it interesting that you were able to apply calculus (derivatives) to find maximums and minimums in your model. I was wondering the exact software and programming language that you were using in your model. What was the data the gradient algorithm was measuring or modifying? I really enjoyed learning about riparian zones and the movement of water. In particular, I found it interesting to learn that water can escape from riparian zones and the impact of trees on erosion. I always thought that trees allowed for less erosion and more stability, because they could prevent the flow of particles to a river. However, I now understand that their placement and depth can impact the bank’s stability. I was wondering about the different types of zones and trees that can impact erosion.
    Sudeep Goluguri

    1. Daria L. says:

      Hi Sudeep,
      I used Python on my computer and input some simple sample data: the cost function, the number of iterations to run, the number to start at, the step size, and a step size coefficient value. Then I imported the SymPy module for Python, which allows functions, derivatives, and other math/symbolic operations. All I needed for this was an application to run Python on my computer! As for erosion, it is mostly an issue in the third zone, closest to the bank, or on very steep slopes; the other zones are based on non-tree vegetation. I don’t know specifically the difference between types of trees, but I would guess that it depends on how large/fast the trees grow, how sturdy they are, how long they live, and which nutrients they take up in large quantities, and all of these factors would be taken into account with relation to the current state of the riverbank.

  2. Nathan H. says:

    Hi Daria,

    It’s great to hear that you have continued to make progress on your genetic algorithm and have started exploring gradient-based algorithms. It sounds like a neat application of Calculus!

    I don’t fully understand your research on riparian zones, but it sounds incredibly complex and fascinating. I definitely look forward to hearing more about your work next week.

    – Nathan

Leave a Reply