Printing Latex

Description

Here, we will have sage print one of the solutions to the following quartic function as LaTeX input:

(1)
\begin{equation} x^4 + x^3 + x^2 + x - 4 = 0 \end{equation}

This is done using the latex() command.

Sage Cell

When we run the output through LaTeX, we get:

(2)
\begin{align} x = \frac{1}{3} \cdot 5^{\frac{1}{3}} {\left(3 \, \sqrt{3} \sqrt{2} - 7\right)}^{\frac{1}{3}} - \frac{5^{\frac{2}{3}}}{3 \, {\left(3 \, \sqrt{3} \sqrt{2} - 7\right)}^{\frac{1}{3}}} - \frac{2}{3} \end{align}

This is not perfectly simplified, of course, but it is far more readable than Sage's normal output, and easier to simplify by hand.

Code

f(x) = x^4 + x^3 + x^2 + x - 4
answers = solve(f(x) == 0, x)
latex(answers[2])

Options

none

Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

Attribute

Permalink:

Author:

Date: 07 Mar 2019 21:48

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License