# Include curve into a filldraw cycle

I have a question regarding asymptote drawing in LaTeX. I'm an absolute novice in using asymptote, and I could not find any help in the manuals I found online.

Here is the problem.

Starting from this simple code

\begin{asy}
import patterns;

size(6cm,0);
draw(box((0,0), (2,1)));

pen p=1.5bp+.9red;

pair A=(0,0), B=(0,1), C=(0.7,1), D=(2,0.35),E=(2,0);

filldraw(A--B--C--D--E--cycle,pattern("shd"),p);
\end{asy}


which works fine and shades a region confined with straight lines, I want to change the segment CD to a curve $f(x)=0.7/x$. This is my naive try:

\begin{asy}
import patterns;
import graph;

size(6cm,0);
draw(box((0,0), (2,1)));

pen p=1.5bp+.9red;

pair A=(0,0), B=(0,1), C=(0.7,1), D=(2,0.35), E=(2,0);

real f(real x) {return 0.7/x}

filldraw(A--B--C--graph(f,0.7,2)--D--E--cycle,pattern("shd"),p);
\end{asy}


However, it doesn't work.

Thank you in advance for you help.

For an Asymptote beginner, I'm impressed that you have solved all the difficult problems in your script! You have only forgotten a semicolon in your return statement.

Thank you for the working and non-working example code!

\begin{asy}
import patterns;
import graph;

size(6cm,0);
draw(box((0,0), (2,1)));

pen p=1.5bp+.9red;

pair A=(0,0), B=(0,1), C=(0.7,1), D=(2,0.35), E=(2,0);

real f(real x) { return 0.7/x; }  // <------ ADDED SEMICOLON HERE 