Hi,

in the meantime I tried the variant with the Python function.
Unfortunately, if I choose p.denominator(), I receive an expression like

((9.5e-09)*(105263157.895/(x_1*s) + 50)*((1.49968e-05)/x_1 +
1/(((1.2e-11)*y_1 + 0.0191146666667*2^(1/5))*s) +
5263157894.74/((105263157.895/(x_1*s) + 50)*x_1*s) +
(315789473.684/(((1.68843903816e-10)*x_1/y_1 + 6e-13)*s) +
315789473.684)*((1/(((1.68843903816e-10)*x_1/y_1 + 6e-13)*s) +
1)*((1.49968e-05)/x_2 + 1/(((1.2e-11)*y_2 +
0.0191146666667*2^(1/5))*s)) + (1/(((1.68843903816e-10)*x_1/y_1 +
6e-13)*s) + 1)^2*(1/(((1.55147112222e-10)*x_2/y_2 + 6e-13)*s) +
1)^2*(3157.22105263/x_3 + 210526315.789/(((1.2e-11)*y_3 +
0.0191146666667*2^(1/5))*s))/((2/y_2 +
105263157.895/(x_3*s))*((1/(((1.68843903816e-10)*x_1/y_1 + 6e-13)*s) +
1)*(1/(((1.55147112222e-10)*x_2/y_2 + 6e-13)*s) + 1)*((1.49968e-05)/x_3
+ 1/(((1.2e-11)*y_3 + 0.0191146666667*2^(1/5))*s)) +
(210526315.789/(((1.68843903816e-10)*x_1/y_1 + 6e-13)*s) +
210526315.789)*(1/(((1.55147112222e-10)*x_2/y_2 + 6e-13)*s) +.................

where s is the variable of the polynomial ring and x_1, x_2, x_3, y_1,
y_2, y_3 are (symbolic) variables.

Best regards,

Urs

2011/10/21 Simon King <[email protected]>

> 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
>

-- 
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