how to calculate Somme of vector elements ?
조회 수: 59 (최근 30일)
이전 댓글 표시
i would like to calculate the somme k=1:10^5 of 1/k^2,using the command sum, can anyone help me ?
댓글 수: 0
채택된 답변
madhan ravi
2018년 10월 21일
편집: madhan ravi
2018년 10월 21일
k=1:10.^5;
sum(1./(k.^2))
댓글 수: 6
Bruno Luong
2018년 10월 28일
편집: Bruno Luong
2018년 10월 28일
"is there any method to verify the obtained result ?"
s = sum(1./(k.^2))
s / (pi^2/6)
That gives
s =
1.6449
ans =
1.0000
Seems alright to me.
추가 답변 (1개)
mohamed
2024년 3월 28일

I need instructions that I write in MATLAB, to give me the result of this sum
댓글 수: 2
mohamed
2024년 3월 29일
Thanks dude, just forgot to mention that "x" changes from 0 to 2, and t is the time
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!