How to check whether the function invertible or not?

5 visualizzazioni (ultimi 30 giorni)
Check function Invertible or not

Risposta accettata

Walter Roberson
Walter Roberson il 26 Ott 2020
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 Commenti
Walter Roberson
Walter Roberson il 27 Ott 2020
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.
Aakash parmar
Aakash parmar il 30 Ott 2020
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].

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Electrical Block Libraries in Help Center e File Exchange

Prodotti


Release

R12.1

Community Treasure Hunt

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

Start Hunting!

Translated by