/* * nm3.java - revised 28 Mar 07 - width 397, height 241 * @author jackord@kw.igs.net * string of length 8d, clamped at both ends * equal point masses at intervals of d * finite and infinite Fourier Sine Series representations of * 'pluck' and 'pulse' initial displacements */ import java.applet.Applet; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class nm3 extends Applet implements ActionListener { int kk=0; int ff=0; // Declarations String b1s="Pluck FFSS"; Button b1=new Button(b1s); String b2s="Pulse FFSS"; Button b2=new Button(b2s); String b3s="Pluck FSS"; Button b3=new Button(b3s); String b4s="Pulse FSS"; Button b4=new Button(b4s); public void init() { add(b1); add(b2); add(b3); add(b4); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); setBackground(new Color(211, 211, 211)); } public void paint(Graphics g) { int n, r, y1, y2; // Declarations double z; double [] a=new double[9]; double [] b=new double[9]; double [] y=new double[9]; g.setColor(Color.black); g.drawRect(0, 0, 396, 240); n=8; r=3; if (kk!=0) { if (kk==1) { // Initialize pluck for (int i=0; i<=n/2; i=i+1) { y[i]=40*i; y[n-i]=y[i]; } for (int i=1; i