|JFC! I gave you the answer already; or at least told you how to advance.
1) Issolate the problem.
Find where it is going wrong and try to bebug it.
2) Your method input, which is crap, does not update the return value. Change the signature to:
private bool input(ref double fx,
ref double ft,
ref double alpha,
ref int n,
ref int m)
And call it somit like:
ok = input(ref fx,
Don't change anything and compile. What do you see? Come on, you can do it! A few debug statements in the code and you'll soon see that the whole is method is a steaming puile of doo doo.
Personally, I would remove all the try/catch code and see what happens. then I would add try/catches where needed. This means you have to actually test your code for invalid input and/or data but it won't take long.
Panic, Chaos, Destruction.
My work here is done.