[SciPy-user] Reliability of linalg.eig for complex matrices A,B

Pearu Peterson pearu at cens.ioc.ee
Thu Aug 29 15:52:37 CDT 2002


On Thu, 29 Aug 2002, My VDI Freemail wrote:

> Hi,
> 
> I tried to solve a transcendental eigenvalue problem with scipy.
> However It works more or less for r e a l arguments x, but
> for complex arguments I cannot observe convergency to any 
> eigenvalue. I guess its a problem of the eigenvalue solver.
> Please find attached my small example.
> 
> Any ideas or suggestions ?

The problem is with your algorithm (that was also broken for real
arguments). The following code tends to converge with arbitrary (but
reasonable) initial data:

x = 3+4j
print x
e = 1.0
iter = 0
while abs(e) > 1.e-10:
  iter = iter + 1
  A = array(([x,cos(x)],[x*x+3.0,sin(x)]))
  B = array(([-1.,sin(x)],[-2.0*x,-cos(x)]))
  s = linalg.eig(A,B,left=0,right=0)
  as = abs(s)
  e = s[list(as).index(min(as))]
  x = x + 0.9*e
  print iter, x

Here is the output:
(3+4j)
1 (3.00008114791+3.09923713594j)
2 (3.00077696838+2.1949847382j)
3 (3.00510351351+1.27097555405j)
4 (3.03297969798+0.218683158764j)
5 (0.949729120741+0.269605657507j)
6 (1.25450225927+0.0142850278504j)
7 (1.29572155364+0.001465000977j)
8 (1.29991190209+0.000147112117971j)
9 (1.30033182184+1.47176102089e-05j)
10 (1.30037382288+1.47182528726e-06j)
11 (1.30037802307+1.47183171673e-07j)
12 (1.30037844309+1.4718323597e-08j)
13 (1.3003784851+1.471832424e-09j)
14 (1.3003784893+1.47183243043e-10j)
15 (1.30037848972+1.47183243107e-11j)
16 (1.30037848976+1.47183243114e-12j)

Regards,
	Pearu

PS: No need to send messages to both scipy-user and scipy-dev mailing
lists. Just pick one and stick to it.




More information about the SciPy-user mailing list