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

4 views (last 30 days)
Nguyen Van Hau on 28 Nov 2021
Edited: John D'Errico on 30 Nov 2021
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
John D'Errico on 30 Nov 2021
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.

John D'Errico on 28 Nov 2021
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.