MATLAB Answers

Find range of values of independent variable so the dependent variable is in a certain range

7 views (last 30 days)
Aleem Andrew
Aleem Andrew on 21 Mar 2021
Answered: John D'Errico on 21 Mar 2021
Given a function for example f(x) = x^3+x^5 is there a way you can determine all values of x such that the absolute value of f(x) is less than 5?

Answers (1)

John D'Errico
John D'Errico on 21 Mar 2021
No. Given a completely general nonlinear function as a black box, so you cannot see inside the box, just pass in values, the answer is an uncategorical no.
Given a low order polynomial (of sufficiently low degree that we can do things like solve for roots of said polynomial) the problem is simpler. It would involve finding roots of a related set of polynomials, where that related set of polynomials is caused to have the constant term be adjusted carefully.
Thus for the polynomial f(x) == x^3 + x^5, we need to solve for the roots of the associated polynomials f(x)-5 and f(x)+5. Given that information, you can now determine intervals as needed. No, I won't write the code for that, because this problem is far more complex for a general blackbox function, and that is surely what you want. If it really is for the simple polynomial you wrote, that is trivial, and likely part of a homework assignment, and I don't do homework.

Community Treasure Hunt

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

Start Hunting!