一道关于牛顿迭代法的数值问题,题目是英文的,没有头绪,In celestial mechanics,Kelper `s equation is important.It reads x=y-msiny,in which x is a planet`s mean anomaly,y is eccentric anomaly,and m is the eccentricity of its orbit.T
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/20 10:39:25
![一道关于牛顿迭代法的数值问题,题目是英文的,没有头绪,In celestial mechanics,Kelper `s equation is important.It reads x=y-msiny,in which x is a planet`s mean anomaly,y is eccentric anomaly,and m is the eccentricity of its orbit.T](/uploads/image/z/3035265-33-5.jpg?t=%E4%B8%80%E9%81%93%E5%85%B3%E4%BA%8E%E7%89%9B%E9%A1%BF%E8%BF%AD%E4%BB%A3%E6%B3%95%E7%9A%84%E6%95%B0%E5%80%BC%E9%97%AE%E9%A2%98%2C%E9%A2%98%E7%9B%AE%E6%98%AF%E8%8B%B1%E6%96%87%E7%9A%84%2C%E6%B2%A1%E6%9C%89%E5%A4%B4%E7%BB%AA%2CIn+celestial+mechanics%2CKelper+%60s+equation+is+important.It+reads+x%3Dy-msiny%2Cin+which+x+is+a+planet%60s+mean+anomaly%2Cy+is+eccentric+anomaly%2Cand+m+is+the+eccentricity+of+its+orbit.T)
一道关于牛顿迭代法的数值问题,题目是英文的,没有头绪,In celestial mechanics,Kelper `s equation is important.It reads x=y-msiny,in which x is a planet`s mean anomaly,y is eccentric anomaly,and m is the eccentricity of its orbit.T
一道关于牛顿迭代法的数值问题,题目是英文的,没有头绪,
In celestial mechanics,Kelper `s equation is important.It reads x=y-msiny,in which x is a planet`s mean anomaly,y is eccentric anomaly,and m is the eccentricity of its orbit.Taking m=0.9,construct a table of y for 30 equally spaced values of x in the interval 0
一道关于牛顿迭代法的数值问题,题目是英文的,没有头绪,In celestial mechanics,Kelper `s equation is important.It reads x=y-msiny,in which x is a planet`s mean anomaly,y is eccentric anomaly,and m is the eccentricity of its orbit.T
y-msiny-x=0,其中m=0.9,0<=x<=π,x所属区间分成30等份,对每个x用牛顿法求y.
Java代码:
public class Newton {
public static final double EPSILON = 1e-15;
private static double f(double x, double y) {
return y - 0.9 * Math.sin(y) - x;
}
// y - 0.9*Math.sin(y) - x,x取固定值,对y求导后为 1 - 0.9 * Math.cos(y)
private static double d(double y) {
return 1 - 0.9 * Math.cos(y);
}
public static double root(double x) {
double y = 1;
while (Math.abs(f(x, y) / d(y)) > EPSILON) {
y = y - f(x, y) / d(y);
}
return y;
}
public static void main(String[] args) {
double xStep = Math.PI / 30;
for (int i = 0; i <= 30; i++) {
double x = xStep * i;
double y = root(x);
System.out.println("x: " + x + ", y=: "+ y);
}
}
}