필터 지우기
필터 지우기

Why is symsum operator giving me this answer?

조회 수: 1 (최근 30일)
Baldemy
Baldemy 2014년 9월 22일
댓글: Star Strider 2014년 9월 22일
I am trying to find the sum of a series that goes like 20.^-20+19.^-19+...+1.^-1 Why is the answer such a massive number and why doesn't the formatting command work?
>> syms k
>> format shorteng
>> symsum(k.^(-1.*k),1,20)
ans =
32704926622076322328309250821720456282760440107801920978264646490630691318184399029563038640802578744801153948761512969045499776815021/25327407480969699779230080718754457246512673155164240823229977202846792179169322076528314293406963808740247706009600000000000000000000

채택된 답변

Star Strider
Star Strider 2014년 9월 22일
The Symbolic Math Toolbox has its own way of formatting numbers: the vpa function:
syms k
S = symsum(k.^(-1.*k),1,20);
S = vpa(S, 5)
produces:
S =
1.2913
You can of course set the number of digits to whatever you want.
Also see the digits and double functions.
  댓글 수: 4
Baldemy
Baldemy 2014년 9월 22일
Ok great I didn't see the "/" thanks a ton.
Star Strider
Star Strider 2014년 9월 22일
My pleasure!
I didn’t see it either at first, the reason I used numden for the clarification.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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