Commit Graph

56 Commits

Author SHA1 Message Date
Amin Sehati
d421b9750c Added a fancy indexing solution for 16 2026-02-09 08:54:37 -05:00
Amin Sehati
4a3372ed11 Remove an incorrect solution (fancy indexing) from Numpy exercise No. 16 in the solutions files. 2026-02-08 16:58:53 -05:00
Tejas Tp
4ccd5c0689 Format np.genfromtxt parameters for consistency 2025-11-06 18:49:43 +05:30
Tejas Tp
bfd5e4dbcb Update np.genfromtxt to use int and filling_values
Changed dtype from np.int to int and added filling_values parameter.
2025-11-06 18:45:05 +05:30
Nicolas P. Rougier
5c3481111f Merge pull request #244 from Gattocrucco/alt-sol-87
Alternative solution to exercise 87
2025-08-26 11:07:22 +02:00
Nicolas P. Rougier
836eab7578 Merge pull request #242 from Gattocrucco/alt-sol-4
Alternative solution to exercise 4
2025-08-26 11:06:42 +02:00
Gattocrucco
301e0eb61e further simplification to the alt solution of 87
The initial formulation contained a redundant `swapaxes`.
2025-08-26 00:16:34 +02:00
Gattocrucco
59a403da66 alternative solution to exercise 87
Added a more elegant (but more cryptic) solution with reshape and
swapaxes.

Removed one of the existing alternative solutions because it was a
duplicate of a previous alternative solution.
2025-08-25 18:13:30 +02:00
Gattocrucco
fca297a6e1 improve solution to exercise 82
The current solution uses a fixed arbitrary threshold of 1e-10 on the
singular values, I replaced it with the common heuristic n*eps*max(s).
2025-08-25 18:06:25 +02:00
Giacomo Petrillo
ee15dec2c7 alt solution to exercise 4
Uses nbytes instead of itemsize * size
2025-08-25 17:53:21 +02:00
Hemanth
93a34b49b1 Merge branch 'rougier:master' into q78_edit 2025-07-26 23:14:22 +00:00
Hemanth21k
44df2b0d3c simplified answer.78 2025-07-26 23:10:48 +00:00
Hemanth21k
dbb54197e8 q78 explained 2025-07-23 21:52:39 +00:00
Hemanth21k
f7851655d7 issue 215 fix 2025-07-07 17:43:13 +00:00
Hemanth21k
3d136da45b Q.78 solution expalined 2025-07-07 17:28:47 +00:00
Emmet-Ray
125ae6022f fixed typos
q42: array -> arrays
q48: value -> values
q53: integer -> integer array
q71: mulitply -> multiply
q80: extract -> extracts
q90: combinations -> combination
2025-04-09 16:21:14 +08:00
YangWu1227
adf896fa7c feat: broadcasting solution exercise 79 2025-02-17 17:10:33 -05:00
anthonyduong
efb6e2e192 solves exercise 24 2024-10-22 22:30:16 -07:00
jeremy-feng
683f473a6f Fixed a typo 2023-03-18 15:20:15 +08:00
Stefan Heimersheim
9182fdc110 Remove incorrect alternative solution q19
The reshape-based solution for q19 did only work for odd numbered squares, not even ones such as 8x8 squares.
2022-11-29 14:29:35 +00:00
Henry Ji
fccab23c7e Add alternative solution for Q.19 2022-10-10 20:58:25 +08:00
lots-o
7a0974c68f Modify typo Q.63 2022-03-31 22:55:05 +09:00
lots-o
23f872b229 Add alternative solution of Q.60 2022-03-30 22:19:36 +09:00
Jeff1999
e72a3d9f35 Update Q.75, 76, 81, 84, 85, 87
Update alternative solutions with sliding_window_view (NumPy >= 1.20.0).
2021-12-17 16:41:42 +08:00
Jeff1999
731d575569 alternative solution for Q.82 2021-07-27 10:11:29 +08:00
Sebastian Wallkötter
72fc6399b2 alternative solution for no. 87 2021-06-13 16:20:39 +02:00
bassbone
8603114b95 add difficulty 2021-06-11 23:14:29 +09:00
Sword-holder
86e24f1da9 Fix solution of question 76. 2021-04-21 16:11:23 +08:00
Francesco Terenzi
025845ff5c Updated question 37, keep previous solution for reference 2021-04-09 10:50:11 +02:00
Francesco Terenzi
a7c84d5fed Updated question 37 2021-04-08 20:51:14 +02:00
Mark Setchell
1f3c0025e8 Updated question 66 2021-03-22 10:02:11 +00:00
Fisher Wang
589e79f78a some refinement 2021-03-12 22:29:45 +08:00
Fisher Wang
8527c7c83c replace the solution of problem 66 and set the difficulty 2021-03-11 17:10:53 +08:00
Fisher Wang
d931b008a3 Give another solution of problem #66, and fix the old solution as #142 did 2021-03-09 21:42:18 +08:00
madeirak
8f73b3a480 Update exercises100.ktx 2021-01-04 17:29:28 +08:00
Poedator
95777749d7 upd example in a49
with default threshold=1000 [reference](551773f27c/numpy/core/arrayprint.py (L107-L110)) 16x16 is always printed OK. A larger np.array is needed to illustrate the difference. Anything with over 1000 elements would do.
2020-10-17 20:46:27 +03:00
Nicolas P. Rougier
49ea7ffd2b Merge pull request #132 from poedator/patch-2
answer 35: delete `C = np.ones(3)*3`
2020-10-01 10:42:35 +02:00
Poedator
da29eb4cad answer 35: delete C = np.ones(3)*3
the line `C = np.ones(3)*3` is not needed in the answer. The variable C is not used at all.
2020-09-27 12:27:36 +03:00
Poedator
81e21a1f2c fix deprecated type definition.
Original answer triggered `c:\conda\envs\bigdata\lib\site-packages\ipykernel_launcher.py:5: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.`
New answer proposed per [Numpy docs](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html)
2020-09-27 11:24:31 +03:00
Yifan
4c9a228d49 Fix Q.49
Before: `threshold=np.nan` 
After : `threshold=float("inf")`

`np.nan` may fail in latest version.
2020-07-01 08:53:43 +08:00
Charles
a683e7a014 Q25 minor changes 2020-06-09 14:07:54 -07:00
Charles
b2a4a9e819 Q16 Alternate Solution 2020-06-03 14:58:44 -07:00
Charles
19af334130 changes for Q29 2020-05-28 15:35:39 -07:00
Nicolas P. Rougier
493c48d101 Merge pull request #117 from Haksell/suggest36
Add a solution to question 36
2020-05-04 07:57:24 +02:00
Nicolas P. Rougier
69109eeba5 Merge pull request #111 from Haksell/master
Fix answer 9
2020-05-03 10:12:08 +02:00
Nicolas P. Rougier
a9cd884249 Merge pull request #115 from Haksell/suggest33
Remove superfluous second argument in answer 33
2020-05-03 10:09:33 +02:00
Haksell
b8093ccf5c Add a solution to question 36 2020-05-02 10:08:01 +02:00
Haksell
6541c23057 Remove superfluous second argument in answer 33 2020-05-02 09:47:54 +02:00
Haksell
1ecdd416d3 There was no context manager solution to go with the comment 2020-05-02 09:39:51 +02:00
Haksell
76d42c7795 revert to previous commit like a noob 2020-05-02 07:36:55 +02:00