Book Image

Sage Beginner's Guide

By : Craig Finch
1 (1)
Book Image

Sage Beginner's Guide

1 (1)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – working with LaTeX markup in the notebook interface


Enter the following into an input cell in the worksheet:

var('n, x, t')
J_n(n, x) = 1 / pi * integral(cos(n * t - x * sin(t)), t, 0, pi)
latex(J_n)

You will get a string of LaTeX mark-up that represents the object J_n:

\left( n, x \right) \ {\mapsto} \ \frac{\int_{0}^{\pi} \cos\left(-n t + x \sin\left(t\right)\right)\,{d t}}{\pi}

You can paste this text directly into an existing LaTeX document. This function will also work on the Sage command line.

You can also use the notebook interface to evaluate LaTeX expressions. Enter this into an input cell (you can copy and paste the markup for the mathematical expression from the previous example):

%latex
You can paste LaTeX markup directly into a cell:
\[
\left( n, x \right) \ {\mapsto} \ \frac{\int \cos\left(-n t + x \sin\left(t\right)\right)\,{d t}}{\pi}
\]
You can also put expressions like \(y=x^3\) inline.

The result should be:

Another neat trick is that we can actually embed...