public Polynomial nthDerivative(int n){
                Polynomial dnydxn;

                if(n>this.deg){
                        dnydxn = new Polynomial(0.0);
                }
                else{
                        dnydxn = new Polynomial(this.deg-n);
                        double[] nc = new double[this.deg - n + 1];

                        int k = this.deg - n;
                        for(int i=this.deg; i>n-1; i--){
                                nc[k] = this.coeff[i];
                                for(int j=0; j<n; j++){
                                        nc[k] = nc[k]*(i-j);
                                }
                                k--;
                        }
                        dnydxn = new Polynomial(nc);
                }
                return dnydxn;
        }