## Official Asymptote example – flow

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 10 h 57 min

 (Compiled with Asymptote version 2.14svn-r5318)
```/* This code comes from The Official Asymptote Gallery */

import graph;
defaultpen(1.0);

size(0,150,IgnoreAspect);

real arrowsize=4mm;
real arrowlength=2arrowsize;

typedef path vector(real);

// Return a vector interpolated linearly between a and b.
vector vector(pair a, pair b) {
return new path(real x) {
return (0,0)--arrowlength*interp(a,b,x);
};
}

real f(real x) {return 1/x;}

real epsilon=0.5;
path g=graph(f,epsilon,1/epsilon);

int n=3;
draw(g);
xaxis("\$x\$");
yaxis("\$y\$");

```

Étiquettes :

## Official Asymptote example – slopefield1

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 22 h 57 min

 (Compiled with Asymptote version 2.14svn-r5318)
```/* This code comes from The Official Asymptote Gallery */

import slopefield;

size(200);

real func(real x) {return 2x;}
draw(curve((0,0),func,(-3,-3),(3,3)),red);

```

Étiquettes : ,

## Official Asymptote example – vectorfield

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 17 h 57 min

 (Compiled with Asymptote version 2.14svn-r5318)
```/* This code comes from The Official Asymptote Gallery */

import graph;
size(100);

pair a=(0,0);
pair b=(2pi,2pi);

path vector(pair z) {return (0,0)--(sin(z.x),cos(z.y));}

```

Étiquettes : ,

## Official Asymptote example – vectorfield3

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 18 h 57 min

 (Compiled with Asymptote version 2.14svn-r5318)
```/* This code comes from The Official Asymptote Gallery */

import graph3;

size(12cm,0);

currentprojection=orthographic(1,-2,1);
currentlight=(1,-1,0.5);

real f(pair z) {return abs(z)^2;}

static real dx=sqrtEpsilon, dy=dx;
return O--((f(z+dx)-f(z-dx))/2dx,(f(z+I*dy)-f(z-I*dy))/2dy,0);
}

pair a=(-1,-1);
pair b=(1,1);

triple F(pair z) {return (z.x,z.y,0);}

draw(surface(f,a,b,Spline),gray+opacity(0.5));

xaxis3(XY()*"\$x\$",OutTicks(XY()*Label));
yaxis3(XY()*"\$y\$",InTicks(YX()*Label));
zaxis3("\$z\$",OutTicks);

```

Étiquettes : ,

## Official Asymptote example – vectorfieldsphere

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 19 h 57 min

 (Compiled with Asymptote version 2.14svn-r5318)
```/* This code comes from The Official Asymptote Gallery */

import graph3;

size(12cm);

currentprojection=orthographic(1,-2,1);
currentlight=(1,-1,0.5);

triple f(pair z) {return expi(z.x,z.y);}

path3 vector(pair z) {
triple v=f(z);
return O--(v.y,v.z,v.x);
}