Printing Latex

## Description

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

(1)
$$x^4 + x^3 + x^2 + x - 4 = 0$$

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])


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.