How to calculate arithmetic series?

조회 수: 4 (최근 30일)
Susi D
Susi D 2011년 11월 20일
Hi, I am new to mathlab. I want to evaluate an array and don't know how to do it with mathlab. Here are the two of the examples: n Sigmma notation i = i=1
n Signma notation i^2= i=1
Note: sigma notation means sums
Thanks. Susi
  댓글 수: 2
Jan
Jan 2011년 11월 20일
@Susi: The program is called "Matlab". To be exact, the manufacturer prefers MATLAB.
If your mean "sum", I think the term "sum" is better than "sigma notation". It is not clear what "n Sigma notation i=i=1" means. Can you explain this again?
Grzegorz Knor
Grzegorz Knor 2011년 11월 21일
@Susi,look at symsum:
http://www.mathworks.com/help/toolbox/symbolic/symsum.html

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

채택된 답변

David Young
David Young 2011년 11월 21일
Does your first example look like this:
n
SUM i
i=1
and your second example look like this:
n
SUM i^2
i=1
where I'm using SUM to stand for a capital sigma symbol?
If so, you would evaluate them in MATLAB like this:
n = 100; % set n to whatever value you need
i_vector = 1:n;
s1 = sum(i_vector);
s2 = sum(i_vector.^2);
To understand these examples, it's essential to look up the colon ( : ) operator in the introductory documentation or your textbook, as it's at the core of how this kind of operation is usually done. Also look at the documentation for the sum function, and for the .^ operator.
  댓글 수: 1
Jan
Jan 2011년 11월 21일
The elements of arithmetic series have a constant difference. Therefore (i_vector.^2) is not an arithmetic series.
"sum(1:n)" and "sum((1:n).^2" can be calculated without creating "1:n" explicitely, which is much cheaper for large n.

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

추가 답변 (2개)

Susi D
Susi D 2011년 11월 22일
Hi Guys, Thanks for your input=)You have been a great help. Yes, David, those are what I meant: n SUM i i=1
and
n SUM i^2 i=1
And Jan, hmmm....ya....I just remembered that arithmetic series shouldn't have ^2 =)
Best Regards =) Susi D

Susi D
Susi D 2011년 11월 22일
Opps sorry, I don't know why my typing became a mess when it was posted.
So, yes, I meant:
n
SUM i
i=1
and
n
SUM i^2
i=1

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by