Finding the height of a trough through root finding methods In my computer-aided-problem-solving class, I am asked to determine the height of a trough, through a root-finding method. I can choose between the bisection method, Newton's method or successive substitution.
Whichever method I choose, I should determine the height via the method in MATLAB.
I have no idea how one of these methods is going to help me find the depth of the trough?
The following formula is given:
$$V = L \left( r^2  \arccos\left(\frac{h}{r}\right) -h \sqrt{r^2-h^2}\right)$$
Where V is the volume of the trough, which has a value of $0.35\,\text{m}^3$.
$L$ is the length, which has the value of $3\,\text{m}$.
Finally the "radius" of the trough is $r=0.3\,\text{m}$.
I should give an answers with an accuracy of 6 digits.
I attached a picture of the trough.
Can someone help me with this?? Thanks

 A: One approach would be to do it using Newton's method. We want to solve the equation $f(h)=0$, with
$$
f(h) = L\left( r^2 \arccos \left(\frac{h}{r}\right) - h\sqrt{r^2-h^2} \right) - V
$$
With Newton's method, we start out with an initial value (e.g., $h_0 = 0$), and then iterate, until we converge:
$$
h_{n+1} = h_n - \frac{f(h_n)}{f'(h_n)}.
$$
Here, $f'(h)$ represents the derivative, which happens to be 
$$
f'(h) = -2L\sqrt{r^2-h^2},
$$
in your case. If you will do this, you'll find $h=0.041306\,\text{m}$.
Here is the code:
% Parameters
V = 0.35;       % [m^3]
L = 3;          % [m]
r = 0.3;        % [m]

% Initial guess
h = 0;          % [m]

% Loop until convergence
hold = 1;
iter = 0; % Counter to limit # of iterations, in case of no convergence
while abs(h - hold) > 1e-7 && iter < 100
    % Compute the value of the function
    f = L*(r^2*acos(h/r) - h*sqrt(r^2-h^2)) - V;

    % Compute the derivative of the function
    fderiv = -2*L*sqrt(r^2-h^2);

    % Compute the Newton update
    hold = h;  % Remember old value for comparison
    h = h - f / fderiv;

    % Increase the counter for the number of iterations
    iter = iter + 1;

    % Show progress
    fprintf('Iteration %i, h = %.6f\n', iter, h);
end;

% Display result with an accuracy of 6 digits
fprintf('h = %.6f\n', h);  % h = 0.041306

