Hi Urs,

On 21 Okt., 11:35, Urs Hackstein <[email protected]> wrote:
> Well, the definition of f contains a lot of symbolic variables, so that
> might be the problem. I don't define f at once, but succesively. Starting
> with the fraction
>
> T12*T22*Z21*Z22/T1*T2*Z21+T1*T2*Z22,
>
> I replace successively all symbolic variables by expressions with new
> siymbolic variables, so that f grows larger and larger.

So, in a nutshell, you do things like

  sage: var('T1 T2')
  (T1, T2)
  sage: P.<s> = CC[]
  sage: q = T1/T2
  sage: p = q.subs(T1=1,T2=s)
  sage: p.parent()
  Symbolic Ring

Not good. I would have expected it to end up in the quotient ring of
P. Also, it won't help to define q as a symbolic function and evaluate
T1 and T2:

  sage: q(T1,T2) = T1/T2
  sage: p = q(T1=1,T2=s)
  sage: p.parent()
  Symbolic Ring

Of course, as Maarten has pointed out, you can explicitly cast p into
the fraction field of P:
  sage: F = Frac(P)
  sage: F(p).parent()
  Fraction Field of Univariate Polynomial Ring in s over Complex Field
with 53 bits of precision
  sage: F(p)
  1.00000000000000/s

Or, which may both be easier and faster, you could define an actual
Python function that returns an arithmetic expression out of input
data T1,T2,T3,...:

  sage: def q(T1,T2):
  ....:     return T1/T2
  ....:
  sage: p = q(1,s)
  sage: p.parent()
  Fraction Field of Univariate Polynomial Ring in s over Complex Field
with 53 bits of precision

Best regards,
Simon

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to