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

1 visualización (últimos 30 días)
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 comentarios
John D'Errico
John D'Errico el 28 de Nov. de 2021
Editada: John D'Errico el 28 de Nov. de 2021
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 el 30 de Nov. de 2021
Editada: John D'Errico el 30 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 28 de Nov. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by