formatting fractions involving square roots

asked 2016-01-30 06:48:36 -0600

updated 2017-03-20 08:03:19 -0600

How can I tell sage that I want the result to be shown as $\frac{1}{\sqrt{3}}$ rather than $\frac13\sqrt3$ when I type show(1/sqrt(3))?

edit retag flag offensive close merge delete



Not really convenient but it gives the expected answer: show(sqrt(3).power(-1,hold=True)) .

ndomes gravatar imagendomes ( 2017-03-20 12:26:54 -0600 )edit

Thanks, that is at least something. While playing with this, I noticed that power? and power?? documentation does not mention the hold keyword at all.

Searching for hold=True I just found, which makes this question a duplicate.

Björn gravatar imageBjörn ( 2017-03-24 19:08:34 -0600 )edit

You have to look for power as a method of an expression, for example: x.power? or pi.power??

ndomes gravatar imagendomes ( 2017-03-25 18:33:58 -0600 )edit