Quietly, Quiggly s
Release me. Now. O
Tiffany, you reall
Tiffany, you reall
Bad children's boo
Bad children's boo
Water was found on
Retirement and Ben
Lien enforcement
College and UniverChapter 1. Once
the code is complete, we can go and verify the results. The test
results will be in the form of a plot showing the function values along the
first dimension versus its derivatives along the second dimension. This is
usually the most straightforward and efficient way to debug a problem.
In this section we will run the code by calling the
```numpy.testing.assert_array_equal``` function
```assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**```
**Part A - F (x,y) - F' (x,y)**
In [9]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
[Out]:
array_equal(array([[0., 1.],
[3.4, 0.],
[2.8, 0.],
[0., 1.],
[3.4, 0.],
[2.8, 0.]]),
array([[0., 1.],
[0., 0.],
[0., 0.],
[0., 1.],
[0., 0.],
[0., 0.]], dtype=float64))
**Part B - y - y**
In [10]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
array_equal(array([[2.8, 3.4],
[0., 0.],
[2.8, 3.4],
[0., 0.],
[0., 0.],
[0., 0.]]),
array([[-2.8, 1.],
[3.4, 1.],
[-2.8, 1.],
[3.4, 1.],
[-2.8, 1.],
[3.4, 1.]], dtype=float64))
**Part C - x**
In [11]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
array_equal(array([[2.8, 3.4],
[0., 0.],
[2.8, 3.4],
[0., 0.],
[0., 0.],
[0., 0.]]),
array([[-0.0, -0.0],
[-0.0, 0.0],
[0.0, -0.0],
[0.0, 0.0],
[0.0, 0.0],
[0.0, 0.0]]),
dtype=float64)
**Part D - -2 / x**
In [12]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
array_equal(array([[0., -2.],
[0., -0.0],
[0., -2.],
[0., 0.],
[0., -0.0],
[0., 0.]]),
array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]], dtype=float64))
**Part E - y**
In [13]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
array_equal(array([[2.8, 0.],
[3.4, 0.],
[2.8, 0.],
[3.4, 0.],
[2.8, 0.],
[3.4, 0.]]),
array([[-2.8, 0.],
[1.0, 0.],
[-2.8, 0.],
[1.0, 0.],
[-2.8, 0.],
[1.0, 0.]], dtype=float64))
**Part F - x - -2 / x**
In [14]: %paste
assert_array_equal(deriv(x,y), np.gradient(x(y), axis=1))**
...:
array_equal(array([[0., 0.],
[-0.0, 0.],
[0.0, 0.],
[-0.0, 0.],
[0.0, 0.],
[-0.0, 0.]]),
array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]], dtype=float64))
---
As you can see,
```assert_array_equal``` checks to make sure that the
values and
```dtype``` information is equivalent.
---
In [15]: %run -i numpy/testing/nosetester.py
======================================================================
FAIL: TestAdd_test_deriv_1D_with_y (numpy.testing.nosetester.numpy_tester)
----------------------------------------------------------------------
ValueError: Error on value: (ndim=1, iscomplex=False)
x: 2.8, y: 3.4
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray
array is ndarray
array should be ndarray