How can I get the function g(x) (way to solve functional equation)

5 visualizaciones (últimos 30 días)
How do I know the function g(x) by matlab
for example, if I have this functional equation
1-f(x)=g(x)+g(-x)
where I know the function f(x)
  6 comentarios
봉훈 정
봉훈 정 el 27 de Ag. de 2022
Editada: 봉훈 정 el 27 de Ag. de 2022
If f(x) is f=exp(-x^2), could the problem be solved?
Bruno Luong
Bruno Luong el 27 de Ag. de 2022
Just plug f(x) in what I wrote above:
g(x) = (1-exp(-x^2))/2 + o(x)
with o(x) any arbitray odd function.

Iniciar sesión para comentar.

Respuesta aceptada

Sam Chak
Sam Chak el 28 de Ag. de 2022
Not sure if this is what you want. If is an even function (as explained by @Chunru), where the graph is symmetric with respect to the y-axis, then the solution exists for either , or .
1st example:
If we assume that , then
f = @(x) exp(-x^2);
g1 = @(x) 0.5 - 0.5*exp(-x^2);
g2 = @(x) g1(-x);
% Tests
1 - f(1)
ans = 0.6321
g1(1) + g2(1)
ans = 0.6321
2nd example:
If we assume that , then
f = @(x) x^2;
g1 = @(x) 0.5 - 0.5*x^2;
g2 = @(x) g1(-x);
% Tests
1 - f(0.5)
ans = 0.7500
g1(0.5) + g2(0.5)
ans = 0.7500
3rd example: @Bruno Luong's approach
f = @(x) - 2*cos(x);
g1 = @(x) (1 + 2*cos(x))/2 + sin(x);
g2 = @(x) g1(-x);
% Tests
1 - f(pi/3)
ans = 2
g1(pi/3) + g2(pi/3)
ans = 2

Más respuestas (1)

John D'Errico
John D'Errico el 28 de Ag. de 2022
Editada: John D'Errico el 28 de Ag. de 2022
NOTHING IN your question is about MATLAB. But you already have an answer.
I think you may have a misunderstanding. Is there a way to find a UNIQUE function g(x), based on that functional equation? That is, given the relationship:
1 - f(x) == g(x) + g(-x)
can you always recover g(x) uniquely? The answer is no, since we can show a simple counter-example. For example, consider
f(x) = 2*x^2.
Then we can see that A solution, satisfying the relationship is:
g(x) = 1/2 - x^2
It should be clear that g(x)+g(-x) is itself an even function, where
g(-x) = g(x)
then g(x) + g(-x) is just 1-2*x^2.
So in fact, g(x) as given above is a completely valid solution to the problem, given f(x). But is it unique? OF COURSE NOT! In fact, we can consider any function of the form
ghat(x) = (1/2 - x^2) + a*x + bx^3 + c*x^5 + d*x^7 + ...
Do you see that the extra terms I have added in are all purely odd functions? Those terms have the fundamental property that they are odd functions. Any power of x has the property that
(-x)^m = (-1*x)^m = (-1^m)*x^m
If m is an odd power, then (-1)^m is just -1. And that means the function
ghat(-x) + ghat(x) = 1 - 2*x^2
for ANY set of coefficients. Do you see that if you can find any solution, then you can find infinitely many solutions?
You need to understand all of this. In the solution for g(x), all you can ever recover is the EVEN part of the function g(x). If there is any odd component, it can never be recovered uniquely.
Anyway, how can we recover the even part of g(x)? Suppose you are given f(x). You are now told that 1-f(x) == g(x) + g(-x). Since you now should understand that g(x) is uniquely determined down to only the even part of g(x), we need to understand that for ANY even function g(x), it has the property that
g(x) == g(-x)
Therefore we can conclude, that for an EVEN function g(x),
g(x) + g(-x) == 2*g(x)
So we can rewrite the problem as
1 - f(x) = 2*g(x)
Solve for g(x) now by dividing by 2. And therefore the complete solution is just:
g(x) = (1 - f(x))/2 + g_odd(x)
where g_odd(x) is ANY odd function. g(x) will not be unique.
The above solution will apply ONLY for EVEN functions f. That is, a non-zero solution will exist ONLY if the function f(x) is itself an even function.
Consider a second problem, where f(x)=x is given. Now we have
1 - x = g(x) + g(-x)
Now, you should recognize that for ANY function g(x) of the form g(x)=a*x, we would find that
a*x + a*(-x) == 0
In fact, we can conclude if the function f(x) has ANY odd component in the function, then it cannot be matched in g(x). There will never be a solution then.
Ok, all of the above makes sense. But suppose someone has given you some function f(x) that has some even, and some odd components? What is the closest even function g(x)? For example, f(x)=exp(x)? First, we accept that we need to find the even part of f(x). This can be obtained as
feven(x) = (f(x) + f(-x))/2
and of course,
fodd = (f(x) - f(-x))/2
So we can decompose any function into a sum of its even and odd components. The even part of 1-exp(x) is just
(1 - exp(x)) + (1 - exp(-x)) = (2 - exp(x) - exp(-x))/2 = 1 - cosh(x)
The last part is just the definiition of the hyperbolic cosine function. It would then provide the closest solution we can find to the problem, where f(x)=exp(x) is neither an even or an odd function.

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by