Ask Your Question
17

Hidden features of Sage

asked 2013-04-29 01:09:50 +0100

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.

edit retag flag offensive close merge delete

15 Answers

Sort by » oldest newest most voted
1

answered 2013-06-03 03:09:57 +0100

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.

edit flag offensive delete link more
1

answered 2013-04-29 05:13:24 +0100

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

edit flag offensive delete link more
1

answered 2013-04-29 01:49:56 +0100

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.

edit flag offensive delete link more
1

answered 2017-03-20 16:55:50 +0100

tmonteil gravatar image

updated 2017-03-20 16:56:00 +0100

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']
edit flag offensive delete link more

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 ( 2017-03-20 16:57:32 +0100 )edit
1

answered 2013-04-29 01:48:17 +0100

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.

edit flag offensive delete link more

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 ( 2013-04-29 02:06:38 +0100 )edit

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: 2013-04-29 01:09:50 +0100

Seen: 4,153 times

Last updated: Oct 15 '20