Reputation: 29
I had a quick question about java math and a little bit about math in general. so 763.5*cos(70) should in equal to 261.13237 that's how the Ax vector is calculated, however, in java the answer seems to be 483.53921155638994. no idea why. any help is much appreciated
here is what I have so far
package Main;
import java.util.Scanner;
import java.lang.Math;
public class vectors{
public static void main(String[] args) {
double Mag = 763.5;
double Deg = 70;
double Ax;
double Ay;
Ax = Mag*Math.cos(Deg);
System.out.println(Ax);
}
}
Upvotes: 1
Views: 192
Reputation: 2026
Math.cos()'s argument is in radians:
double Mag = 763.5;
double Deg = 70;
double radians = (Deg / 360) * 2 * Math.PI;
double Ax;
double Ay;
Ax = Mag*Math.cos(radians);
System.out.println(Ax);
261.13237942914816
Upvotes: 1