You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"This snippit was written by [Chris R. Albon](http://www.chrisralbon.com/) and is part of his collection of [well-documented Python snippits](https://github.com/chrisalbon/code_py). All code is written in Python 3 in iPython notebook and offered under the [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).\n",
18
+
"\n",
19
+
"Based on: SciPy And NumPy"
20
+
]
21
+
},
22
+
{
23
+
"cell_type": "markdown",
24
+
"metadata": {},
25
+
"source": [
26
+
"### Import modules"
27
+
]
28
+
},
29
+
{
30
+
"cell_type": "code",
31
+
"collapsed": false,
32
+
"input": [
33
+
"import numpy as np\n",
34
+
"from scipy.optimize import curve_fit"
35
+
],
36
+
"language": "python",
37
+
"metadata": {},
38
+
"outputs": [],
39
+
"prompt_number": 3
40
+
},
41
+
{
42
+
"cell_type": "markdown",
43
+
"metadata": {},
44
+
"source": [
45
+
"### Creating some clean data"
46
+
]
47
+
},
48
+
{
49
+
"cell_type": "code",
50
+
"collapsed": false,
51
+
"input": [
52
+
"# create a function called func(),\n",
53
+
"def func(x, a, b):\n",
54
+
" # that multiplies a and x, then adds b\n",
55
+
" return a * x + b"
56
+
],
57
+
"language": "python",
58
+
"metadata": {},
59
+
"outputs": [],
60
+
"prompt_number": 7
61
+
},
62
+
{
63
+
"cell_type": "code",
64
+
"collapsed": false,
65
+
"input": [
66
+
"# create 100 elements, evenly spaced between 0 and 10\n",
0 commit comments