-1

I am looking to find the max value of this function: log(x^(sqrt(2))) - x^3 + 4 I am having trouble with how to go about this problem. Any help is great. What I have right now is:

y =@(x) log(x).^(sqrt(2)) - x.^3 + 4 ;
x0 = 1;
x = fzero(y,x0);
disp(x);

Nate
  • 1
  • fzero(y, x0) finds the root of the function y with initial guess x0. You are not looking for roots, you are trying to find the max value. If you want to use fzero, you need to apply it to the derivative of y, which you can compute either by hand, or symbolically, using diff if you have the symbolic toolbox. – parsiad Apr 28 '16 at 00:09

1 Answers1

0

The derivative of $$ \log(x^{\sqrt{2}})-x^{3}+4=\sqrt{2}\log(x)-x^{3}+4 $$ is $$ \frac{\sqrt{2}}{x}-3x^{2}. $$ Setting the derivative to zero and solving for $x$, $$ x=\frac{\sqrt[6]{2}}{\sqrt[3]{3}}. $$ You can check that this is, in fact, the point at which the extrema is attained. Plugging this $x$ into the original function and simplifying, the maximum is $$ \left(24-2\sqrt{2}-\sqrt{2}\log\left(9/2\right)\right)/6\approx3.17408. $$ (P.s. ~ This site is generally not for MATLAB, try stackoverflow instead)

parsiad
  • 25,154