ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 19 Feb 2017 23:56:02 +0100Taylor Series With Order (Big O)https://ask.sagemath.org/question/36665/taylor-series-with-order-big-o/ I'm trying to replicate some Mathematica code, and I know very little about Mathematica and Sage.
The Mathematica code creates a Taylor series for f(x) about (x0), with degree 5. I was able to replicate that.
x, x0, dt = var('x, x0, dt')
f = function('f')
t = f(x).taylor(x, x0, 5)
Next it does a substitution.
k1 = f(x0)*dt
s = x0 + k1/2
k2 = t.subs(x=s)
The problem is it that it then removes the higher order terms using the big O notation.
k2 = Expand[g[x] \[CapitalDelta]t /. x -> s] + O[\[CapitalDelta]t]^5
It looks like this is available for series and polynomial rings (no clue what those are) in SageMath, but I haven't figured out how to apply it to the Taylor series expansion.
Is there a way to truncate certain order terms off of an expression?
Is there a way to replicate the Taylor series expression I want with `.series()` or polynomial rings?
I tried importing `sage.rings.big_oh` and using `Order()` but neither seemed applicable to the expression I had. I also made half an attempt to recreate a Taylor series with `.series()` but didn't quite get what I was hoping for.
tq = 1/factorial(n)*f(x)*x^n
tq.series(n, 5)
Thanks for the help, both my math and SageMath skills are lacking.douggardSun, 19 Feb 2017 23:56:02 +0100https://ask.sagemath.org/question/36665/