public void paintSlopeField(Graphics g, double xmid, double xfactor, double ymid, double yfactor) throws UnresolvedNameException {
        HashMap<String, Double> h = new HashMap<String, Double>();

        for (double x = xbl; x < xbh; x += xlineint) {
            for (double y = xbl; y < xbh; y += ylineint) {
                h.put("x", Math.round(x / xscale) * xscale);
                h.put("y", Math.round(y / xscale) * xscale);
                double yprime = diffeq.solve(h);

                //System.out.println("x = "+Math.round(x/xscale)*xscale+", y = "+y);
                if (Double.isInfinite(yprime) || Double.isNaN(yprime))
                    continue;
                double length = 0.5;
                double deltaX = length / Math.sqrt(yprime * yprime + 1);
                double deltaY = length * yprime / Math.sqrt(yprime * yprime + 1);
                
                double x1 = x - deltaX, x2 = x + deltaX;
                double y1 = y - deltaY, y2 = y + deltaY;
                
                double xt1 = xmid + x1 * xfactor, yt1 = ymid - y1 * yfactor, xt2 = xmid + x2 * xfactor, yt2 = ymid - y2 * yfactor;
                g.drawLine((int)xt1, (int)yt1, (int)xt2, (int)yt2);
            }
        }
    }