diff options
Diffstat (limited to 'graphics/epix/samples/sqrt.xp')
-rw-r--r-- | graphics/epix/samples/sqrt.xp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/graphics/epix/samples/sqrt.xp b/graphics/epix/samples/sqrt.xp new file mode 100644 index 0000000000..ffc5335c99 --- /dev/null +++ b/graphics/epix/samples/sqrt.xp @@ -0,0 +1,51 @@ +/* -*-ePiX-*- */ +#include "epix.h" +using namespace ePiX; + +P f(double x, double y) +{ + pair z(x,y); + pair temp(z*z); + return P(temp.x1(), temp.x2(), x); +} + +P F(double r, double t) +{ + return f(r*Cos(t), r*Sin(t)); +} + +P g(double t) +{ + return t*P(t,0,1); +} + +domain R(P(0,0), P(1.25,0.5), mesh(6,24), mesh(12,60)); + +int main() +{ + picture(P(-1.5, -1.5), P(1.5, 1.5), "2.5x2.5in"); + + begin(); + revolutions(); + camera.at(P(4,-2,3)); + + pen(Blue(1.7)); + plot(F, R); + + pen(Blue()); + plot(F, R.resize2(0.5,1)); + + pen(Black()); + arrow(P(0,0,0), 2*E_1); + arrow(P(0,0,0), 2*E_2); + arrow(P(0,0,0), 1.5*E_3); + + masklabel(2*E_1, P(0,0), "$\\mathrm{Re}\\,z$", r); + label(2*E_2, P(0,0), "$\\mathrm{Im}\\,z$", r); + label(1.5*E_3, P(2,0), "$\\mathrm{Re}\\,\\sqrt{z}$", r); + + bold(Red()); + plot(g, -1.25, 1.25, 40); + + end(); +} |