So I tried to write on the screen symsum results, but one of them got a little bit wrong position

1 次查看(过去 30 天)
syms n
%a
fprintf('a) %f\n',symsum((n+3^n)^(-1),n,1,2021))
%b
fprintf('b) %f\n',symsum((2*n+1)^n/n^(2*n),n,1,2021))
%c
fprintf('c) %f\n',symsum(n^2*exp(-n),n,1,2021))
%d
fprintf('d) %f\n',symsum(n^2*exp(-n^3),n,1,2021))
The 'b)' should be like others , but it was not
  2 个评论
John D'Errico
John D'Errico 2021-11-28
编辑:John D'Errico 2021-11-28
Note that when you post only a picture of your code, then for us to correct it, we need to write your code ourselves, by copying by eye what you wrote. This is tedious. (It also risks a possibility that what you wrote had an unprintable character in line b.) It tends to make some of us less likely to try to help you. And that means it will take longer for you to get an answer. Is there a good reason why you want to make it more difficult to gain help for your question? This is especially true, since you could have included your code as text more easily than inserting a picture.
John D'Errico
John D'Errico 2021-11-30
编辑:John D'Errico 2021-11-30
When I paste your exact code into MATLAB, here is what I see:
>> syms n
%a
fprintf('a) %f\n',symsum((n+3^n)^(-1),n,1,2021))
%b
fprintf('b) %f\n',symsum((2*n+1)^n/n^(2*n),n,1,2021))
%c
fprintf('c) %f\n',symsum(n^2*exp(-n),n,1,2021))
%d
fprintf('d) %f\n',symsum(n^2*exp(-n^3),n,1,2021))
a) 0.392084
b) 5.152109
c) 1.992295
d) 0.369221
Is the b result on another line? NO.
So whatever you did to create that result from the picture, we cannot reproduce it. Even you cannot reproduce it.
Are you using an old version of MATLAB? Perhaps, but then you should have said so if that was the case.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2021-11-28
syms n
fprintf('a) %f\n',symsum((n+3^n)^-1,n,1,2021))
a) 0.392084
fprintf('b) %f\n',symsum((2*n+1)^n/n^(2*n),n,1,2021))
b) 5.152109
fprintf('c) %f\n',symsum(n^2*exp(-n^3),n,1,2021))
c) 0.369221
It seems to work just fine.

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by