Python 3.11.5 (main, Sep 11 2023, 08:31:25) [Clang 14.0.6 ]
Type "copyright", "credits" or "license" for more information.
IPython 8.15.0 -- An enhanced Interactive Python.
Restarting kernel...
In [1]: x = list(range(10))
In [2]: x
Out[2]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In [3]: x[0:10]
Out[3]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In [4]: x[0:5]
Out[4]: [0, 1, 2, 3, 4]
In [5]: x[:]
Out[5]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In [6]: x[0:10:2]
Out[6]: [0, 2, 4, 6, 8]
In [7]: x[-1:0:-1]
Out[7]: [9, 8, 7, 6, 5, 4, 3, 2, 1]
In [8]: x[::-1]
Out[8]: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
In [9]: runfile('/Users/py4cs/Desktop/mexhat-numpy.py', wdir='/Users/py4cs/Desktop')
error: 1.159820840535702e-15
Numpy version is 33.5 times faster
In [10]: import time
In [11]: time.time()
Out[11]: 1706087777.369557
In [12]: time.time()
Out[12]: 1706087779.302486
In [13]: starttime = time.time()
In [14]: stoptime = time.time()
In [15]: stoptime - starttime
Out[15]: 7.6271491050720215
In [16]: runfile('/Users/py4cs/Desktop/mexhat-numpy.py', wdir='/Users/py4cs/Desktop')
error: 1.159820840535702e-15
Numpy version is 74.3 times faster
In [17]: runfile('/Users/py4cs/Desktop/mexhat-numpy.py', wdir='/Users/py4cs/Desktop')
error: 1.159820840535702e-15
Numpy version is 74.5 times faster
In [18]: runfile('/Users/py4cs/Desktop/mexhat-numpy.py', wdir='/Users/py4cs/Desktop')
error: 1.159820840535702e-15
Numpy version is 56.4 times faster
In [19]: %timeit loop1()
39.7 ms ± 148 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
In [20]: %timeit loop2()
521 µs ± 18.6 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
In [21]: 39700/521
Out[21]: 76.1996161228407
In [22]: runfile('/Users/py4cs/Desktop/fifoqueue2.py', wdir='/Users/py4cs/Desktop')
In [23]: q1
Out[23]: ['Mary', 'Peter']
In [24]: q2
Out[24]: ['Paul']
In [25]: show(q1)
['Mary', 'Peter']
In [26]: show(q2)
['Paul']
In [27]: next_(q1)
Out[27]: 'Peter'
In [28]: show(q1)
['Mary']
In [29]: runfile('/Users/py4cs/Desktop/fifoqueue2.py', wdir='/Users/py4cs/Desktop')
In [30]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [31]: make_add42()
Out[31]: <function __main__.make_add42.<locals>.add42(x)>
In [32]: f = make_add42()
In [33]: f
Out[33]: <function __main__.make_add42.<locals>.add42(x)>
In [34]: f(10)
Out[34]: 52
In [35]: abs(-10)
Out[35]: 10
In [36]: abs
Out[36]: <function abs(x, /)>
In [37]: f(0)
Out[37]: 42
In [38]: g = make_add42()
In [39]: g
Out[39]: <function __main__.make_add42.<locals>.add42(x)>
In [40]: g(11)
Out[40]: 53
In [41]: make_add42()
Out[41]: <function __main__.make_add42.<locals>.add42(x)>
In [42]: make_add42()(10)
Out[42]: 52
In [43]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [44]: make_add_n(100)
Traceback (most recent call last):
Cell In[44], line 1
make_add_n(100)
File ~/Desktop/day8.py:12 in make_add_n
return add42
NameError: name 'add42' is not defined
In [45]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [46]: make_add_n(100)
Out[46]: <function __main__.make_add_n.<locals>.add_n(x)>
In [47]: h = make_add_n(100)
In [48]: h(10)
Out[48]: 110
In [49]: add100 = make_add_n(100)
In [50]: ad100(42)
Traceback (most recent call last):
Cell In[50], line 1
ad100(42)
NameError: name 'ad100' is not defined
In [51]: add100(42)
Out[51]: 142
In [52]: add0 = make_add_n(n=0)
In [53]: add0(x=2)
Out[53]: 2
In [54]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [55]: make_test(2, 0)
Out[55]: <function __main__.make_test.<locals>.add_n(x)>
In [56]: add0(x=3)
Out[56]: 3
In [57]: add0(4)
Out[57]: 4
In [58]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [59]: make_test(x=2, n=0)
Out[59]: <function __main__.make_test.<locals>.add_n()>
In [60]: ftest = make_test(x=2, n=0)
In [61]: ftest()
Out[61]: 2
In [62]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [63]: add_n_x(0, 2)
Out[63]: 4
In [64]: add_n_x(0, 3)
Out[64]: 6
In [65]: add_n_x(0, 4)
Out[65]: 8
In [66]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [67]: add_n_x(0, 4)
Out[67]: 4
In [68]: add_n_x(0, 3)
Out[68]: 3
In [69]: runfile('/Users/py4cs/Desktop/day8.py', wdir='/Users/py4cs/Desktop')
In [70]: add_n_x(2)
Out[70]: 2
In [71]: add_n_x(3)
Out[71]: 3
In [72]: add_n_x(3, n=10)
Out[72]: 13
In [73]: add_n_x(4, n=10)
Out[73]: 14
In [74]: add10 = make_add_n(10)
In [75]: add10(2)
Out[75]: 12
In [76]: add10(3)
Out[76]: 13
In [77]: add10(4)
Out[77]: 14
In [78]: add10
Out[78]: <function __main__.make_add_n.<locals>.add_n(x)>
In [79]: add0
Out[79]: <function __main__.make_add_n.<locals>.add_n(x)>
In [80]: import scipy
In [81]: help(scipy)
Help on package scipy:
NAME
scipy
DESCRIPTION
SciPy: A scientific computing package for Python
================================================
Documentation is available in the docstrings and
online at https://docs.scipy.org.
Contents
--------
SciPy imports all the functions from the NumPy namespace, and in
addition provides:
Subpackages
-----------
Using any of these subpackages requires an explicit import. For example,
``import scipy.cluster``.
::
cluster --- Vector Quantization / Kmeans
constants --- Physical and mathematical constants and units
datasets --- Dataset methods
fft --- Discrete Fourier transforms
fftpack --- Legacy discrete Fourier transforms
integrate --- Integration routines
interpolate --- Interpolation Tools
io --- Data input and output
linalg --- Linear algebra routines
misc --- Utilities that don't have another home.
ndimage --- N-D image package
odr --- Orthogonal Distance Regression
optimize --- Optimization Tools
signal --- Signal Processing Tools
sparse --- Sparse Matrices
spatial --- Spatial data structures and algorithms
special --- Special functions
stats --- Statistical Functions
Public API in the main SciPy namespace
--------------------------------------
::
__version__ --- SciPy version string
LowLevelCallable --- Low-level callback function
show_config --- Show scipy build configuration
test --- Run scipy unittests
PACKAGE CONTENTS
__config__
_distributor_init
_lib (package)
cluster (package)
conftest
constants (package)
datasets (package)
fft (package)
fftpack (package)
integrate (package)
interpolate (package)
io (package)
linalg (package)
misc (package)
ndimage (package)
odr (package)
optimize (package)
signal (package)
sparse (package)
spatial (package)
special (package)
stats (package)
version
CLASSES
builtins.tuple(builtins.object)
scipy._lib._ccallback.LowLevelCallable
class LowLevelCallable(builtins.tuple)
| LowLevelCallable(function, user_data=None, signature=None)
|
| Low-level callback function.
|
| Some functions in SciPy take as arguments callback functions, which
| can either be python callables or low-level compiled functions. Using
| compiled callback functions can improve performance somewhat by
| avoiding wrapping data in Python objects.
|
| Such low-level functions in SciPy are wrapped in `LowLevelCallable`
| objects, which can be constructed from function pointers obtained from
| ctypes, cffi, Cython, or contained in Python `PyCapsule` objects.
|
| .. seealso::
|
| Functions accepting low-level callables:
|
| `scipy.integrate.quad`, `scipy.ndimage.generic_filter`,
| `scipy.ndimage.generic_filter1d`, `scipy.ndimage.geometric_transform`
|
| Usage examples:
|
| :ref:`ndimage-ccallbacks`, :ref:`quad-callbacks`
|
| Parameters
| ----------
| function : {PyCapsule, ctypes function pointer, cffi function pointer}
| Low-level callback function.
| user_data : {PyCapsule, ctypes void pointer, cffi void pointer}
| User data to pass on to the callback function.
| signature : str, optional
| Signature of the function. If omitted, determined from *function*,
| if possible.
|
| Attributes
| ----------
| function
| Callback function given.
| user_data
| User data given.
| signature
| Signature of the function.
|
| Methods
| -------
| from_cython
| Class method for constructing callables from Cython C-exported
| functions.
|
| Notes
| -----
| The argument ``function`` can be one of:
|
| - PyCapsule, whose name contains the C function signature
| - ctypes function pointer
| - cffi function pointer
|
| The signature of the low-level callback must match one of those expected
| by the routine it is passed to.
|
| If constructing low-level functions from a PyCapsule, the name of the
| capsule must be the corresponding signature, in the format::
|
| return_type (arg1_type, arg2_type, ...)
|
| For example::
|
| "void (double)"
| "double (double, int *, void *)"
|
| The context of a PyCapsule passed in as ``function`` is used as ``user_data``,
| if an explicit value for ``user_data`` was not given.
|
| Method resolution order:
| LowLevelCallable
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, idx)
| Return self[key].
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_cython(module, name, user_data=None, signature=None) from builtins.type
| Create a low-level callback function from an exported Cython function.
|
| Parameters
| ----------
| module : module
| Cython module where the exported function resides
| name : str
| Name of the exported function
| user_data : {PyCapsule, ctypes void pointer, cffi void pointer}, optional
| User data to pass on to the callback function.
| signature : str, optional
| Signature of the function. If omitted, determined from *function*.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, function, user_data=None, signature=None)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| function
|
| signature
|
| user_data
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...) from builtins.type
| See PEP 585
FUNCTIONS
show_config = show(mode='stdout')
Show libraries and system information on which SciPy was built
and is being used
Parameters
----------
mode : {`'stdout'`, `'dicts'`}, optional.
Indicates how to display the config information.
`'stdout'` prints to console, `'dicts'` returns a dictionary
of the configuration.
Returns
-------
out : {`dict`, `None`}
If mode is `'dicts'`, a dict is returned, else None
Notes
-----
1. The `'stdout'` mode will give more readable
output if ``pyyaml`` is installed
DATA
test = <scipy._lib._testutils.PytestTester object>
VERSION
1.11.1
FILE
/Users/py4cs/anaconda3/lib/python3.11/site-packages/scipy/__init__.py
In [82]: runcell(0, '/Users/py4cs/Desktop/interpolate.py')
In [83]: x, y = create_data(10)
In [84]: x
Out[84]:
array([0. , 0.55555556, 1.11111111, 1.66666667, 2.22222222,
2.77777778, 3.33333333, 3.88888889, 4.44444444, 5. ])
In [85]: y
Out[85]:
array([ -1.40329298, -5.16324111, -2.31341179, -2.61840223,
-4.80520032, -9.05001655, -11.56540355, -16.38316608,
-16.39967572, -23.59205946])
In [86]: runfile('/Users/py4cs/Desktop/interpolate.py', wdir='/Users/py4cs/Desktop')
In [87]: y0
Out[87]: <scipy.interpolate._interpolate.interp1d at 0x153d1f6b0>
In [88]: y0(2)
Out[88]: array(-2.04639429)
In [89]: y0(2.5)
Out[89]: array(-2.04639429)
In [90]: y0(4)
Out[90]: array(-12.90356118)
In [91]: type(y0)
Out[91]: scipy.interpolate._interpolate.interp1d
In [92]: runcell(0, '/Users/py4cs/Desktop/interpolate.py')
In [93]: x, y = create_data(5)
In [94]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
Traceback (most recent call last):
File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/Desktop/untitled1.py:14
ax.plot(x, y)
NameError: name 'x' is not defined
In [95]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
Traceback (most recent call last):
File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/Desktop/untitled1.py:23
x, y = create_data(5)
File ~/Desktop/untitled1.py:17 in create_data
x = np.linspace(0, xmax, n)
NameError: name 'np' is not defined
In [96]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
In [97]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
In [98]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
Traceback (most recent call last):
File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/Desktop/untitled1.py:28
y_int = scipy.integrate.interp1d(x, y)
AttributeError: module 'scipy.integrate' has no attribute 'interp1d'
In [99]: runfile('/Users/py4cs/Desktop/untitled1.py', wdir='/Users/py4cs/Desktop')
In [100]: y_int(0)
Out[100]: array(-1.9382867)
In [101]: y[0]
Out[101]: -1.938286704139672
In [102]: y_int(0.1)
Out[102]: array(-2.05268969)
In [103]: y_int(0.2)
Out[103]: array(-2.16709267)
In [104]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
In [105]: p
Out[105]: array([-0.89536647, -0.43838377, 0.04485159])
In [106]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are {a=} {b=} {c=}
Important |
Figures are displayed in the Plots pane by default. To make them also appear inline in the console, you need to uncheck "Mute inline plotting" under the options menu of Plots. |
In [107]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-1.0124161441123785 b=-0.036423084223018876 c=0.3626199962818779
In [108]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-0.9943008780659535 b=-0.021281724440034955 c=-0.00559362100792149
In [109]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-1.0325626827680459 b=0.19875615140600705 c=-0.2029227611061329
In [110]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-1.0020972496241778 b=0.012813945801388393 c=-0.014009590348469603
In [111]: pcov
Out[111]:
array([[ 6.59763747e-05, -3.29881723e-04, 2.74874339e-04],
[-3.29881723e-04, 1.75938876e-03, -1.64932340e-03],
[ 2.74874339e-04, -1.64932340e-03, 2.06175252e-03]])
In [112]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-0.9725129824185748 b=-0.15567347084277852 c=0.21455516549105239
In [113]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-1.476119263998652 b=2.590076915486164 c=-1.0236209248809471
In [114]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-0.40103527031015007 b=-5.016788280946865 c=9.71863354700179
In [115]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-11.258462565827095 b=15.450058092768739 c=104.43452745750146
In [116]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-1.0131539923650987 b=0.28822642585426606 c=-0.6055447152388537
In [117]: scipy.optimize.curve_fit?
In [118]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-0.9031023882458158 b=-0.48951780757643815 c=999.8824224496957
In [119]: runfile('/Users/py4cs/Desktop/curvefit2.py', wdir='/Users/py4cs/Desktop')
parameters are a=-0.8180730806915478 b=-1.5502315875162995 c=1002.1213249937997
In [120]: runcell(0, '/Users/py4cs/Desktop/fmin1.py')
In [121]: f(0)
Out[121]: -1.8823683174569696
In [122]: fmin(f, 1)
Optimization terminated successfully.
Current function value: -2.023866
Iterations: 16
Function evaluations: 32
Out[122]: array([0.23964844])
In [123]: runfile('/Users/py4cs/Desktop/fifoqueueOO.py', wdir='/Users/py4cs/Desktop')
3 customers in queue1:
waiting customer: Takeda
waiting customer: Fangohr
waiting customer: Spearing
In [124]: q1.queue
Out[124]: ['Takeda', 'Fangohr', 'Spearing']
In [125]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [126]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [127]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [128]: !ls
copy-files-to-output-dir.sh test_lab10.py
demo.py testcompare.pdf
demo2.py testdata.txt
lab10-compare-fit-and-data.pdf time_temp.pdf
lab10.py time_temp.png
lab10lenka.py time_temp.txt
make_data.py training.py
make_equations.sh
In [129]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [130]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [131]: !cat time_temp.txt
60 78.301
70 77.495
80 74.371
90 75.61
100 74.806
110 75.582
120 70.988
130 73.72
140 72.198
150 70.576
160 70.24
170 68.008
180 66.92
190 68.334
200 66.366
210 65.079
220 64.304
230 62.939
240 61.6
250 62.295
260 61.565
270 60.01
280 61.524
290 59.655
300 57.551
310 59.086
320 57.603
330 57.353
340 56.904
350 54.77
360 55.578
370 56.702
380 54.799
390 53.27
400 53.172
410 51.126
420 52.221
430 50.724
440 51.075
450 51.086
460 49.407
470 48.811
480 48.861
490 48.225
500 47.905
510 47.011
520 48.658
530 46.326
540 47.373
550 45.96
560 47.436
570 46.214
580 46.619
590 45.015
600 45.333
610 43.767
620 43.582
630 43.172
640 41.729
650 42.982
660 42.979
670 42.152
680 41.62
690 41.27
700 41.037
710 40.623
720 38.439
730 38.573
740 39.798
750 40.235
760 37.98
770 38.547
780 40.267
790 39.427
800 38.481
810 41.855
820 35.879
830 36.36
840 38.6
850 36.452
860 35.324
870 36.128
880 36.873
890 36.454
900 34.764
910 32.528
920 34.273
930 33.322
940 33.876
950 33.826
960 32.494
970 31.922
980 34.574
990 33.662
1000 32.498
1010 33.025
1020 32.728
1030 34.453
1040 31.905
1050 30.142
1060 31.35
1070 31.264
1080 31.278
1090 29.189
1100 30.151
1110 32.023
1120 30.867
1130 30.272
1140 30.396
1150 28.874
1160 29.688
1170 29.78
1180 29.285
1190 28.848
1200 28.635
1210 29.922
1220 29.82
1230 28.331
1240 29.197
1250 27.156
1260 28.756
1270 29.08
1280 28.199
1290 27.218
1300 29.191
1310 27.314
1320 28.044
1330 28.871
1340 27.385
1350 27.426
1360 27.379
1370 26.638
1380 27.486
1390 27.701
1400 28.518
1410 27.336
1420 24.208
1430 26.683
1440 26.53
1450 26.65
1460 25.908
1470 27.808
1480 25.733
1490 25.116
1500 26.853
1510 26.128
1520 24.394
1530 26.005
1540 24.969
1550 26.048
1560 26.589
1570 25.652
1580 23.246
1590 25.808
1600 24.221
1610 25.64
1620 25.213
1630 26.573
1640 23.832
1650 24.008
1660 25.988
1670 24.527
1680 25.643
1690 24.046
1700 25.009
1710 26.58
1720 24.635
1730 24.157
1740 23.783
1750 24.949
1760 24.215
1770 24.528
1780 24.309
1790 23.641
1800 23.559
1810 22.72
1820 25.882
1830 24.348
1840 25.216
1850 24.875
1860 24.726
1870 23.9
1880 23.426
1890 23.459
1900 25.933
1910 22.718
1920 21.026
1930 23.391
1940 24.659
1950 23.144
1960 23.501
1970 23.392
1980 23.123
1990 24.713
2000 25.54
2010 23.954
2020 23.89
2030 22.558
2040 23.47
2050 23.765
2060 24.772
2070 21.076
2080 20.172
2090 24.214
2100 22.969
2110 23.991
2120 22.447
2130 22.84
2140 23.105
2150 24.651
2160 23.251
2170 22.942
2180 23.438
2190 23.781
2200 21.005
2210 21.694
2220 23.924
2230 21.504
2240 23.078
2250 22.966
2260 21.405
2270 22.975
2280 22.941
2290 21.798
2300 22.688
2310 24.266
2320 22.836
2330 22.556
2340 23.497
2350 22.122
2360 22.229
2370 19.64
2380 22.316
2390 24.111
2400 21.854
2410 23.787
2420 23.574
2430 21.846
2440 22.281
2450 23.193
2460 22.266
2470 21.077
2480 22.959
2490 22.324
2500 21.128
2510 24.09
2520 22.459
2530 21.146
2540 21.529
2550 22.46
2560 21.281
2570 22.343
2580 21.179
2590 22.144
2600 21.467
2610 21.338
2620 20.193
2630 21.988
2640 21.811
2650 21.613
2660 21.009
2670 20.369
2680 22.374
2690 21.545
2700 21.047
2710 21.059
2720 21.52
2730 20.634
2740 20.862
2750 22.941
2760 22.501
2770 21.123
2780 21.46
2790 22.535
2800 20.112
2810 21.669
2820 20.969
2830 20.488
2840 22.671
2850 22.957
2860 22.416
2870 22.184
2880 22.638
2890 20.552
2900 21.652
2910 21.831
2920 19.653
2930 22.552
2940 22.365
2950 23.031
2960 21.334
2970 20.793
2980 20.39
2990 20.648
3000 21.762
3010 21.621
3020 22.902
3030 23.037
3040 19.214
3050 20.13
3060 21.852
3070 21.864
3080 20.671
3090 20.77
3100 22.105
3110 19.935
3120 18.414
3130 19.214
3140 23.387
3150 21.284
3160 22.577
3170 19.77
3180 20.908
3190 20.053
3200 21.023
3210 20.497
3220 20.338
3230 20.615
3240 22.146
3250 21.033
3260 21.934
3270 21.424
3280 19.573
3290 20.67
3300 23.244
3310 21.13
3320 20.604
3330 21.678
3340 19.985
3350 20.259
3360 20.267
3370 22.463
3380 20.08
3390 22.108
3400 21.994
3410 22.619
3420 21.919
3430 17.571
3440 20.084
3450 21.455
3460 21.167
3470 21.362
3480 21.483
3490 22.168
3500 21.629
3510 22.037
3520 21.862
3530 21.071
3540 21.99
3550 21.192
3560 21.081
3570 20.726
3580 20.933
3590 19.177
3600 22.368
3610 20.785
3620 21.544
3630 20.908
3640 21.308
3650 21.787
3660 22.017
3670 21.391
3680 21.375
3690 19.852
3700 21.327
3710 19.76
3720 20.15
3730 21.549
3740 21.983
3750 22.216
3760 22.812
3770 19.491
3780 20.546
3790 20.33
3800 21.209
3810 20.833
3820 20.107
3830 22.649
3840 20.086
3850 21.024
3860 22.155
3870 22.11
3880 20.877
3890 22.275
3900 21.835
In [132]: runfile('/Users/py4cs/git/teaching-python/r2w/input/lab10/lab10.py', wdir='/Users/py4cs/git/teaching-python/r2w/input/lab10')
Fitted values Ti=84.0844, Ta=21.0115, c=599.243
Model parameters are Ti=84.084425 C, Tf=21.011529C,
time constant=599.243104s
sixty_degree: Ti=84.0844, Ta=21.0115, c=599.243
The drink reaches 60 degrees after 288.2510044232567 seconds = 4.804183 minutes
In [133]: