# GGB Script: Slope field explorer

Topic:
Calculus
```Ax = Slider(-4.5, 4.5, 0.01, 1, 200, false, true, false, false) SetValue(Ax, 0) SetVisibleInView(Ax, 1, false) Ay = Slider(-4.5, 4.5, 0.01, 1, 200, false, true, false, false) SetValue(Ay, -1) SetVisibleInView(Ay, 1, false) A = (Ax, Ay) f(x,y) = x(y-1)(y+2) solP = SolveODE( f, x(A), y(A), 4.5, 0.01 ) solN = SolveODE( f, x(A), y(A), -4.5, 0.01 ) size = 4 slopeS = Slider(0, 1, 0.01, 1, 200, false, true, false, false) SetValue(slopeS, 0.6) SetCaption(slopeS,"Size") slopeD = Slider(10, 30, 1, 1, 200, false, true, false, false) SetValue(slopeD, 21) SetCaption(slopeD,"Density") slopeF = SlopeField( f, slopeD, slopeS, -size, -size, size, size ) # Extra settings PointAnimate = ( x(A), y(A) ) SetVisibleInView(PointAnimate, 1, true) speed = 7 animate = Slider(0,1,0.01, speed, 200, false, true, false, false) StartAnimation(animate, true) SetVisibleInView(animate, 1, false) F(x) = 8x - 8floor(x) + 4 ﻿SetVisibleInView(F, 1, false) # In the PointAnimate's On Update tab ﻿# SetPointSize( PointAnimate, F(animate) ) # Background pos = 4.5 P1 = (-pos, -pos) P2 = (pos, -pos) P3 = (pos, pos) P4 = (-pos, pos) SetVisibleInView(P1, 1, false) SetVisibleInView(P2, 1, false) SetVisibleInView(P3, 1, false) SetVisibleInView(P4, 1, false) polyBackground = Polygon(P1, P2, P3, P4) ```