1 package JSci.maths.analysis; 2 3 8 public class Exponential extends RealFunction { 9 private final double A, w, n, k; 10 13 public Exponential() { 14 this(1.0, 1.0, 0.0, 1.0); 15 } 16 19 public Exponential(double A, double w, double k) { 20 this(A, w, k, 1.0); 21 } 22 26 public Exponential(double A, double w, double k, double n) { 27 this.A = A; 28 this.w = w; 29 this.k = k; 30 this.n = n; 31 } 32 public double map(double x) { 33 x += k; 34 if(n == 1.0) 35 x = x; 36 else if(n == 2.0) 37 x *= x; 38 else 39 x = Math.pow(x, n); 40 return A*Math.exp(w*x); 41 } 42 public RealFunction differentiate() { 43 RealFunction diff = new Exponential(A*w, w, k, n); 44 if(n != 1.0) 45 diff = new Power(n, k, n-1).multiply(diff); 46 return diff; 47 } 48 } 49 | Popular Tags |