As I’ve mention before, actually I’m dealing with some messy supergravity calculations. 😛 Unlike most of my colleges, I don’t use Mathematica but their open source SAGE (applauses).

# Declaring (weird) Variables

Through the calculations I should care about 10 dimensions, with a 5 dimensional restriction parametrized by five different angles, which I call … thus, naturally the question of whether a variable can be declared in a way s.t., when using the function **show** for printing the results, the latex equivalent to my expression is shown, appears!

The answer came a few minutes ago! Thanks to **Niels Bruin** via sage-devel google group. 😉

`sage: var("bps", latex_name=r"\hat{\psi}")`

bps

sage: expr = sin(bps)

sage: show(expr)

returns . 😀

Really neat!!!

# Adding equations in the text

Recently I re-discover the “office”-like functionality of sage notebook. Have you notice the thin blue line that appears when the cursor is about to reach the calculation window by above?

If you click on the blue line, an intermediate calculation line will appear. Whilst, if you click on the line while holding the Shift key, a sort of office suite environment is opened!!!

There you can write in a LibreOffice style!!!

That’s not all. **Jason Grout** has pointed out to me that one can insert LaTeX equations in this environment just by using the dollar-dollar ($ <your code> $) for inline equations, or doubledollar-doubledollar ($$ <your code> $$) for centered-nonumbered equations.

Fabulous, Isn’t it?!

That’s all for now! 😉

Enjoy.

DOX

on February 14, 2011 at 4:50 pm |SAGE tip: Working with Differential Forms. « Doxdrum's Blog[…] a previous post a weird declaration of variables has been […]

on May 24, 2013 at 6:02 pm |CouperinCool! After declaring variables, is it possible to enter a whole equation, as written in LaTeX, into sage?

on May 24, 2013 at 6:17 pm |CouperinI mean, if I declare the variables a and b, define c=a/b and write latex(c), I have the output \frac{a}{b}. I wonder if it’s possible to implement the inverse operation, i.e, enter \frac{a}{b} and have sage interpreting it as a/b so I can perform calculations.

on June 28, 2013 at 6:49 am |pepHi, nice post.

Just to correct that sage is not Wolfram opensource version of mathematica..

It’s a voluntary project initiated by William Stein.

Cheers