File: sqrt.xp

package info (click to toggle)
epix1 1.0.19-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,432 kB
  • ctags: 1,529
  • sloc: cpp: 8,250; sh: 4,716; lisp: 667; makefile: 229
file content (48 lines) | stat: -rw-r--r-- 931 bytes parent folder | download
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
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

P f(double x, double y)
{
  pair z = pair(x,y);
  pair temp = z*z;
  return P(temp.x1(), temp.x2(), x);
}

inline P F(double r, double t)
{ return f(r*Cos(t), r*Sin(t)); }

P g(double t) { return t*P(t,0,1); }
const double MAX=1.5;

domain R(P(0,0), P(1.25,0.5), mesh(6,24), mesh(12,60));

int main() 
{
  bounding_box(P(-MAX,-MAX),P(MAX,MAX));
  unitlength("1in");
  picture(2.5,2.5);
  offset(1.5,0);

  begin();
  revolutions();    viewpoint(4,-2,3);

  pen(0.15);  rgb(0.7,0.7,1); 
  plot(F, R);

  plain();  blue(); 
  plot(F, R.resize2(0.5,1));

  black();  pen(0.5);
  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();
}