# I'm supposed to find all extremum to the function f(x)=((1+x^2−1.6x^3+0.6x^4)/(1+x^4)). Been struggeling with this for hours.

1 view (last 30 days)

Show older comments

##### 1 Comment

James Tursa
on 7 Nov 2016

What have you tried so far? Is your code having errors, not producing correct answers, or what?

### Answers (1)

Hannes Daepp
on 11 Nov 2016

I understand that you want to find the minima and maxima for this function. From a plot, you can observe that this function has two global extremum, limits at x=+/-inf, and two local max/min:

>> x=-10:0.1:10;

>> f=((1+x.^2-1.6*x.^3+0.6*x.^4)./(1+x.^4));

>> plot(x,f)

You could determine absolute min/max numerically:

>> [ma, imax] = max(fvec);

>> [mi, imin] = min(fvec);

>> disp([xvec(imax) ma])

-1.1000 2.1176

>> disp([xvec(imin) mi])

1.9000 0.1037

Alternatively, you can use the Symbolic Toolbox to find limits and extremum: >> syms x >> f=((1+x^2-1.6*x^3+0.6*x^4)/(1+x^4)); >> limit(f,x,-inf) ans = 3/5

Minima and maxima can be found by setting the derivative equal to zero. In this case, the output has complex roots, so some extra steps must be undertaken to determine the real roots:

>> syms x f(x)

>> f=((1+x^2-1.6*x^3+0.6*x^4)/(1+x^4));

>> limit(f,inf)

ans =

3/5

>> rts=solve(diff(f,x))

rts =

0

root(z^5 - (5*z^4)/4 - z^2 - 3*z + 5/4, z, 1)

root(z^5 - (5*z^4)/4 - z^2 - 3*z + 5/4, z, 2)

root(z^5 - (5*z^4)/4 - z^2 - 3*z + 5/4, z, 3)

root(z^5 - (5*z^4)/4 - z^2 - 3*z + 5/4, z, 4)

root(z^5 - (5*z^4)/4 - z^2 - 3*z + 5/4, z, 5)

This function has several roots beyond those at zero. To find those locations, we can use "roots" and pick out the real roots:

>> roots([1 -5/4 0 -1 -3 5/4])

ans =

1.8824 + 0.0000i

-1.0923 + 0.0000i

0.0466 + 1.2870i

0.0466 - 1.2870i

0.3666 + 0.0000i

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!