{ "cells": [ { "cell_type": "markdown", "metadata": { "toc": "true" }, "source": [ "# Table of Contents\n", "
"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import math,sys,os,numpy as np\n",
"from numpy.random import random\n",
"from matplotlib import pyplot as plt, rcParams, animation, rc\n",
"from __future__ import print_function, division\n",
"from ipywidgets import interact, interactive, fixed\n",
"from ipywidgets.widgets import *\n",
"rc('animation', html='html5')\n",
"rcParams['figure.figsize'] = 3, 3\n",
"%precision 4\n",
"np.set_printoptions(precision=4, linewidth=100)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def lin(a,b,x): return a*x+b"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"a=3.\n",
"b=8."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"n=30\n",
"x = random(n)\n",
"y = lin(a,b,x)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0.2764, 0.3057, 0.4897, 0.787 , 0.6627, 0.6034, 0.3722, 0.1886, 0.4145, 0.6801,\n",
" 0.5178, 0.4675, 0.3708, 0.9557, 0.1604, 0.4065, 0.8752, 0.6775, 0.1818, 0.2346,\n",
" 0.591 , 0.9049, 0.9551, 0.3547, 0.7319, 0.5636, 0.7542, 0.7464, 0.2111, 0.1858])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 8.8293, 8.9171, 9.4692, 10.3611, 9.9881, 9.8102, 9.1167, 8.5659, 9.2436,\n",
" 10.0403, 9.5534, 9.4025, 9.1125, 10.8671, 8.4813, 9.2196, 10.6257, 10.0326,\n",
" 8.5453, 8.7038, 9.7731, 10.7148, 10.8654, 9.064 , 10.1956, 9.6907, 10.2627,\n",
" 10.2393, 8.6334, 8.5573])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"