|
From: Tim H. <tim...@co...> - 2006-02-13 19:30:40
|
I've been trying to look into the problem described below, but I just can't find where complex multiplication is being done (all the other multiplication, but not complex). Could someone with a grasp of the innards of numpy please point me in the right direction? Thanks, -tim Ryan Krauss wrote: >This may only be a problem for ridiculously large numbers. I actually >meant to be dealing with these values: > >In [75]: d >Out[75]: >array([ 246.74011003, 986.96044011, 2220.66099025, 3947.84176044, > 6168.50275068, 8882.64396098, 12090.26539133, 15791.36704174, > 19985.94891221, 24674.01100272]) > >In [76]: s=d[-1]*1.0j > >In [77]: s >Out[77]: 24674.011002723393j > >In [78]: type(s) >Out[78]: <type 'complex128scalar'> > >In [79]: s**2 >Out[79]: (-608806818.96251547+7.4554869875188623e-08j) > >So perhaps the previous difference of 26 orders of magnitude really >did mean that the imaginary part was negligibly small, that just got >obscured by the fact that the real part was order 1e+135. > >On 2/13/06, Ryan Krauss <rya...@gm...> wrote: > > >>I am having a problem with indexing an array and not getting the >>expected scalar behavior for complex128scalar: >> >>In [44]: c >>Out[44]: >>array([ 3.31781200e+06, 2.20157529e+13, 1.46088259e+20, >> 9.69386754e+26, 6.43248601e+33, 4.26835585e+40, >> 2.83232045e+47, 1.87942136e+54, 1.24711335e+61, >> 8.27537526e+67]) >> >>In [45]: s=c[-1]*1.0j >> >>In [46]: type(s) >>Out[46]: <type 'complex128scalar'> >> >>In [47]: s**2 >>Out[47]: (-6.848183561893313e+135+8.3863291020365108e+119j) >> >>In [48]: s=8.27537526e+67*1.0j >> >>In [49]: type(s) >>Out[49]: <type 'complex'> >> >>In [50]: s**2 >>Out[50]: (-6.8481835693820068e+135+0j) >> >>Why does result 47 have a non-zero imaginary part? >> >>Ryan >> >> >> > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log files >for problems? Stop! Download the new AJAX search engine that makes >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 >_______________________________________________ >Numpy-discussion mailing list >Num...@li... >https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > > |