summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/sqrt.xp
blob: ffc5335c99f44a42572a23579f5d7f2594ad3552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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();
}