formatting fractions involving square roots

asked 9 years ago

updated 7 years ago

How can I tell sage that I want the result to be shown as 13 rather than 133 when I type show(1/sqrt(3))?

Preview: (hide)

Comments

1

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

ndomes gravatar imagendomes ( 7 years ago )

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 https://ask.sagemath.org/question/757..., which makes this question a duplicate.

Björn gravatar imageBjörn ( 7 years ago )
1

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

ndomes gravatar imagendomes ( 7 years ago )