Also :

sage: import sympy
sage: ex._sympy_().subs({(5^x)._sympy_():t._sympy_()})._sage_()
t^2 - 7*t + 4

HTH,
​
Le mercredi 24 novembre 2021 à 17:20:10 UTC+1, Emmanuel Charpentier a 
écrit :

> FWIW :
>
> sage: var("x, t")
> (x, t)
> sage: maxima_calculus.ratsubst(t,5^x, ex).sage()
> t^2 - 7*t + 4
> sage: maxima_calculus.lratsubst([5^x==t], ex).sage()
> t^2 - 7*t + 4
>
> See also this ask.sagemath.org question 
> <https://ask.sagemath.org/question/59881/substitute-multiplication-of-sine-and-cosine-for-a-symbolic-function/>
> .
>
> I think that wrapping Maximas [l]ratsubst might be interesting…
> ​
> Le mardi 23 novembre 2021 à 20:42:12 UTC+1, juanlui...@gmail.com a écrit :
>
>> In the expression (5^x)^2-7*5^x+4, I want to substitute x^5 by t.
>>
>> With sagemath 7.2 (or another old versions), I can do
>> ((5^x)^2-7*5^x+4).subs(5^x==t)
>> and I get t^2 - 5*t + 4
>>
>> But sagemath 9.4 does not change the first 5^x and he gives
>> 5^(2*x) - 7*t + 4
>>
>> Why?
>>
>> (In both cases, var("t") has been previously used)
>>
>> Yours,
>>
>> Juan Luis Varona
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/8f1ee0c8-ecbe-4def-8980-b6cf112de8aan%40googlegroups.com.

Reply via email to