import graph;
import math;
import metapost;
size(8 inches);
defaultpen(0.45mm);
real yt(real x, pair z0)
{
return z0.y*exp(1/z0.x-1/x);
}
path trajectory(pair z0, real leftmargin, real rightmargin)
{
real curleftmargin=leftmargin;
real currightmargin=rightmargin;
if(z0.x>0)
{
curleftmargin=0.01;
}
else
{
currightmargin=-0.3;
}
return graph(new real(real t) {return yt(t, z0);},curleftmargin, currightmargin);
}
path boundary=(-3,-3)--(3,-3)--(3,3)--(-3,3)--cycle;
path traj;
pair inits[]={
(1,0),
(1,0.5),(1,1),(1,2),(1,6),(1,100),
(1,-0.5),(1,-1),(1,-2),(1,-6), (1,-100),
(-1,0.3),(-1,1),(-1,2),(-1,3),
(-1,-0.3), (-1,-1),(-1,-2),(-1,-3),
(-1,0),
};
draw((-3,0)--(0,0)--trajectory((1,0.5),0,3),p=rgb(1,0.3,0.3)+4.5);
draw((0,-3)--(0,3),p=rgb(0.2,0.8,0.2)+4.5);
arrowsize=new real(pen p=currentpen) {return 3.5mm;};
for(pair z0 : inits)
{
traj=trajectory(z0, -3, 3);
traj=lastcut(traj,boundary).before;
draw(traj, Arrow(position=45));
}
draw((0,0.1)--(0,3), Arrow(4mm, Relative(0.3),filltype=NoFill), Arrow(4mm, Relative(0.32),filltype=NoFill));
draw((0,-0.1)--(0,-3), Arrow(4mm, Relative(0.3), filltype=NoFill), Arrow(4mm, Relative(0.32), filltype=NoFill));
fill(scale(0.06)*unitcircle);