diff options
author | Endolith <endolith@gmail.com> | 2015-03-08 19:15:34 -0400 |
---|---|---|
committer | Endolith <endolith@gmail.com> | 2015-03-08 19:15:34 -0400 |
commit | 050f390199b098b8f1d7bf89a003573f17a690ba (patch) | |
tree | 2b31a1764186b053f019066b4975e14f4b0513d2 /numpy/lib/tests/test_polynomial.py | |
parent | cb000ea67435d21fa351d1843e28be3792484b7b (diff) | |
download | numpy-050f390199b098b8f1d7bf89a003573f17a690ba.tar.gz |
TST: Set seed for deterministic random test
also fixed some PEP8 issues
Diffstat (limited to 'numpy/lib/tests/test_polynomial.py')
-rw-r--r-- | numpy/lib/tests/test_polynomial.py | 109 |
1 files changed, 6 insertions, 103 deletions
diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index d412504fa..6d2e330ec 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -92,122 +92,25 @@ class TestDocs(TestCase): def test_poly(self): assert_array_almost_equal(np.poly([3, -np.sqrt(2), np.sqrt(2)]), [1, -3, -2, 6]) - + # From matlab docs A = [[1, 2, 3], [4, 5, 6], [7, 8, 0]] assert_array_almost_equal(np.poly(A), [1, -6, -72, -27]) # Should produce real output for perfect conjugates assert_(np.isrealobj(np.poly([+1.082j, +2.613j, -2.613j, -1.082j]))) - assert_(np.isrealobj(np.poly([0+1j, -0+-1j, 1+2j, 1-2j, 1.+3.5j, 1-3.5j]))) + assert_(np.isrealobj(np.poly([0+1j, -0+-1j, 1+2j, + 1-2j, 1.+3.5j, 1-3.5j]))) assert_(np.isrealobj(np.poly([1j, -1j, 1+2j, 1-2j, 1+3j, 1-3.j]))) assert_(np.isrealobj(np.poly([1j, -1j, 1+2j, 1-2j]))) assert_(np.isrealobj(np.poly([1j, -1j, 2j, -2j]))) assert_(np.isrealobj(np.poly([1j, -1j]))) assert_(np.isrealobj(np.poly([1, -1]))) - + assert_(np.iscomplexobj(np.poly([1j, -1.0000001j]))) - a = np.array([ 0.156954782163288+0.984270709753367j, - 0.622215082237431+0.815403412551784j, - 0.192767508171407+0.025782783400578j, - 0.185259804856739+0.062797902506984j, - 0.642062232914462+0.258301456097768j, - 0.554216030989744+0.563355351870913j, - 0.257546073507044+0.525462181113635j, - 0.069480950067410+0.929049150512649j, - 0.096319535923967+0.157777020606244j, - 0.708090004255965+0.844669553809902j, - 0.425935775597273+0.125078838218321j, - 0.970152325957828+0.851990066251973j, - 0.704876672261560+0.193300382687057j, - 0.973090791069053+0.373260711231715j, - 0.858196147177131+0.05834145118111j , - 0.219200867770377+0.841215110962817j, - 0.262803798327004+0.350643402581111j, - 0.695129112984574+0.838433416963582j, - 0.492312071206577+0.568692426000207j, - 0.461596720878441+0.939374973294176j, - 0.875862628133633+0.387188834096265j, - 0.510155097370032+0.086507519082896j, - 0.416241737182592+0.997111268069588j, - 0.437687604607545+0.338506697660151j, - 0.521443013907779+0.867476314513278j, - 0.430452365593011+0.37031608091577j , - 0.345316632952483+0.548675748644057j, - 0.149523073174576+0.928825871510194j, - 0.923082836345975+0.437036121992853j, - 0.833612375039695+0.683069897188595j, - 0.139074221945298+0.833315145348817j, - 0.653499684833185+0.351573042621427j, - 0.461341447535269+0.925980448573019j, - 0.055277550126714+0.533775159709293j, - 0.270768043029381+0.010703056622904j, - 0.482823304062645+0.08952461265093j , - 0.385633251633276+0.471519033804927j, - 0.720444297565953+0.115168361978791j, - 0.901325096506279+0.573680608616877j, - 0.959391049112433+0.693872340885839j, - 0.875681825163325+0.568590792955772j, - 0.342690505279819+0.157893904699271j, - 0.464525179914033+0.29171018650294j , - 0.009793808914706+0.561574572890755j, - 0.728374526873344+0.766958583319351j, - 0.236256527104613+0.398956198854611j, - 0.005192803665847+0.6582409070444j , - 0.500947297517811+0.986725666390376j, - 0.122809093777905+0.718680008979424j, - 0.526136583175024+0.623303763302004j, - 0.330389021549133+0.453395938203371j, - 0.077737539510244+0.247246328523751j, - 0.975408285543645+0.107323424042245j, - 0.003108270882599+0.887002919906503j, - 0.705369913247720+0.727872932569583j, - 0.633198660668698+0.638479991067479j, - 0.549251188569645+0.805780727887373j, - 0.265913392155735+0.780589896981667j, - 0.886221583652843+0.354483251386333j, - 0.075962413516947+0.74149612838474j , - 0.387765278689023+0.261920931194769j, - 0.948020419648345+0.962386254625887j, - 0.171825523058385+0.627697322385636j, - 0.773639395361929+0.560492952470529j, - 0.939715690837345+0.905583974484841j, - 0.435045495931129+0.094656944697808j, - 0.762649213991775+0.449112026839121j, - 0.213651264630881+0.811270873115497j, - 0.570908734237865+0.658844605819891j, - 0.219391840755125+0.495267594812611j, - 0.262407487010337+0.040859801611494j, - 0.442188925584075+0.152902944310853j, - 0.461651269744638+0.656796707213587j, - 0.664031310363019+0.109070794733818j, - 0.771690766165916+0.30133668510443j , - 0.920953990465468+0.805475073423507j, - 0.573345189066715+0.150257996561483j, - 0.188075887121730+0.949400965438739j, - 0.657412049911476+0.671647766047969j, - 0.457617239769180+0.524527009214878j, - 0.171132581309313+0.863116500343149j, - 0.684223873158406+0.020730339332808j, - 0.689288538461901+0.853005338506492j, - 0.655100897151547+0.738842295189445j, - 0.469288725720117+0.169269913506413j, - 0.727009355656050+0.143819575672136j, - 0.629418760068722+0.903341905093775j, - 0.721343748466731+0.530360235423122j, - 0.175701721256605+0.116376710227018j, - 0.525170376501935+0.296511653195648j, - 0.964998457578896+0.329699663252158j, - 0.640601603201311+0.462798516244823j, - 0.877865654950912+0.654173127841309j, - 0.729729383013391+0.56291800466453j , - 0.018630332051044+0.821498382381245j, - 0.131727707997140+0.530713631823519j, - 0.187791574003037+0.626722638953091j, - 0.399902516540311+0.950780374305921j, - 0.526632360878467+0.467303482757566j, - 0.296258070015251+0.977206756817445j]) + np.random.seed(42) + a = np.random.randn(100) + 1j*np.random.randn(100) assert_(np.isrealobj(np.poly(np.concatenate((a, np.conjugate(a)))))) def test_roots(self): |