I'm having trouble passing the updated values of initial_guess_1 and initial_guess_2 back into the GoldenSectionSearch method (I've attempted to have the method call itself until the terminating condition associated with the "if" is satisfied). My attempts at resolving this myself were influenced by what I found here:
http://www.java-tutorial.com/java-tutorial/java-classes-methods/java-call-reference/
I'm still unable to figure out what I am doing wrong in trying to pass updated values back into the method. What am I doing wrong and how do I fix it? I'm a novice at programming and would like things broken down into the smallest,most easily understood terms possible.
public static double GoldenSectionSearch(double x_1, double x_2, double initial_guess_1,double initial_guess_2 ,double gradient_x, double gradient_y, double a,double a_0,double a_1,double a_2,double b_0,double b_1,double p,double N){
//Stuff
if(Math.abs((100*(x_2 - x_1*x_1)*(x_2 - x_1*x_1) + (1- x_1)*(1- x_1)) - (100*(initial_guess_2 - initial_guess_1*initial_guess_1)*(initial_guess_2 - initial_guess_1*initial_guess_1) + (1- initial_guess_1)*(1- initial_guess_1)) )/Math.abs(1+(100*(initial_guess_2 - initial_guess_1*initial_guess_1)*(initial_guess_2 - initial_guess_1*initial_guess_1) + (1- initial_guess_1)*(1- initial_guess_1))) >=0.50*Math.pow(10,-6)){
initial_guess_1=x_1;
initial_guess_2=x_2;
//Double Boxed_a = new Double(a);
Double Boxed_initial_guess_1 = new Double(initial_guess_1);
Double Boxed_initial_guess_2 = new Double(initial_guess_2);
initial_guess_1.GoldenSectionSearch(initial_guess_1);
initial_guess_2.GoldenSectionSearch(initial_guess_2);
gradient_x = (400*initial_guess_1*(initial_guess_1*initial_guess_1 - initial_guess_2) + 2*(initial_guess_1 -1));
gradient_y = (200*(initial_guess_2 - initial_guess_1*initial_guess_1));
GoldenSectionSearch(initial_guess_1,initial_guess_2,x_1, x_2, gradient_x, gradient_y, a, a_0, a_1, a_2, b_0, b_1, p,N);
} else{
double f_x=(100*(x_2 - x_1*x_1)*(x_2 - x_1*x_1) + (1- x_1)*(1- x_1));
System.out.print("alpha = " + a + " " + "x_1 = " + x_1 + " " + "x_2 = " + x_2 + " " + "f_x = " + f_x);
}
// Double Boxed_a = new Double(a);
return x_2;
}