Transforming a graph
One parent function, four sliders, and the shape that results. Every slider maps to one word: stretch, shift, squeeze, raise.
examples/showcase-transformations.axis
config { showGrid: true xAxisStep: 1 yAxisStep: 1}
"y = a * f(b * (x - h)) + k"
folder "Sliders" { a = 1 @ slider: -3..3 step 0.1 b = 1 @ slider: -3..3 step 0.1 h = 0 @ slider: -6..6 step 0.1 k = 0 @ slider: -6..6 step 0.1}
"The parent function - swap x^2 for sin(x), abs(x) or sqrt(x)."
f(x) = x ^ 2 @ hidden
f(x) @ color: BLACK, lineWidth: 2, lineOpacity: 0.3, lineStyle: DASHED
"The transformed one."
g(x) = a * f(b * (x - h)) + k @ color: PURPLE, lineWidth: 4
folder "What each slider does" { "a stretches vertically, and flips when negative." "b squeezes horizontally, and flips when negative." "h shifts right, k shifts up." "The image of the parent's vertex." (h, k) @{ color: PURPLE pointSize: 16 label: "(h, k)" showLabel labelOrientation: above_right }}Open in playground →