summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples/oneoverx.asy
blob: 5d9775d44dc2b099f8aceb1dd1981616ed0bc6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import graph;
size(200,IgnoreAspect);

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

bool3 branch(real x)
{
  static int lastsign=0;
  if(x == 0) return false;
  int sign=sgn(x);
  bool b=lastsign == 0 || sign == lastsign; 
  lastsign=sign;
  return b ? true : default;
}

draw(graph(f,-1,1,branch));
axes("$x$","$y$",red);