逆関数が見つかりません

13 views (last 30 days)
Fumiaki Kishino
Fumiaki Kishino on 26 Jul 2022
Commented: Naoya on 3 Apr 2025
f(x) = x - cos(x)の逆関数を計算しようとしています。
逆関数自体は存在しますが、finverseでは計算できないようです。
最終的な目的は、あるxに対してg(x)の値を得ることなので、
gが式として表されなくても構わないのですが、どのようにしたら良いでしょうか。
syms x
f(x) = x - cos(x);
g = finverse(f,x);
Warning: Unable to find functional inverse.
g
g(x) = Empty sym: 0-by-1
  2 Comments
Fumiaki Kishino
Fumiaki Kishino on 28 Jul 2022
追記:
暫定的に、fminsearchで処理する方法を試しています。
より簡便な方法や、別の方法をご存知の方がおられましたら、ご教示ください。
function y = func1(x)
y = x - cos(x);
end
function z = inv_func1(y)
cost_function = @(x) (func1(x) - y)^2;
z = fminsearch(cost_function,0);
end
Naoya
Naoya on 3 Apr 2025
今回の関数f(x) の逆関数g(x) を数式レベルで求めるのは難しいようです。
ご提示の fminsearchによる算出の他、以下のように vpasolveで求める方法もあります。
clear all, close all
% 関数 f(x) の定義
syms x
f(x) = x - cos(x);
% f(x) の逆関数 g(x) の定義
g = @(X) double(vpasolve(f==X));
% x = 1~10 において g(x)の出力を求める
xi = 1:0.1:10;
for n = 1:length(xi)
y(n) = g(xi(n));
end
% 関数 f(x), g(x) を確認
fplot(f,[1,10])
hold on
plot(xi, y)
plot(1:10)
legend({'f(x)','g(x)','y=x'})

Sign in to comment.

Answers (0)

Categories

Find more on 数学 in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!