필터 지우기
필터 지우기

Partial sums of symbolic series?

조회 수: 1 (최근 30일)
Alasdair McAndrew
Alasdair McAndrew 2016년 10월 13일
댓글: Alasdair McAndrew 2016년 10월 14일
I am just beginning to explore the symbolic math toolbox. And I can't work out how to create a sequence of symbolic partial sums. Suppose I enter, for example:
syms t
T = taylor(exp(sin(t),t,'Order',12)
c = children(T)
The answer has the constant term at the end, instead of the start, so that
cumsum(c)
is not correct. I can write a little program to list all the partial sums:
V = []
for n=1:12
V = [V,taylor(exp(sin(t),t,'Order',n)];
end
but that seems very clumsy. Is there a better, more canonic way to do this?
Finally, with the array V above, if I display V, it's done using abbreviations, so that terms aren't repeated. How can I display V simply, in full?

답변 (2개)

Walter Roberson
Walter Roberson 2016년 10월 13일
cumsum([c(end), c(1:end-1)])
However, remember that the order of terms is not documented, so relying on children() to return them in sorted order is not robust. To get sorted order you should be looking at coeffs()

Alasdair McAndrew
Alasdair McAndrew 2016년 10월 13일
Thank you - yes I know that the vector I gave can be re-ordered, but in general it would be nice if "children" (at least when applied to polynomials) could give its results in lexicographic order of powers of the variables.
So I guess it's back to "coeffs", as you say:
T = taylor(exp(sin(x),x,'Order',12)
[c,p] = coeffs(T,x)
terms = fliplr(c.*p)
cumsum(terms)
Thanks again for the heads up!
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 10월 13일
Remember too that it is common for either odd or even powers in taylor to be 0, so the cumulative sum there should reflect the 0 terms. That would correspond to using the 'All' parameter of coeffs.
Alasdair McAndrew
Alasdair McAndrew 2016년 10월 14일
Good call! - yes, that would be a must.
Thanks again.

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

카테고리

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