Numerical Precision

## Description

Some mathematical expressions return ‘exact’ values, rather than numerical approximations. To get a numerical approximation, use either the function `n` or the method `n` (and both of these have a longer name, `numerical_approx`.

## Sage Cell

#### Code

```
a = sqrt(2)
a.n( )
```

## Options

#### Option

`n` takes the optional argument `digits`, which is the requested number of decimal digits of precision.

#### Code

`n` takes the optional argument `prec`, which is the requested number of bits of precision. The default is 53 bits of precision.

```
a = sqrt(2)
a.n(digits=30)
```

#### Option

#### Code

```
a = sqrt(2)
a.n(prec=30)
```

## Tags

Primary Tags: Programming:The Python language.

Secondary Tags: The Python language: Numeric operations.

## Related Cells

None

## Attribute

Permalink:

Author: Sage Tutorial v7.6

Date: 04 Jul 2017 14:38

Submitted by: Tom Judson