how do i fix this code? (finding convergence of divergence)

2 ビュー (過去 30 日間)
Ann Lee
Ann Lee 2022 年 4 月 10 日
コメント済み: Torsten 2022 年 4 月 10 日
hello!
cube=@(n)(factorial(n))/(n.^n);
this series is divergence over n being over 170.
and i want to make this series being converges when n being over 1000.
to make converges,
i want to conversion of expression to 'exp(ln(f(x))) = f(x)' (then it will work n being over 170..)
so i want to print when n= 170~1000, this series( 'exp(ln(f(n))) = f(n)' )'s sum and
find the result of sum is converges? or divergence?
and print sum of series's graph
how can i fix this code?
I would appreciate it if you could tell me what I can type in the commander window to see the graph.
function A=work5(x)
m=1;
y = 170:50:1000;
for k = y
n=1:k;
f(n)= sum(exp(ln(f(n))));
A(1,m)=f(n);
m=m+1;
end
fprintf('k-sum\t\t%-10s\n','series a)','C or D');
fprintf('%-d-sum\t\t%13.10f\t%13.10f\t%13.10f\n',[y; A]);
end

採用された回答

Torsten
Torsten 2022 年 4 月 10 日
cube = @(n)prod((1:n)/n);
  2 件のコメント
Ann Lee
Ann Lee 2022 年 4 月 10 日
what should i change my code to 'cube = @(n)prod((1:n)/n);'?
Torsten
Torsten 2022 年 4 月 10 日
I don't understand what you mean.
If you want to calculate n! / n^n for a certain value of n, you can do
result = cube(n)
if you defined
cube = @(n) prod((1:n)/n);
before.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by