Partial sums of symbolic series?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (2)
Walter Roberson
am 13 Okt. 2016
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()
0 Kommentare
Alasdair McAndrew
am 13 Okt. 2016
2 Kommentare
Walter Roberson
am 13 Okt. 2016
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.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!