This repository was archived by the owner on Apr 24, 2020. It is now read-only.
Commit c218556
Numpy polynomial correction (#689)
* Changed the implementation of exercise 3 in python essentials to make it
faster, more pythonic and use techniques explained in the text
* Corrected a bug in Exercise 1 of the numpy chapter
The np.poly1d() method takes the coefficients in decreasing powers
so they need to be flipped (np.flip()) before making the call
Improved the test case as this error wasn't detected when using
identical coefficients.
Moved the tested value to a variable rather than hard coded
Made the code more pythonic using np.ones_like() rather than
np.empty(len(coef))
* typo coeffs -> coef
* Revert "Changed the implementation of exercise 3 in python essentials to make it"
This reverts commit a8c4795.1 parent d2d0dea commit c218556
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
923 | | - | |
| 922 | + | |
924 | 923 | | |
925 | 924 | | |
926 | 925 | | |
| |||
929 | 928 | | |
930 | 929 | | |
931 | 930 | | |
932 | | - | |
| 931 | + | |
| 932 | + | |
933 | 933 | | |
934 | | - | |
| 934 | + | |
935 | 935 | | |
936 | | - | |
937 | | - | |
| 936 | + | |
| 937 | + | |
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| |||
0 commit comments