One dimensional optimization of an implicit equation

56 Views Asked by At

Im trying to optimize the equation if $x = x( \theta)$ is a function of $\theta$ and

$$ \frac{9.8}{800 \cos^2 \theta } x^2 - \tan \theta x + 13.5 = 0 $$

I know I need to apply implicit differentiation to obtain the value of $\theta$ that maximizes $x$. Is there a built in funcion in MATLAB to perform such a task?

2

There are 2 best solutions below

0
On BEST ANSWER

To get nicer coefficients, let us rewrite the equation as $$\frac{49 \sec ^2(\theta )}{4000}x^2- \tan (\theta )x+\frac{27}{2}=0$$ Solving the quadratic gives two roots which, after a few trigonometric simplifications, write $$x_{1,2}=\frac{20}{49} \left(50 \sin (2 \theta )\pm \sqrt{5}\cos 2(\theta ) \sqrt{-1000 \cos (2 \theta ) -323 }\right)$$ As you can see, there are areas where $$1000 \cos (2 \theta ) +323>0$$ would make problems (leading to complex solutions).

Looking at the plot, you will easily identify that $x_2$ is the solution giving a maximum close to $\theta=1$.

Computing the derivative $$\frac{dx_2}{d\theta}=\frac{10}{49} \left(200 \cos (2 \theta )+\frac{\sqrt{5} (1323 \sin (2 \theta )+1000 \sin (4 \theta ))}{\cos(\theta)\sqrt{-1000 \cos (2 \theta )-323}}\right)$$ Cancelling this derivative is not the simplest problem and I would suggest to use Newton method starting with $\theta_0=1$. Letting you the please of computing the next derivative, Newton iterates would be $$\left( \begin{array}{cc} n & \theta_n \\ 0 & 1 \\ 1 & 1.030651783 \\ 2 & 1.042903695 \\ 3 & 1.043856413 \\ 4 & 1.043861059 \end{array} \right)$$ The second derivative (what you have since using Newton method) will confirm that this is a maximum. Evaluating will give $x_{max}\approx 23.7472$.

0
On

In Mathematica you must first solve for $x(\theta)$:

Solve[9.8 x^2/(800 Cos[θ]^2) - Tan[θ] x + 13.5 == 0, x]

whose relevant solution is:

40.81 Cos[θ]^2 (Tan[θ] + Sqrt[-0.661 Sec[θ]^2 + Tan[θ]^2])

Then maximize the real part of this function (to avoid imaginary solutions) limiting $\theta>0$:

Maximize[{Re[
   40.81  Cos[θ]^2 (Tan[θ] + Sqrt[-0.66  Sec[θ]^2 + Tan[θ]^2])], 
  θ > 0}, θ]

which gives

{23.7961, {θ -> 1.0429}}