# Examples of demo curves and surfaces
# line 1: title
# line 2: description.
# line 3: type (and coord).
# line 4: insplot_set
# line 5: formula
# line 6: parms for calling the application.

: plane curve deployment
A plane curve which is progressively drawn. (Cycloid)
parametric2D
trange [0:6*pi*s];xrange [0:6*pi];yrange [-1.1:1.1]; size 0.7,0.18
-sin(t)+t notitle,-cos(t) notitle
xsize=500&ysize=100&x1=-sin(t)%2Bt&y1=-cos(t)&tleft=0&tright=6*pi*s&xleft=0&xright=6*pi&yleft=-1.2&yright=1.2

: Cycloid multiple
The Cycloid is the orbit of a point on a circle rolling along a straight line. Here you can see how this is done precisely, with multiple curve plotting.
parametric2D
trange [0:4*pi]; xrange [-1:4*pi+1]; yrange [-1.1:1.1]; size 0.7,0.18
-sin(t)+t,-cos(t) notitle lt 9, t,-1 notitle lt 10,-sin(s*t)+s*t,-cos(s*t) notitle lt 1,-cos(t/2)+4*pi*s,sin(t/2) notitle lt 3,4*pi*s-t*sin(4*pi*s)/(4*pi),-t*cos(4*pi*s)/(4*pi) notitle lt 3,4*pi*s-t*sin(4*pi*s+2*pi/3)/(4*pi),-t*cos(4*pi*s+2*pi/3)/(4*pi) notitle lt 3,4*pi*s-t*sin(4*pi*s-2*pi/3)/(4*pi),-t*cos(4*pi*s-2*pi/3)/(4*pi) notitle lt 3
mtype=expert&aobjcnt=7&xsize=500&ysize=100&set_tics=0&set_zeroaxis=0&xleft=-1&xright=4*pi+1&yleft=-1.2&yright=1.2&tleft=0&tright=4*pi&lt1=9&lt2=10&lt3=1&lt4=3&lt5=3&lt6=3&lt7=3&ltp=2&x1=-sin(t)+t&y1=-cos(t)&x2=t&y2=-1&x3=-sin(s*t)+s*t&y3=-cos(s*t)&x4=cos(t/2)+4*pi*s&y4=sin(t/2)&x5=4*pi*s-t*sin(4*pi*s)/(4*pi)&y5=-t*cos(4*pi*s)/(4*pi)&x6=4*pi*s-t*sin(4*pi*s+2*pi/3)/(4*pi)&y6=-t*cos(4*pi*s+2*pi/3)/(4*pi)&x7=4*pi*s-t*sin(4*pi*s-2*pi/3)/(4*pi)&y7=-t*cos(4*pi*s-2*pi/3)/(4*pi)&points=-sin(4*pi*s)+4*pi*s,-cos(4*pi*s)

: Astroid 4
By the same principle, the astroid (cos^3(t),sin^3(t)) is the orbit of a point on a circle of radius 1/4 rolling inside a fixed circle of radius 1.
parametric2D
trange [0:2*pi]; xrange [-1:1]; yrange [-1:1]; size 0.4,0.5
cos(t)^3,sin(t)^3 notitle lt 9,cos(t),sin(t) notitle lt 10,cos(s*t)^3,sin(s*t)^3 notitle lt 1,cos(t)/4+3*cos(2*pi*s)/4,sin(t)/4+3*sin(2*pi*s)/4 notitle lt 3,3*cos(2*pi*s)/4+t*cos(6*pi*s)/(8*pi),3*sin(2*pi*s)/4-t*sin(6*pi*s)/(8*pi) notitle lt 3,3*cos(2*pi*s)/4+t*cos(6*pi*s+2*pi/3)/(8*pi),3*sin(2*pi*s)/4-t*sin(6*pi*s+2*pi/3)/(8*pi) notitle lt 3,3*cos(2*pi*s)/4+t*cos(6*pi*s-2*pi/3)/(8*pi),3*sin(2*pi*s)/4-t*sin(6*pi*s-2*pi/3)/(8*pi) notitle lt 3
mtype=expert&aobjcnt=7&xsize=250&ysize=250&set_tics=0&set_zeroaxis=0&xleft=-1&xright=1&yleft=-1&yright=1&tleft=0&tright=2*pi&lt1=9&lt2=10&lt3=1&lt4=3&lt5=3&lt6=3&lt7=3&ltp=2&x1=cos(t)^3&y1=sin(t)^3&x2=cos(t)&y2=sin(t)&x3=cos(s*t)^3&y3=sin(s*t)^3&x4=cos(t)/4+3*cos(2*pi*s)/4&y4=sin(t)/4+3*sin(2*pi*s)/4&x5=3*cos(2*pi*s)/4+t*cos(6*pi*s)/(8*pi)&y5=3*sin(2*pi*s)/4-t*sin(6*pi*s)/(8*pi)&x6=3*cos(2*pi*s)/4+t*cos(6*pi*s+2*pi/3)/(8*pi)&y6=3*sin(2*pi*s)/4-t*sin(6*pi*s+2*pi/3)/(8*pi)&x7=3*cos(2*pi*s)/4+t*cos(6*pi*s-2*pi/3)/(8*pi)&y7=3*sin(2*pi*s)/4-t*sin(6*pi*s-2*pi/3)/(8*pi)&points=3*cos(2*pi*s)/4+cos(6*pi*s)/4,3*sin(2*pi*s)/4-sin(6*pi*s)/4

: Astroid 3
We have also the astroid with 3 arcs.
parametric2D
trange [0:2*pi]; xrange [-1:1]; yrange [-1:1]; size 0.4,0.5
2*cos(t)/3+cos(2*t)/3,2*sin(t)/3-sin(2*t)/3 notitle lt 9,cos(t),sin(t) notitle lt 10,2*cos(s*t)/3+cos(2*s*t)/3,2*sin(s*t)/3-sin(2*s*t)/3 notitle lt 1,cos(t)/3+2*cos(2*pi*s)/3,sin(t)/3+2*sin(2*pi*s)/3 notitle lt 3,2*cos(2*pi*s)/3+t*cos(4*pi*s)/(6*pi),2*sin(2*pi*s)/3-t*sin(4*pi*s)/(6*pi) notitle lt 3,2*cos(2*pi*s)/3+t*cos(4*pi*s+2*pi/3)/(6*pi),2*sin(2*pi*s)/3-t*sin(4*pi*s+2*pi/3)/(6*pi) notitle lt 3,2*cos(2*pi*s)/3+t*cos(4*pi*s-2*pi/3)/(6*pi),2*sin(2*pi*s)/3-t*sin(4*pi*s-2*pi/3)/(6*pi) notitle lt 3
mtype=expert&aobjcnt=7&xsize=250&ysize=250&set_tics=0&set_zeroaxis=0&xleft=-1&xright=1&yleft=-1&yright=1&tleft=0&tright=2*pi&lt1=9&lt2=10&lt3=1&lt4=3&lt5=3&lt6=3&lt7=3&ltp=2&x1=2*cos(t)/3+cos(2*t)/3&y1=2*sin(t)/3-sin(2*t)/3&x2=cos(t)&y2=sin(t)&x3=2*cos(s*t)/3+cos(2*s*t)/3&y3=2*sin(s*t)/3-sin(2*s*t)/3&x4=cos(t)/3+2*cos(2*pi*s)/3&y4=sin(t)/3+2*sin(2*pi*s)/3&x5=2*cos(2*pi*s)/3+t*cos(4*pi*s)/(6*pi)&y5=2*sin(2*pi*s)/3-t*sin(4*pi*s)/(6*pi)&x6=2*cos(2*pi*s)/3+t*cos(4*pi*s+2*pi/3)/(6*pi)&y6=2*sin(2*pi*s)/3-t*sin(4*pi*s+2*pi/3)/(6*pi)&x7=2*cos(2*pi*s)/3+t*cos(4*pi*s-2*pi/3)/(6*pi)&y7=2*sin(2*pi*s)/3-t*sin(4*pi*s-2*pi/3)/(6*pi)&points=2*cos(2*pi*s)/3+cos(4*pi*s)/3,2*sin(2*pi*s)/3-sin(4*pi*s)/3

: zoom sin(1/x)
Zooming effect on the curve sin(1/x).
explicit2D cartesian
xrange [-exp(-3*s):exp(-3*s)]; yrange [-2:2]
sin(1/x) notitle
y1=sin(1/x)&xleft=-exp(-3*s)&xright=exp(-3*s)&yleft=-2&yright=2

: tangent cardioid
A moving tangent along a plane parametric curve (cardioid).
parametric2D
trange [-pi:pi]; xrange [-1:3]; yrange [-2:2]
cos(t)*(1+cos(t)),sin(t)*(1+cos(t)) notitle lt 2,-sin(2*pi*s)*(2*cos(2*pi*s)+1)*t/4+cos(2*pi*s)*(1+cos(2*pi*s)),(cos(2*pi*s)^2-sin(2*pi*s)^2+cos(2*pi*s))*t/4+sin(2*pi*s)*(1+cos(2*pi*s)) notitle lt 3
mtype=expert&aobjcnt=2&lt1=2&lt2=3&ltp=10&tleft=-pi&tright=pi&xleft=-1&xright=3&yleft=-2&yright=2&x1=cos(t)*(1+cos(t))&y1=sin(t)*(1+cos(t))&x2=-sin(2*pi*s)*(2*cos(2*pi*s)+1)*t/4+cos(2*pi*s)*(1+cos(2*pi*s))&y2=(cos(2*pi*s)^2-sin(2*pi*s)^2+cos(2*pi*s))*t/4+sin(2*pi*s)*(1+cos(2*pi*s))&points=cos(2*pi*s)*(1+cos(2*pi*s)),sin(2*pi*s)*(1+cos(2*pi*s))

: tangent astroid
The moving tangent along the astroid has a special property: the segment of the tangent cut out by the coordinate axes is of constant length.
parametric2D
trange [0:1]; xrange [-1.2:1.2]; yrange [-1.2:1.2]; zeroaxis; size 0.4,0.5
cos(2*pi*t)^3,sin(2*pi*t)^3 notitle,cos(2*pi*s)*t,sin(2*pi*s)*(1-t) notitle lt 3,3*cos(2*pi*s)/4+cos(6*pi*s)/4+cos(2*pi*t)*0.02,3*sin(2*pi*s)/4-sin(6*pi*s)/4+sin(2*pi*t)*0.02 notitle lt 10
mtype=expert&aobjcnt=2&xsize=250&ysize=250&set_tics=0&xleft=-1.2&xright=1.2&yleft=-1.2&yright=1.2&tleft=0&tright=1&lt2=3&ltp=10&x1=cos(2*pi*t)^3&y1=sin(2*pi*t)^3&x2=cos(2*pi*s)*t&y2=sin(2*pi*s)*(1-t)&points=3*cos(2*pi*s)/4+cos(6*pi*s)/4,3*sin(2*pi*s)/4-sin(6*pi*s)/4

: traced ellipse
How an ellipse is drawn by a point on a segment of fixed length with two extremities on the x and y axes respectively.
parametric2D
trange [0:1]; xrange [-1:1]; yrange [-1:1]; zeroaxis; size 0.4,0.5
3*cos(2*pi*t)/5,2*sin(2*pi*t)/5 notitle lt 9,3*cos(2*pi*s*t)/5,2*sin(2*pi*s*t)/5 notitle lt 1,cos(2*pi*s)*t,sin(2*pi*s)*(1-t) notitle lt 3,3*cos(2*pi*s)/5+0.015*cos(2*pi*t),2*sin(2*pi*s)/5+0.015*sin(2*pi*t) notitle lt 10
mtype=expert&aobjcnt=3&lt1=9&lt2=1&lt3=3&ltp=10&tleft=0&tright=1&xleft=-1&xright=1&yleft=-1&yright=1&x1=3*cos(2*pi*t)/5&y1=2*sin(2*pi*t)/5&x2=3*cos(2*pi*s*t)/5&y2=2*sin(2*pi*s*t)/5&x3=cos(2*pi*s)*t&y3=sin(2*pi*s)*(1-t)&points=3*cos(2*pi*s)/5,2*sin(2*pi*s)/5

: sin cos
An animation which illustrates the functions sin and cos as vertical and horizontal positions of a moving point on a circle.
parametric2D
trange [0:1]; xrange [-1:4.2]; yrange [-1:4.2]; zeroaxis; size 0.4,0.5
cos(2*pi*t),sin(2*pi*t) notitle lt 2,t*cos(2*pi*s),t*sin(2*pi*s) notitle lt 1,3*t+1.2 notitle lt 3,sin(-5*pi*t+2*pi*s) notitle lt 3,cos(-5*pi*t+2*pi*s) notitle lt 3,3*t+1.2 notitle lt 3,1.2 notitle lt 2,2.2*t-1 notitle lt 2,2.2*t-1 notitle lt 2,1.2 notitle lt 2,2.2*t-1 notitle lt 9,sin(2*pi*s) notitle lt 9,cos(2*pi*s) notitle lt 9,2.2*t-1 notitle lt 9
mtype=expert&x1=cos(2*pi*t)&lt1=2&y1=sin(2*pi*t)&x2=t*cos(2*pi*s)&lt2=1&y2=t*sin(2*pi*s)&x3=3*t+1.2&lt3=3&y3=sin(-5*pi*t+2*pi*s)&x4=cos(-5*pi*t+2*pi*s)&lt4=3&y4=3*t+1.2&x5=1.2&lt5=2&y5=2.2*t-1&x6=2.2*t-1&lt6=2&y6=1.2&x7=2.2*t-1&lt7=9&y7=sin(2*pi*s)&x8=cos(2*pi*s)&lt8=9&y8=2.2*t-1&tleft=0&tright=1&xleft=-1&xright=4.2&yleft=-1&yright=4.2&xsize=250&ysize=250&speed=5&set_zeroaxis=1&set_loop=1&set_border=0&set_tics=0&set_grid=0&set_transparent=0&points=cos(2*pi*s),sin(2*pi*s),cos(2*pi*s),1.2,1.2,sin(2*pi*s)&ltp=3&aobjcnt=8

: trefle
Rotating and growing trefoil.
explicit2D polar
xrange [-1.2:1.2];yrange [-1:1]
sin(3*t+2*pi*s)*(cos(2*pi*s)+1)/2 notitle
r1=sin(3*t%2B2*pi*s)*(cos(2*pi*s)%2B1)/2&xleft=-1.2&xright=1.2&yleft=-1&yright=1

: Lissajous
A Lissajous figure with rotating phase.
parametric2D
trange [0:2*pi]; xrange [-1:1]; yrange [-1:1]
sin(2*t-2*pi*s/3),cos(3*t) notitle
tleft=0&tright=2*pi&x1=sin(2*t-2*pi*s/3)&y1=cos(3*t)

: Space Lissajous
The above Lissajous figure is a projection of this space curve. (To see how the projection works, load this formula into the menu and set vertical viewing angle to 0.)
parametric3D
urange [0:2*pi]; view 70,s*120
cos(2*u) notitle,sin(2*u) notitle,cos(3*u) notitle
tleft=0&tright=2*pi&x1=cos(2*t)&y1=sin(2*t)&z1=cos(3*t)

: space cubic
A space cubic curve. Quite simple, but it's only under movement that one really sees what is it about.
parametric3D
 
u notitle,u^2 notitle,u^3 notitle
x1=t&y1=t^2&z1=t^3

: space cubic
Another space curve, a little bit more complicated: hyperbolic spiral.
parametric3D
urange [-2:2]
sqrt(1+u^2)*cos(3*pi*u) notitle,u notitle,sqrt(1+u^2)*sin(3*pi*u) notitle
x1=sqrt(1+t^2)*cos(3*pi*t)&y1=t&z1=sqrt(1+t^2)*sin(3*pi*t)&tleft=-2&tright=2

: paraboloid
Parabolod z=ax<sup>2</sup>+by<sup>2</sup>. One sees the surface deform with the variations of a and b.
explicit3DS
 
cos(2*pi*s)*x^2+sin(2*pi*s)*y^2 notitle
z1=cos(2*pi*s)*x^2%2Bsin(2*pi*s)*y^2

: vertical hyperboloid
Deformation of hyperboloid x<sup>2</sup>+y<sup>2</sup>+az<sup>2</sup>=1. Vertical.
parametric3DS
view 65,floor(36*s);urange [0:2*pi];xrange [-6:6];yrange [-6:6];zrange [-6:6];isosamples 22
sqrt(v^2+10-15*s)*cos(u) notitle,sqrt(v^2+10-15*s)*sin(u) notitle,v notitle
x1=sqrt(v^2%2B10-15*s)*cos(u)&y1=sqrt(v^2%2B10-15*s)*sin(u)&z1=v&angle2=36*s&tleft=0&tright=2*pi&xleft=-6&xright=6&yleft=-6&yright=6&zleft=-6&zright=6

: horizontal hyperboloid
Deformation of hyperbolode x<sup>2</sup>+ay<sup>2</sup>+z<sup>2</sup>=1. Horizontal.
parametric3DS
urange [0:2*pi];xrange [-6:6];yrange [-6:6];zrange [-6:6];isosamples 22
sqrt(v^2+10-15*s)*cos(u) notitle,v notitle,sqrt(v^2+10-15*s)*sin(u) notitle
x1=sqrt(v^2%2B10-15*s)*cos(u)&y1=v&z1=sqrt(v^2%2B10-15*s)*sin(u)&uleft=0&uright=2*pi&xleft=-6&xright=6&yleft=-6&yright=6&zleft=-6&zright=6

: Moebius 
The Moebius band.
parametric3DS
urange [2*pi*s:(2+2*s)*pi];vrange [-0.4:0.4];zrange [-1:1];view 50,floor(360*s);isosamples 26,6
cos(u)+v*cos(u/2)*cos(u) notitle,sin(u)+v*cos(u/2)*sin(u) notitle,v*sin(u/2) notitle 
x1=cos(u)%2Bv*cos(u/2)*cos(u)&y1=sin(u)%2Bv*cos(u/2)*sin(u)&z1=v*sin(u/2)&uleft=2*pi*s&uright=(2%2B2*s)*pi&vleft=-0.4&vright=0.4&zleft=-1&zright=1&sample1=35&sample2=8

: Riemann surface
Riemann surface of two sheets crossing each other.
parametric3DS

u^2-v^2 notitle,u*v notitle,v notitle
x1=u^2-v^2&y1=u*v&z1=v

: singular surface 
A surface with a singular line, which resembles the precedent one but does not cross.
parametric3DS

u^2-v^2 notitle, u*v^2 notitle,v notitle
x1=u^2-v^2&y1=u*v^2&z1=v

: surface deform no rotation 
Deformation of one into the other, for the above two surfaces. Without rotation.
parametric3DS
view 70,70
u^2-v^2 notitle, u*(5*s*v-(1-s)*v^2) notitle,v notitle
x1=u^2-v^2&y1=u*(5*s*v-(1-s)*v^2)&z1=v&angle2=70

: surface deform rotating
As above but with rotation at the same time.
parametric3DS
view 60,floor(250+360*s)%360
u^2-v^2 notitle, u*(5*s*v-(1-s)*v^2) notitle,v notitle
x1=u^2-v^2&y1=u*(5*(1-s)*v-s*v^2)&z1=v&angle1=30

: deform plane cylinder
A plane deforming into a cylinder then back to a plane from the other direction.
parametric3DS
view 60,60;urange [0:2*pi]; vrange [-1:1]; xrange [-1:1]; yrange [-1:1]; zrange [-1:1]
sqrt((2*s-1)*v+0.2)*cos(u) notitle,sqrt((2*s-1)*v+0.2)*sin(u) notitle,(1-(2*s-1)^2)*v notitle
x1=sqrt((2*s-1)*v+0.2)*cos(u)&y1=sqrt((2*s-1)*v+0.2)*sin(u)&z1=(1-(2*s-1)^2)*v&angle1=30&angle2=60&uleft=0&uright=2*pi&vleft=-1&vright=1&xleft=-1&xright=1&yleft=-1&yright=1&zleft=-1&zright=1

