I am currently stuck on the part where we make the first derivative of a function equal to 0, I tried using trig identities and such but I couldn't make it zero.
we are given the following:
$$f(x) = 2x\cos(2x) - (x-2)^2, [2,4]$$
I find the derivative to be:
$$2\cos(2x) - 4x(\sin(2x)) - 2(x-2) = 0$$
At this point I am stuck with trying to either find the undefined or points in general that make the function (f'(x)) equal to 0. How do I approach solving for x?
$$f'(x)=2\cos(2x)-4x\sin(2x)-2(x-2)$$ \begin{align}f''(x)&=-4x\sin(2x)-4\sin(2x)-8x\cos(2x)-2 \\&=-4(x+1)\sin(2x)-8x\cos(2x)-2\end{align}
$$\frac{f'(x)}{f"(x)}=-\frac{\cos(2x)-2x\sin(2x)-2(x-2)}{2(x+1)\sin(2x)+4x\cos(2x)+1}$$
From Newton's method
$$x_{n+1}=x_n-\frac{f'(x_n)}{f"(x_n)}$$
I have coded some simple python code here:
http://www.codeskulptor.org/#user42_uBhUshL1Zh_0.py
the solution is roughly $3.13110627798$ and objective funciton $4.98143395755$