Within an IPython session this can be achieved with `sympy.interactive
.session.enable_automatic_int_sympification(*shell*)`. See the 
documentation: 
https://docs.sympy.org/latest/modules/interactive.html#module-sympy.interactive.

An alternative is to use Algebra_with_Sympy 
<https://gutow.github.io/Algebra_with_Sympy/>, which defaults to your 
desired behavior, but has a relatively simple way to turn the feature on 
and off.

I think these provide the behavior you looking for.

On Thursday, October 26, 2023 at 9:16:53 PM UTC-5 sonn...@gmail.com wrote:

> In this simple string below, the result is a decimal. I have fooled a lot 
> with the documentation but cannot see how to get my output as fractions 
> instead of decimals. (In fact I thought a CAS would default to this). 
> What is the simplest way to stop the 1-1/4 rendering to 1.25 (e.g. I want 
> 5/4 here)? A global setting would be nice if one exists!
>
> Thanks
> Fritz
>
> P=(m*w)*(m*w)**(1/4)
> x = collect(P,m*w)
> print("P is:    " + str(x))
>
> P is:    (m*w)**1.25
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/e18665b9-28d4-4c8f-9308-f0ac36cdac36n%40googlegroups.com.

Reply via email to