Ask Your Question
12

Hidden features of Sage

asked 2013-04-28 18:09:50 -0500

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

14 answers

Sort by » oldest newest most voted
1

answered 2013-04-28 22:13:24 -0500

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
0

answered 2013-04-28 18:49:56 -0500

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
0

answered 2017-03-20 10:55:50 -0500

tmonteil gravatar image

updated 2017-03-20 10:56:00 -0500

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 10:57:32 -0500 )edit
0

answered 2013-04-28 18:48:17 -0500

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-28 19:06:38 -0500 )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

1 follower

Stats

Asked: 2013-04-28 18:09:50 -0500

Seen: 1,624 times

Last updated: Mar 20 '17

Related questions