In a study of the Secant algorithm I am looking for a series expansion of
the algorithm in the form of a polynomial as follows
C2, C3, C4, C5, C6, C7, C8, C9, C10= var('C2 C3 C4 C5 C6 C7 C8 C9 C10')
R.<x>=PowerSeriesRing(SR)
P.<p1,p2>=PolynomialRing(SR)
order = 6
f= x+C2*x^2+C3*x^3+C4*x^4+C5*x^5+C6*x^6+C7*x^7+C8*x^8+C9*x^9+C10*x^10+O(x^
order)
f_poly= f.polynomial()
time secantStep_symb(t1,t2) = t1 - f_poly(t1)*(t1-t2)/(f_poly(t1)-f_poly(t2
))
time secantStep_symb(t1,t2) = (secantStep_symb /(t1*t2)).taylor((t1,0),(t2,0
),order-1)
time secantStep_poly = secantStep_symb.polynomial(QQ)
time secantStep_poly = secantStep_poly.substitute(t1=p1,t2=p2)
time secantStep_poly = P(secantStep_poly)
This piece of code becomes very slow when "order" becomes large (it can run
up to 11 here). Surprisingly (to me) this is not because the Taylor
expansion becomes slow but because of the operation secantStep_poly.
substitute(t1=p1,t2=p2). The time for this operation grows from about 1s
for order=5, 4-5s for order=6, 14-15s for order=7, 40s for order=8, 75s for
order=9, 245s for order=10 etc. The question is whether there is a way
around this performance bottleneck.
Let me add that I start by defining the secant step as a symbolic
expression to be able to use the method taylor. It seems that a
multi-variate power series is not able to expand the expression because it
does not understand there is a factor (t1-t2) in both numerator and
denominator so they cancel against each other.
Any help is much appreciated.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.