Original Message (ID '203289') By Hila: 
In Response To 'Re: Numerical analysis gives wrong result'

Thank you so much for taking the time to read my post and answer!!
I am really lost here. I am providing more information and a file (I tried to place only the important information in the file)
I have a profit function, ProfitRetailSolo[L, H, beta, c, ru, R, Ns]. I can solve the first order condition – to get a closed form expression for the value of R that maximizes the profit  only when the parameter Ns is 1.
I need to find the value of R that maximized the profit on the range beta*L, beta*H (that is R is in that range). I am not sure how to provide this restriction to the FindRoot function.
What I ultimately want to find is how the expression CloringR[H,L, Nb,beta, Ns, R,Ra] changes with beta. That is – I want to know if it is increasing or decreasing in beta when evaluated at the optimal value of R.
Ideally I would find a closed form expression for the optimal value of R (as a function of beta and the other parameters), substitute that expression into ClosingR, and then take derivative of ClosingR with respect to R and examine if it is positive or negative.
Since I don’t have the expression for optimal value of R , I instead do a numerical analysis
I used loops to test 180,000 combinations of parameters value (that is values fo H, L, Nb, beta, Ns) – and for each such combination I numerically want to find the optimal value of R. Then, for each combination of parameter values I find the value of ClsoingR at the optimal R
The problem I have is that with Reduce or find instance, I get the wrong value of the optimal R , and often more than one value (even though clearly there should be only one value ).
You wrote that “You mix exact numbers (integers) with machine precision numbers” . How can I not do this? As you can see the derivative is evaluated within the loops – substituting the values of the parameters.
Any more guidance will be greatly appreciated!!

