Ask Your Question
17

Hidden features of Sage

asked 11 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

In the spirit of the StackOverflow threads of "hidden" language features, we can use this thread (community wiki) to aggregate useful but little-known features or tricks of Sage. Perhaps these can be collected and added to the documentation in the future.

Preview: (hide)

15 Answers

Sort by » oldest newest most voted
1

answered 11 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

You can clear the screen by simply entering clear, as in a Bash shell.

Preview: (hide)
link
1

answered 11 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Though is general for python, it is always worth reading: Code like a Pythonista

Preview: (hide)
link
1

answered 11 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Sébastien Labbé has a blog post with various Sage tricks.

Preview: (hide)
link
1

answered 8 years ago

tmonteil gravatar image

updated 8 years ago

The function get_systems from sage.misc.citation will tell you the backends used to evaluate some code. For example,

sage: from sage.misc.citation import get_systems
sage: get_systems('sqrt(x)') 
['MPFI', 'MPFR', 'GMP']
sage: get_systems('sqrt(3.4)')
['MPFR']
Preview: (hide)
link

Comments

Apparently, this question disapeared, i repost it though i was not its original author. Sorry for not making this answer an anonymous wiki as it should be. In the recent versions of askbot, only one answer per user is allowed, so i had to trick by first writing a comment, and then transform it into an answer, but that way i could not make it anonymous :(

tmonteil gravatar imagetmonteil ( 8 years ago )
1

answered 11 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

To preview LaTeX code from the command line, use the following:

show(LatexExpr(r'\frac{3}{4}x + 3'))

From the notebook,

html(r'$\frac{3}{4}x + 3$')

also works.

Preview: (hide)
link

Comments

1

By the way, it would be useful (if it doesn't already exist) to have a function to render LaTeX code to an image just large enough to fit the expression, for export to environments that do not support LaTeX (an HTML website, for example).

Eviatar Bach gravatar imageEviatar Bach ( 11 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 11 years ago

Seen: 4,429 times

Last updated: Oct 15 '20