On Wed, Aug 26, 2009 at 12:33 PM, Jaakko<[email protected]> wrote:
>
>
>
> On Aug 26, 7:59 pm, Simon King <[email protected]> wrote:
>> Hi Jaako,
>>
>> On Aug 26, 5:34 pm, William Stein <[email protected]> wrote:
>>
>> > Please give Sage code that creates such an expression, which anybody
>> > reading this can then trivially paste into their Sage session.
>>
>> I reckon, in the easiest case Jaako would like to have:
>>  Given 1/(sqrt(x) - 2),
>>  return (sqrt(x) + 2)/(x - 4)
>> and then the analogous game with, say:
>>  1/(3*x^(7/8) - x^(2/5) + x^(1/3))
>> --> some expression without root in the denominator.
>>
>> Is this what you had in mind?
> Yes.
>
> expr=1/(1+3^(1/2)+5^(1/4)+7^(1/6)+9^(1/8))

Fortunately, the above is much diferent than what Simon King wrote,
since you have numbers instead of a variable x.

If you leave off the 9 term here's a way to do it, where below
a=3^(1/2), b=5^(1/4), and c=7^(1/6).  With the 9 term included it
takes more than a few seconds, and I don't have the time to wait.

sage: K = QQ[3^(1/2),5^(1/4),7^(1/6)]
sage: K.<a,b,c> = QQ[3^(1/2),5^(1/4),7^(1/6)]
sage: s = 1/(1+a+b+c); s
((-521773463589/46270992182164*b^5 + 567545999611/46270992182164*b^4 -
232178150211/46270992182164*b^3 + 831808512285/46270992182164*b^2 -
1846515287525/46270992182164*b - 677493106341/46270992182164)*a^3 +
(62970295743/46270992182164*b^5 - 309485722619/23135496091082*b^4 +
621337948345/46270992182164*b^3 + 135412730781/23135496091082*b^2 +
2480827360991/46270992182164*b - 823881271577/23135496091082)*a^2 +
(-834458477199/46270992182164*b^5 + 762906781145/46270992182164*b^4 -
2065784857281/46270992182164*b^3 + 530835060855/46270992182164*b^2 -
351759752919/46270992182164*b + 4390961226193/46270992182164)*a +
885648925725/46270992182164*b^5 - 36422024114/11567748045541*b^4 +
1290097205427/46270992182164*b^3 - 782597967894/11567748045541*b^2 -
262015208459/46270992182164*b + 764046779589/11567748045541)*sqrt3 +
(-108742831765/46270992182164*b^5 + 141801797919/23135496091082*b^4 -
1220968310419/46270992182164*b^3 + 371940656839/23135496091082*b^2 +
43181032875/46270992182164*b + 2988834947309/23135496091082)*a^3 +
(695229813347/23135496091082*b^5 - 191318321063/11567748045541*b^4 +
586810723687/23135496091082*b^3 - 820621970852/11567748045541*b^2 -
240652532459/23135496091082*b - 795997688310/11567748045541)*a^2 +
(-814097229671/46270992182164*b^5 + 362141543148/11567748045541*b^4 +
244852590999/46270992182164*b^3 + 737829140910/11567748045541*b^2 -
3777186264815/46270992182164*b - 401484751039/11567748045541)*a +
467226622169/11567748045541*b^5 - 1991069553513/23135496091082*b^4 +
750296354301/11567748045541*b^3 - 383317740695/23135496091082*b^2 +
1609601131932/11567748045541*b - 2934132033363/23135496091082
sage: var('a,b,c')
(a, b, c)
sage: t = SR(str(s))
sage: t.subs({a:3^(1/2), b:5^(1/4), c:7^(1/6)})
-1/46270992182164*(3*(232178150211*5^(3/4) - 831808512285*sqrt(5) +
4455382605470*5^(1/4) - 2160236891714)*sqrt(3) +
(2065784857281*5^(3/4) - 530835060855*sqrt(5) + 4524052138914*5^(1/4)
- 8205495131918)*sqrt(3) - 3154111050462*5^(3/4) +
2317915486890*sqrt(5) - 12553265939284*5^(1/4) + 11900112671956)*sqrt3
+ 1/46270992182164*(244852590999*5^(3/4) + 2951316563640*sqrt(5) -
7847672413170*5^(1/4) + 5636891858804)*sqrt(3) -
3/46270992182164*(1220968310419*5^(3/4) - 743881313678*sqrt(5) +
500533125950*5^(1/4) - 7395687873808)*sqrt(3) +
3261024879663/23135496091082*5^(3/4) -
5307049565807/23135496091082*sqrt(5) +
8798979044191/11567748045541*5^(1/4) - 11702507781339/11567748045541

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to