Examples of Polynomial


Examples of DSP.filter.Polynomial

        prod *= ( (double)(D - N + n ) ) / ( (double) (D - N + i + n ) );
      }
      a[i] = Math.pow( -1, i ) * ( factorial(N) / ( factorial(N-i) * factorial(i) ) ) * prod;
    }
   
    Polynomial P = new Polynomial( a );
    k            = P.reflectionCoefficients();
    constructRationalRepresentation();
   
  }
View Full Code Here

Examples of DSP.filter.Polynomial

      int nComplexPolePairs = order/2;
      int nPoles            = nRealPoles + 2*nComplexPolePairs;
     
      if ( nRealPoles == 1 ) {
        double[] td = { 1.0/a, 1.0};
        addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
      }
     
      double dAngle = Math.PI/nPoles;

      for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
          double angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
          Complex pole = Complex.divide( 1.0, new Complex( a*Math.sin(angle), b*Math.cos(angle ) ) );
          double[] td    = { pole.real()*pole.real() + pole.imag()*pole.imag(), -2*pole.real(), 1.0 };
          double zeroimag = 1.0/Math.cos((2*i+1)*Math.PI/(2*order) );
          double[] tn     = { zeroimag*zeroimag, 0.0, 1.0 };
          addSection( new Rational( new Polynomial(tn), new Polynomial(td) ) );
      }
     
      // scale to 1 at s = 0
     
      double DCvalue = evaluate( 0.0 ).abs();
View Full Code Here

Examples of DSP.filter.Polynomial

    int nComplexPolePairs = order/2;
    int nPoles            = nRealPoles + 2*nComplexPolePairs;
   
        if ( nRealPoles == 1 ) {
          double[] td = {1.0, 1.0};
          addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
        }
       
      double dAngle = Math.PI/nPoles;

      for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
          double   angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
          double[] td    = {1.0, -2*Math.sin(angle), 1.0 };
          addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
      }
     
  }
View Full Code Here

Examples of DSP.filter.Polynomial

    int nComplexPolePairs = order/2;
    int nPoles            = nRealPoles + 2*nComplexPolePairs;
   
    if ( nRealPoles == 1 ) {
      double[] td = { a, 1.0};
      addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
    }
   
    double dAngle = Math.PI/nPoles;

    for ( int i = 0;  i < nComplexPolePairs;  i++ ) {
        double   angle = -Math.PI/+  dAngle/2 *( 1 + nRealPoles +  i*dAngle;
        Complex pole = new Complex( a*Math.sin(angle), b*Math.cos(angle ) );
        double[] td    = { pole.real()*pole.real() + pole.imag()*pole.imag(), -2*pole.real(), 1.0 };
        addSection( new Rational( new Polynomial(1.0), new Polynomial(td) ) );
    }
   
    // scale to 1 at s = 0
   
    sections.get( 0 ).timesEquals( 1.0 / ( Math.pow(2.0, order-1)*epsilon ) );
View Full Code Here

Examples of DSP.filter.Polynomial

    }
   
    Arrays.fill( b, 0.0 );
    for ( int i = 0;  i <= order;  i++ ) b[i] = a[ order - i ];
   
    T = new Rational( (new Polynomial(b)), (new Polynomial(a)) );
  }
View Full Code Here

Examples of DSP.filter.Polynomial

         
          Polynomial[] DT = lptobpFactors( section.denominator(), BW, prod );
          double[] t1 = { 0.0, 1.0 };
         
          if ( order[0] == 0 ) {
            retval.addSection( new Rational( new Polynomial(t1), DT[0] ) );
            retval.addSection( new Rational( new Polynomial(t1), DT[1] ) );
          }
          else if ( order[0] == 1 ) {
            retval.addSection( new Rational( new Polynomial(t1), DT[0] ) );
            double[] t2 = new double[3];
            double[] tc = Tsection.numerator().coefficients();
            for ( int j = 0;  j < 3;  j++ ) t2[j] = tc[j+1];
            retval.addSection( new Rational( new Polynomial(t2), DT[1] ) );
          }
          else if ( order[0] == 2 ) {
            Polynomial[] NT = lptobpFactors( section.numerator(), BW, prod );
            retval.addSection( new Rational( NT[0], DT[0] ) );
            retval.addSection( new Rational( NT[1], DT[1] ) );
View Full Code Here

Examples of DSP.filter.Polynomial

        double   root = ( -b + Math.sqrt(discriminant) ) / 2.0;
        double   f1   = root*BW/2.0;
        double   f2   = f1*f1 - prod;
        Complex  C    = new Complex( f1 ).plus( Complex.sqrt( new Complex(f2) ) );
        double[] t0   = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[0]     = new Polynomial( t0 );
           
        root = ( -b -Math.sqrt(discriminant) ) / 2.0;
        f1   = root*BW/2.0;
        f2   = f1*f1 - prod;
        C    = new Complex( f1 ).plus( Complex.sqrt( new Complex(f2) ) );
        double[] t1 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[1]     = new Polynomial( t1 );
      }
      else {
        Complex root = new Complex( -b/2.0, Math.sqrt( -discriminant ) / 2.0 );
       
        Complex f1  = root.times( BW/2.0 );
        Complex f2  = (f1.times(f1)).minus( prod );
        Complex C   = f1.plus( Complex.sqrt( f2 ) );
        double[] t0 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[0]   = new Polynomial( t0 );
           
        C = f1.minus( Complex.sqrt( f2 ) );
        double[] t1 = { C.conjugate().times(C).real(), -2.0*C.real(), 1.0 };
        retval[1]   = new Polynomial( t1 );
      }
     
      return retval;
    }
View Full Code Here

Examples of ca.eandb.jmist.math.Polynomial

    double z0 = org.z() / radius;
    double x1 = dir.x() / radius;
    double y1 = dir.y() / height;
    double z1 = dir.z() / radius;

    Polynomial f = new Polynomial(
        x0 * x0 - y0 * y0 + z0 * z0,
        2.0 * (x0 * x1 - y0 * y1 + z0 * z1),
        x1 * x1 - y1 * y1 + z1 * z1);

    double[] t = f.roots();

    if (t.length == 2) {
      for (int i = 0; i < 2; i++) {
        if (recorder.interval().contains(t[i])) {
          Point3 p = ray.pointAt(t[i]);
View Full Code Here

Examples of ca.eandb.jmist.math.Polynomial

    double z0 = ray.origin().z() * dh;
    double x1 = ray.direction().x() * dh;
    double y1 = ray.direction().y() * dr;
    double z1 = ray.direction().z() * dh;

    Polynomial f = new Polynomial(
        x0 * x0 - y0 * y0 + z0 * z0,
        2.0 * (x0 * x1 - y0 * y1 + z0 * z1),
        x1 * x1 - y1 * y1 + z1 * z1);

    double[] t = f.roots();

    if (t.length == 2) {
      for (int i = 0; i < 2; i++) {
        if (recorder.interval().contains(t[i])) {
          Point3 p = ray.pointAt(t[i]);
View Full Code Here

Examples of ca.eandb.jmist.math.Polynomial

    double    s2NormOfDir    = dir.squaredLength();
    double    s2NormOfOrig  = orig.squaredLength();
    double    dirDotOrig    = dir.dot(orig);
    double    K        = s2NormOfOrig - (sqRadius1 + sqRadius2);

    Polynomial  f = new Polynomial(
              K * K - 4.0 * sqRadius1 * (sqRadius2 - orig.y() * orig.y()),
              4.0 * dirDotOrig * (s2NormOfOrig - (sqRadius1 + sqRadius2)) + 8.0 * sqRadius1 * dir.y() * orig.y(),
              2.0 * s2NormOfDir * (s2NormOfOrig - (sqRadius1 + sqRadius2)) + 4.0 * ((dirDotOrig * dirDotOrig) + sqRadius1 * dir.y() * dir.y()),
              4.0 * dirDotOrig * s2NormOfDir,
              s2NormOfDir * s2NormOfDir
          );

    double[]  x = f.roots();

    if (x.length > 1)
    {
      Arrays.sort(x);
      for (int i = 0; i < x.length; i++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.