Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DifferentialPolynom {
- public static double[] diffPoly(double[] coeffs) {
- // one time differentiate
- // y=x^n, y'=n*x^(n-1)
- int n=1 ;
- double[]c=new double[coeffs.length-1] ;
- if (coeffs.length==1) {
- c[1]=0;
- return c ;
- }
- else
- for (int i=1;i<=coeffs.length ;i++)
- {
- c[i-1]=n*coeffs[i] ;
- n=n+1 ;
- }
- return c ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement