Find the value x

3 ビュー (過去 30 日間)
Pichaya Thochampa
Pichaya Thochampa 2020 年 8 月 17 日
編集済み: Matt J 2020 年 8 月 19 日
y = x ^ e - e ^ x is [0 5] when x^e=e^x

採用された回答

Matt J
Matt J 2020 年 8 月 17 日
編集済み: Matt J 2020 年 8 月 17 日
>> [x,fval]=fminbnd(@(x) abs(exp(x)-x^exp(1)),0,5)
x =
2.7183
fval =
4.4743e-11
  4 件のコメント
Pichaya Thochampa
Pichaya Thochampa 2020 年 8 月 19 日
編集済み: Bruno Luong 2020 年 8 月 19 日
Excuse me, ask me why. When issuing a command of a program that is
>> x = fminbnd (@ (x) (x ^ (exp (1)) - (exp (1) ^ x)), 0,5)
to get the answer 1.0000, but when using
>> x = fminbnd (@ (x) ((exp (1) ^ x) -x ^ exp (1)), 0,5)
is only 2.7183.
Matt J
Matt J 2020 年 8 月 19 日
編集済み: Matt J 2020 年 8 月 19 日
Because the first version has a local minimum at x=1. (Note: fminbnd may find a local, rather than a global minimum).
fplot(@ (x) (x ^ (exp (1)) - (exp (1) ^ x)), [0,5]);
whereas the second version has a minimum at x=exp(1).
fplot(@ (x) ((exp (1) ^ x) -x ^ exp (1)), [0,5])

サインインしてコメントする。

その他の回答 (3 件)

hosein Javan
hosein Javan 2020 年 8 月 17 日
編集済み: hosein Javan 2020 年 8 月 17 日
you can rewrite the equation in the form of "x^(1/x) = exp(1/exp(1))". this means that if "f(z)=z^(1/z)" then we have "f(x) = f(exp(1))". giving an inverse function, then it is "x=exp(1)".
syms x
f(x) = x^(1/x) - exp(1/exp(1));
x_ex = solve(f(x),x) % exact value
x_app = vpa(x_ex) % approximation
err_f = subs(f(x),x,x_app) % error
x_ex =
lambertw(0, 51*log(2) - log(3253102820258857))/(51*log(2) - log(3253102820258857))
x_app =
2.7182817878772095927811977987387
err_x =
2.9387358770557187699218413430556e-39
x = 0:0.001:5;
y = x.^exp(1) - exp(x);
plot(x,y)
  2 件のコメント
Pichaya Thochampa
Pichaya Thochampa 2020 年 8 月 17 日
Thank you so much:)
hosein Javan
hosein Javan 2020 年 8 月 17 日
don't mention it.

サインインしてコメントする。


KSSV
KSSV 2020 年 8 月 17 日
The value of x would be e i.e exp(1). Check the below:
x = linspace(0,5,10^6) ; % as you said x lies in [0 5]
f = x.^exp(1)-exp(x) ;
[val,idx] = min(abs(f)) ; % pick the value for which f is minimum i.e f = 0
x0 = x(idx) ; % the value of x
f = x0^exp(1)-exp(x0) % check
  1 件のコメント
Pichaya Thochampa
Pichaya Thochampa 2020 年 8 月 17 日
Thank you so much:)

サインインしてコメントする。


Matt J
Matt J 2020 年 8 月 17 日

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by