File: slopefield.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 (33 lines) | stat: -rw-r--r-- 561 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
/* -*-ePiX-*- */
/* slopefield.xp -- March 29, 2002 */
#include "epix.h"
using namespace ePiX;

P F(double s, double t)
{
  return (P(0.1,0.025)&P(s,t)) + 
    (1/(0.01+s*s+t*t))*P(-t,s);
}

int main() 
{
  unitlength("1pt");
  bounding_box(P(-4, -3), P(2,2));
  picture(234, 195);
  offset(120, -20);

  begin();
  crop();

  blue(0.4);
  dart_field(F, P(x_min, y_min), P(x_max, y_max), 4*x_size, 4*y_size);

  bold();
  for (int i=0; i<7; ++i)
    {
      rgb(0.25 - 0.05*i, 1 - 0.1*i, 0.2*i);
      ode_plot(F, P(-0.9-0.025*i,0), 20, 200);
    }
  end();
}