{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of finite precision"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us evaluate\n",
"$$\n",
"y = x^3 - 3 x^2 + 3 x - 1\n",
"$$\n",
"in single precision. Note that it can also be written as \n",
"$$\n",
"y = (x-1)^3\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'svg'\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We evaluate in the interval $[0.99,1.01]$."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"