How to check whether the function invertible or not?

 Réponse acceptée

If all you are given is a function handle, and you are not permitted to examine the source code, then it is not always possible to determine whether a function is invertible.
Consider for example
testfun = @(x) x + (x == 37.9123325183) .* 12.0876674817
which returns its input except for 37.9123325183 for which it returns 50 instead.
Without some tool for disassembling the implementing expression, you would have to have tested with exactly that magic value in order to have observed a result different than you expected.
Or here is another one: write a function that returns its input **unless* the number is odd and the sum of the factors of the number including 1 but excluding the number itself, add up to the number, in which case return -1.
Is this function invertible? No-one knows. A lot of research has gone into it over the centuries, but no-one has been able to prove that Odd Perfect Numbers do not exist (the above function is invertible except at odd perfect numbers.) Therefore even having access to the source code is not enough to be able to tell whether the function is invertible.

5 commentaires

If i have a one function eg: f(x)= x^2 this function at point x=2 and x=-2 give same value so it is non Invertible system.so can you just guide me to how to write program of it?
If you look at the testfun I posted above, at 37.9123325183 and at 50 it produces the same result, so it is non-Intevertible. But if we are only given a function handle and are not permitted to examine the operations and reason about it, then there is no way you would ever happen to find that magic 37.9123325183 value.
For the specific case of f = @(x) x.^2 then it is easy enough: just randomly choose an one number up to sqrt(realmax) and show that f(x) == f(-x)
Thank you so much. Very well explained.
If, though f = @(x)x.^2 - 2*x + 3 then for any non-zero x you try, f(x) ~= f(-x) , so just trying one value will not help.
If you have the symbolic toolbox, then there is a class of problems for which you can ask
solve(f(x) == f(-x), x)
and see if there is any solution that excludes 0 (because 0 = -0 and so -x is not distinct from x for x = 0).
In the case of polynomials, then The Fundamental Theorem of Algebra says that a degree N polynomial has N roots -- N (possibly non-distinct) places where f(x) = 0. If any of those roots are non-zero, then the polynomial is not invertable because it has at least two places where f(x1) = f(x2) = 0. The polynomial whose roots are all-zero is the form f(x) = a*x^n for some positive integer n. And in the case of a*x^n for positive integer n, if n is even then f(-x)=f(x) for all x and so it would not be invertible. For the case of a*x^n for odd positive integer n > 1, the function is still not invertible: y = a*x^n has solutions involving y/a and the N roots of unity.
if i want to get a graph between f(x) and g(x) then how to write code for plotting it? ; where f(x) is any function [eg: 10*x+2] and g(x) is inverse of f(x) [ here inverse of f(x) is x/10 - 1/5].

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Produits

Version

R12.1

Community Treasure Hunt

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

Start Hunting!

Translated by