Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.
private double getSine(int t) {
double amplitude = 5.0;
double period = 20000 / 2 * Math.PI;
double sin = amplitude * Math.sin(t + period);
return sin;
}
private double getSine(int t) {
double period = 2 * Math.PI / 20000;
double sin = Math.sin(t / period);
return sin;
}
Then I do:for (int t = 0; t <=20000; t+=1000) {
double sin = getSine(t);
System.out.println (t + "\t" + sin);
}
public class MySine{
public MySine(){
for (int t = 0; t <=20000; t+=1000) {
double sin = getSine(t);
System.out.println (t + "\t" + sin);
}
}
private double getSine(int t) {
double period = (2 * Math.PI) / 20000.0;
System.out.println("number " + ( t* period));
System.out.println("number " + ( t*period));
double sin = Math.sin(t*period);
return sin;
}
public static void main(String [] args){
new MySine();
}
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.