5f892713c3 2021-03-03 trnsz@pobox.c: %%%%%%%%%%%%%%%%%%%%%
5f892713c3 2021-03-03 trnsz@pobox.c: % PLOTTING
5f892713c3 2021-03-03 trnsz@pobox.c: %%%%%%%%%%%%%%%%%%%%%
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % Load gnuplot package
5f892713c3 2021-03-03 trnsz@pobox.c: load_package gnuplot$
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % Plot of sine and cosine
5f892713c3 2021-03-03 trnsz@pobox.c: plot(sin(x), title="sin(x) and cos(x)", output="Sine and Cosine");
5f892713c3 2021-03-03 trnsz@pobox.c: plot(cos(x), title="sin(x) and cos(x)");
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % Superposition of polynomials
5f892713c3 2021-03-03 trnsz@pobox.c: plot((x^2+y^2-9)*x*y=0, title="Polynomials", output="Polynomials");
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % 3D surface plot
5f892713c3 2021-03-03 trnsz@pobox.c: plot(cos sqrt(x**2+y**2),x=(-10 .. 10),y=(-10 .. 10),hidden3d, title="cos sqrt(x^2+y^2)", points=50, output="3D Plot");
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % Super-Ellipsoid
5f892713c3 2021-03-03 trnsz@pobox.c: on rounded;
5f892713c3 2021-03-03 trnsz@pobox.c: ax:=3$
5f892713c3 2021-03-03 trnsz@pobox.c: ay:=3$
5f892713c3 2021-03-03 trnsz@pobox.c: az:=4$
5f892713c3 2021-03-03 trnsz@pobox.c: ns:=4/5$
5f892713c3 2021-03-03 trnsz@pobox.c: ew:=1$
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: for all w,m let c(w,m) = sign(cos(w))*abs(cos(w))**m$
5f892713c3 2021-03-03 trnsz@pobox.c: for all w,m let s(w,m) = sign(sin(w))*abs(sin(w))**m$
5f892713c3 2021-03-03 trnsz@pobox.c: for all u,v let x(u,v) =ax * c(v, ns)*c(u, ew)$
5f892713c3 2021-03-03 trnsz@pobox.c: for all u,v let y(u,v) =ay * c(v, ns)*s(u, ew)$
5f892713c3 2021-03-03 trnsz@pobox.c: for all u,v let z(u,v) =az * s(v, ns)$
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: dd:=pi/15$
5f892713c3 2021-03-03 trnsz@pobox.c: w:=for u:=-pi step dd until pi collect
5f892713c3 2021-03-03 trnsz@pobox.c: for v:=-pi/2 step dd until pi/2 collect
5f892713c3 2021-03-03 trnsz@pobox.c: {x(u,v),y(u,v),z(u,v)}$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot(set, ticslevel, 0)$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot(set, xtics, -4, 1, 4)$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot(set, ytics, -4, 1, 4)$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot(set, ztics, -4, 1, 4)$
5f892713c3 2021-03-03 trnsz@pobox.c: plot (w, hidden3d, title="Super-Ellipsoid", output="Super-Ellipsoid")$
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % 3D surface plot with gradients using the
5f892713c3 2021-03-03 trnsz@pobox.c: % CAS mode gnuplot operator of the gnuplot
5f892713c3 2021-03-03 trnsz@pobox.c: % package. The same plot could be created
5f892713c3 2021-03-03 trnsz@pobox.c: % using direct gnuplot commands in Plot
5f892713c3 2021-03-03 trnsz@pobox.c: % mode.
5f892713c3 2021-03-03 trnsz@pobox.c: plotreset$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset hidden3d");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset hidden");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset surface");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set output ""3D Log""");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set title ""3D Log""");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set samples 30; set isosamples 30");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set pm3d");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set style line 100 lt 5 lw 0.5");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set pm3d hidden3d 100");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set view 57,220");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set xrange [-2:2]");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set yrange [-2:2]");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("splot log(x*x*y*y)");
5f892713c3 2021-03-03 trnsz@pobox.c: plotshow;
5f892713c3 2021-03-03 trnsz@pobox.c:
5f892713c3 2021-03-03 trnsz@pobox.c: % 3D Torus
5f892713c3 2021-03-03 trnsz@pobox.c: % Again, the same plot could be generated
5f892713c3 2021-03-03 trnsz@pobox.c: % with direct gnuplot commands in Plot
5f892713c3 2021-03-03 trnsz@pobox.c: % mode.
5f892713c3 2021-03-03 trnsz@pobox.c: plotreset$
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set title ""Interlocking Torus""");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set output ""Torus""");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set parametric");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set urange [-pi:pi]");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set vrange [-pi:pi]");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set isosamples 50,20");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset key");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset xtics");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset ytics");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("unset ztics");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set border 0");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set view 60, 30, 1.5, 0.9");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set origin 0.0,-0.075");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set size 0.9, 1.1");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set colorbox vertical user origin 0.9, 0.15 size 0.02, 0.50");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set format cb ""%.1f""");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("set pm3d depthorder");
5f892713c3 2021-03-03 trnsz@pobox.c: gnuplot("splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, 1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d");
5f892713c3 2021-03-03 trnsz@pobox.c: plotshow;