private static float idealFilter(float x) { if (x==0.0f) return 0.0f; float y = 0.5f*FLT_PI*x; float s = sin(y); return -s*s/y; }
public double u(double x) { return _c+_a*sin(_b*x); } public double umax() {
private static double sinc(double x) { return (x!=0.0)?sin(PI*x)/(PI*x):1.0; }
private static double sinc(double x) { return (x!=0.0)?sin(PI*x)/(PI*x):1.0; }
private static double h1(double r) { return (r==0.0)?1.0:sin(PI*r)/(PI*r); }
private static double h3(double r) { if (r==0.0) { return PIO6; } else { double pir = PI*r; return 0.5*PI*(sin(pir)-pir*cos(pir))/(pir*pir*pir); } } }
private float[][] makeCirclePoints() { int nt = 1000; double dt = 2.0*DBL_PI/(nt-1); float[] x = new float[nt]; float[] y = new float[nt]; for (int it=0; it<nt; ++it) { float t = (float)(it*dt); x[it] = cos(t); y[it] = sin(t); } return new float[][]{x,y}; } }
private static void plot0() { float[] f = sin(rampfloat(0.0f,0.1f,63)); SimplePlot.asSequence(f); } private static void plot1() {
private static void plot2() { float[][] f = sin(rampfloat(0.0f,0.1f,0.1f,101,101)); SimplePlot.asPixels(f).addColorBar(); } private static void plot3() {
private static void plot1() { int nx = 301; float dx = 0.1f; float fx = 0.0f; Sampling sx = new Sampling(nx,dx,fx); float[] x = rampfloat(fx,dx,nx); float[] f = sub(mul(x,sin(x)),1.0f); SimplePlot.asPoints(sx,f); } private static void plot2() {
RandomTensors2(int n1, int n2) { super(n1,n2); Random r = new Random(); for (int i2=0; i2<n2; ++i2) { for (int i1=0; i1<n1; ++i1) { float a = 2.0f*FLT_PI*r.nextFloat(); float u1 = cos(a); float u2 = sin(a); float du = 0.01f+0.09f*r.nextFloat(); float dv = 0.01f+0.99f*r.nextFloat(); setEigenvectorU(i1,i2,u1,u2); setEigenvalues(i1,i2,du,dv); } } } }
private static void plot3() { SimplePlot plot = new SimplePlot(); plot.addGrid("H-.V-."); float[] f = sin(rampfloat(0.0f,0.1f,63)); plot.addPoints(f).setStyle("r-o"); float[] g = cos(rampfloat(0.0f,0.1f,63)); plot.addPoints(g).setStyle("b-x"); plot.setTitle("A simple plot of two arrays"); plot.setVLabel("array value"); plot.setHLabel("array index"); } }