-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSin.java
More file actions
38 lines (32 loc) · 1008 Bytes
/
Copy pathSin.java
File metadata and controls
38 lines (32 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public class Sin {
private double coefficient;
private double period;
private double exponent;
public Sin(double coefficient, double period, double exponent){
this.coefficient = coefficient;
this.period = period;
this.exponent = exponent;
}
public double calculateSin(double x) {
final double sin = this.coefficient * Math.pow(Math.sin(this.period * x), this.exponent);
return sin;
}
public Cos sinDerivative(){
final Cos cos;
if(this.exponent > 1) {
cos = new Cos(this.coefficient * this.exponent * this.period, this.period, this.exponent - 1);
} else {
cos = new Cos(this.coefficient * this.period, this.period, this.exponent);
}
return cos;
}
public double getCoefficient() {
return this.coefficient;
}
public double getPeriod() {
return this.period;
}
public double getExponent() {
return this.exponent;
}
}