MATLAB: Difficult inequality to solve

inequality

abs((cos(x)+1/2*x^2)-1)*x^4)<=1/24, does anybody have any idea how to solve this on matlab or write down some possible codes?

Best Answer

  • since your function is even it is symmetric and it is monotone for x>0 or x<0
    use fzero
    >> f=@(x)((cos(x)+1./2.*x.^2)-1).*x.^4 - 1/24 % subtract the value to transform it into an issue of roots
    >> solution=abs(fzero(f,0))
    solution =
    1.0042
    >> range=[-solution solution]
    range =
    -1.0042 1.0042