1/5
In the previous video, we graphed curves onto 3D and we worked with an equation that represented the curve in between a constant sum and a constant product. The equation was x times y divided by d over 2 squared. We are going to take a closer look at this equation in 3D. When we graph this equation, we get a 3D surface. ```javascript f(x,y)=xy/((d/2)^2) ``` The inputs are all the points on the x y plane and the output is described in the z-axis. The result is a 2D surface in 3D. Now, we want to know how this function behaves on the points of the curves V1 curve. First, we will plot the equation x times y divided by d over 2 squared for all of the points on the constant product. We will take the x and y points that satisfy x times y equals d over 2 squared and then we will evaluate the equation. The result is a blue line on the 2D surface. ```javascript f(x,y)=xy/((d/2)^2) ``` The z-axis value is always 1 for this blue line. This is because x times y is always equal to d over 2 squared. This function will always evaluate to 1. Now, we will look at the points on the constant sum curve. This produces an arc on the surface. The arc touches 1 and decreases to 0 as y goes to 0, and also decreases to 0 as x goes to 0. We can plot a point at (d over 2, d over 2, 1) to see where this equation evaluates to 1. We can also see that this orange line approaches 0 as x and y become more unbalanced. When we evaluate this equation for the curves V1 curve, we get the orange line. The line represents the z-axis value for each point of the V1 curve. The orange line approaches 0 as x and y become more unbalanced. We have now analyzed how x times y divided by d over 2 squared behaves in 3D. When x and y are close to d over 2, then the equation evaluates to 1. As x and y become more unbalanced, they approach 0.
In the previous video, we graphed curves onto 3D and we worked with an equation that represented the curve in between a constant sum and a constant product. The equation was x times y divided by d over 2 squared.
We are going to take a closer look at this equation in 3D.
When we graph this equation, we get a 3D surface.
The inputs are all the points on the x y plane and the output is described in the z-axis.
The result is a 2D surface in 3D.
Now, we want to know how this function behaves on the points of the curves V1 curve.
First, we will plot the equation x times y divided by d over 2 squared for all of the points on the constant product.
We will take the x and y points that satisfy x times y equals d over 2 squared and then we will evaluate the equation.
The result is a blue line on the 2D surface.
The z-axis value is always 1 for this blue line.
This is because x times y is always equal to d over 2 squared.
This function will always evaluate to 1.
Now, we will look at the points on the constant sum curve.
This produces an arc on the surface.
The arc touches 1 and decreases to 0 as y goes to 0, and also decreases to 0 as x goes to 0.
We can plot a point at (d over 2, d over 2, 1) to see where this equation evaluates to 1.
We can also see that this orange line approaches 0 as x and y become more unbalanced.
When we evaluate this equation for the curves V1 curve, we get the orange line. The line represents the z-axis value for each point of the V1 curve.
The orange line approaches 0 as x and y become more unbalanced.
We have now analyzed how x times y divided by d over 2 squared behaves in 3D.
When x and y are close to d over 2, then the equation evaluates to 1. As x and y become more unbalanced, they approach 0.
A fascinating exploration of how the function xy / (d/2)^2 behaves in 3D space, using the concepts of constant sum and constant product. The lesson demonstrates the graphical representation of this function in 3D and analyzes how it changes across the points of the constant sum and constant product curves.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
AMM math for Curve Stableswap
How to calculate swap amount and liquidity
Curve Stableswap contracts
How to implement a swap function
How to implement the add and remove liquidity functions
How to quantify liquidity pools
How to control the flatness of the curve
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Last updated on August 11, 2025
Duration: 14min
Duration: 32min
Duration: 26min
Duration: 23min
Duration: 20min
Duration: 23min
Course Overview
About the course
AMM math for Curve Stableswap
How to calculate swap amount and liquidity
Curve Stableswap contracts
How to implement a swap function
How to implement the add and remove liquidity functions
How to quantify liquidity pools
How to control the flatness of the curve
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Last updated on August 11, 2025