// グラフの作成 [Func1.java] import java.awt.*; import java.applet.*; public class Func1 extends Applet{ double f(double x) { // 作成するグラフの関数 return (Math.sin(2*x)+Math.cos(3*x)); } //end f public void paint(Graphics g) { double x0,x1,y0,y1,xd,yd; double max=5.0; // X,Y軸の最大値 int w,h,hw,hh; w=getSize().width; //(a) 横の長さ h=getSize().height; //(b) 縦の長さ hw=w/2; hh=h/2; // グラフの中心座標 g.drawString("Sin[2x]+Cos[3x]",10,15); g.drawString("0",hw+5,hh+12); g.setColor(Color.red); g.drawString(""+max,hw-20,12); // y軸の最大値 g.drawString(""+max,w-20,hh+12); // x軸の最大値 g.drawLine(0,hh,w,hh); // x軸 g.drawLine(hw,0,hw,h); // y軸 xd=2*max/w; // 刻み幅 yd=hh/max; g.setColor(Color.blue); for (int x=0 ; x