4 ms·
I got stumped at the Frobenius norm (11/13). Everything I typed in returned this: NotImplementedError: the 'axis' parameter is currently not supported on line
by aceperry 6y ago
I got stumped at the Frobenius norm (11/13). Everything I typed in returned this:
NotImplementedError: the 'axis' parameter is currently not supported on line 7
I used variations of:
np.sqrt(m.sum(m.prod()))
np.sqrt(m.sum(m2))
It's been a long time since I've taken linear algebra, so I don't remember some of these operations.
- vthommeret 6y agoThat's close, but basically you need to take the square of each element first, e.g. `m * * 2` [0]. This keeps the shape of the matrix while `m.prod()` returns a single number (multiplying each element together). So it should look something like this: `np.sqrt((m * * 2).sum())` Re: The error message, it looks like it's occurring because `sum` doesn't normally take any parameters and interprets the argument as an "axis" parameter — https://numpy.org/doc/1.18/reference/generated/numpy.sum.html https://numpy.org/doc/1.18/reference/generated/numpy.sum.htm... Order of operations is tricky and I could do a better job breaking it down. Still plan to add the Show Solution button but need to get some sleep :-). In the meantime you can see all the possible solutions in the repo! https://github.com/vthommeret/mathtocode/tree/master/questions https://github.com/vthommeret/mathtocode/tree/master/questio... [0] Remove the space between the asterisks / I had to add it since HN interprets them as italics.