substitution into a rational function

21 views
Skip to first unread message

John Cremona

unread,
Aug 19, 2016, 5:03:50 AM8/19/16
to SAGE support
Am I missing something here?

sage: F.<p> = FunctionField(QQ)
sage: f = F.random_element()
sage: f
(-p^2 + 5*p)/(-2/9*p^2 + 54)
sage: f.subs({p:3})
(-p^2 + 5*p)/(-2/9*p^2 + 54)

I have an element f of a rational function field F in one variable and
want to "evaluate" it at a value of the variable (which I know will
not be a pole). The documentation for f.subs? suggests that the above
is the right way to do this. However looking at the code f.subs??
shows that unless f has a __cal__ method then it does nothing, and
that is what is happening here.

I can see why adding the __call__ method to a rational function might
be problematical since in general there will be poles, but there must
be some way of substituting p=3 into a rational function! All I can
do is


sage: f.numerator()(3)/f.denominator()(3)
3/26

John
Reply all
Reply to author
Forward
0 new messages