Question: m1 public static double x( int n, int d) { double result = 100; for ( int i = 1; i < n; i++) {
m1
public static double x(int n, int d) { double result = 100; for (int i = 1; i < n; i++) { double pre = x(n - 1, d); result = pre + (d - Math.pow(pre, 3)) / (3 * Math.pow(pre, 2)); } return result; } public static int NCount(int d) { int n = 1; while(true) { if (x(n, d) - x(n + 1, d) < 0.01) return n + 1; n++; } } public static void main(String[] args) { System.out.println(x(3,12)); System.out.println(NCount(12)); }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
