## Description

Sage can be used to solve nonlinear systems of equations. We will be solving the system

(1)## Sage Cell

#### Code

```
var('p q y')
eq1 = p+q == 9
eq2 = q*y + p*x == -6
eq3 = q*y^2 + p*x^2 == 24
eq4 = p == 1
solve( [eq1, eq2, eq3, eq4], p, q, x, y )
```

## Options

#### Option

Separating the solutions

Sage stores the solutions in an array. By assigning that array to a variable, you can display specific elements in the array. Note that an array index of size `n` starts at `0` and ends at `n - 1`. Here, we store the solutions in an array called `answer` and use `answer[0]` to display the first solution in the array. To get the other solution, try replacing `answer[0]` with `answer[1]`.

#### Code

```
var('p q y')
eq1 = p+q == 9
eq2 = q*y + p*x == -6
eq3 = q*y^2 + p*x^2 == 24
eq4 = p == 1
answer = solve( [eq1, eq2, eq3, eq4], p, q, x, y )
answer[0]
```

## 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: Gregory V. Bard. *Sage for Undergraduates.* American Mathematical Society, Providence, RI, 2015. Available at http://www.gregorybard.com/Sage.html.

Date: 25 Feb 2019 20:38

Submitted by: Zane Corbiere