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