[sage-support] Re: How to convert a symbolic expression to a multivariate polynomial efficiently?

2013-02-24 Thread marco nijmeijer
Thank you. This is indeed useful. To summarize I am now doing something like R.=SR[] K.=R[] f = K(a*p1+p2) which is fast also when the expression a*p1+p2 becomes very lengthy. It leaves me with the problem that f is no longer an expression of the original type P (P.=SR[]) which seems to cause

[sage-support] How to convert a symbolic expression to a multivariate polynomial efficiently?

2013-02-23 Thread marco nijmeijer
Suppose I have a symbolic expression f( t1, t2) which can be interpreted as a multivariate polynomial in t1 and t2., e.g. a = var('a') f(t1,t2) = a*t1+t2 To make this clear to Sage I say P.=PolynomialRing(SR) g = f.polynomial(QQ).subs(t1=p1,t2=p2) This works but becomes very slow when the sy

[sage-support] Performance bottleneck when turning symbolic expression into polynomial ring

2013-02-16 Thread marco nijmeijer
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.=PowerSeriesRing(SR) P.=PolynomialRing(SR) order = 6 f= x+C2*x^2+C3*x^3+C4*x^4+C5*x^5+C6*x^6+C

[sage-support] Leading order of a polynomial

2013-01-19 Thread marco nijmeijer
Suppose I have a polynomial p like R.=PolynomialRing(SR) p= x^3+x^4+x^5 Its leading order is 3 and its degree is 5. I know how to get the degree: p.degree() and I assume there is something equally simple to get the leading order. I can't find it though. Thank you for any assistence. -- You re

[sage-support] Re: Converting a symbolic expression to a power series and substituting another power series

2013-01-17 Thread marco nijmeijer
> > Thank you, that takes me a step further. If I formulate the solution for > my self I would say: take the symbolic expression, turn it into a > polynomial by the method 'polynomial', then turn it into a power series by > the proper substitution. That solves my original problem. It is nice t

[sage-support] Re: Converting a symbolic expression to a power series and substituting another power series

2013-01-14 Thread marco nijmeijer
Thank you. That is a good point although I still do not see how it solves the issue. Suppose I define f_symb as f_symb(t1,t2)=t1*t2 to avoid the confusion of using identical variable-names meaning different things, what would I have to do to convert f_symb to f such that I can do the substit

[sage-support] Converting a symbolic expression to a power series and substituting another power series

2013-01-14 Thread marco nijmeijer
Hello, I am quite new to Sage. I have a science background but am a stranger to rings, fields and other advanced mathematical topics which seem central in working with Sage. Having struggled with the issue below for quite a while though, I decided to post it. I have a power series f in x1 and x