Hallo Ondrej, another way to solve this is characteristic equation.
C = A + lambda * B ch = C.det() eigenvalues = solve(ch, lambda) I code that already, but I don't get it solved by now (issue 1881, issue 1880) for large matrices. The field of my application is finite element method (FEM). It's a learning software for students. Current release needs maple to show symbolic results of user interaction which is no problem if the students use the software at university. But maple is much to expensive to run a copy at home. What I'm doing now is porting maple worksheets to sympy. Works very well, as long as solve() is not included which I need now. Next after getting the eigenvalues and do some math to it again solve is needed. norm = (Eigenvector.transpose().dot(Eigenvector))**(Rational(1,2)) t_solv = solve(norm-1,t)[0] greetz copyrights p.s. Thanks to all developer of sympy. It the most fascinating python library I know. On 29 Mrz., 22:36, Ondrej Certik <ond...@certik.cz> wrote: > On Mon, Mar 29, 2010 at 3:34 AM, notmyaddr...@teewars.org > > > > > > <notmyaddr...@teewars.org> wrote: > > Hallo, > > > I trying to solve a generalized eigenvalue problem with two matrices > > <= 8x8. > > > A*x = lambda*B*x where A and B are symmetric matrices > > > Sympy only take one matrix for method eigenvals. So what I have tried > > by now is > > > B^-1 *A*x = lambda*x > > > but inverting B is much to heavy. In maple inverting B takes a very > > long time too, but maple also has the option to put both in eigenvals > > method like eigenvals(A,B) which is pretty fast. > > > Here an example for two matrices: > > > F = Symbol('F') > > L = Symbol('L') > > E = Symbol('E') > > J = Symbol('J') > > lmbda = Symbol('lambda') > > > B = Matrix([[-4*F*L/75, F/10, F*L/150, 0, 0, 0, 0, 0], [F/10, -12*F/L, > > 0, 6*F/L, -F/10, 0, 0, 0], [F*L/150, 0, -4*F*L/75, F/10, F*L/150, 0, > > 0, 0], [0, 6*F/L, F/10, -12*F/L, 0, 6*F/L, 0, 0], [0, -F/10, F*L/150, > > 0, -4*F*L/75, F/10, 0, 0], [0, 0, 0, 6*F/L, F/10, -12*F/L, 6*F/L, -F/ > > 10], [0, 0, 0, 0, 0, 6*F/L, -6*F/L, F/10], [0, 0, 0, 0, 0, -F/10, F/ > > 10, -2*F*L/75]]) > > > A= Matrix([[40*E*J/L, -150*E*J/L**2, 10*E*J/L, 0, 0, 0, 0, 0], > > [-150*E*J/L**2, 3000*E*J/L**3, 0, -1500*E*J/L**3, -150*E*J/L**2, 0, 0, > > 0], [10*E*J/L, 0, 40*E*J/L, -150*E*J/L**2, 10*E*J/L, 0, 0, 0], [0, > > -1500*E*J/L**3, -150*E*J/L**2, 3000*E*J/L**3, 0, -1500*E*J/L**3, 0, > > 0], [0, -150*E*J/L**2, 10*E*J/L, 0, 40*E*J/L, -150*E*J/L**2, 0, 0], > > [0, 0, 0, -1500*E*J/L**3, -150*E*J/L**2, 3000*E*J/L**3, -1500*E*J/ > > L**3, -150*E*J/L**2], [0, 0, 0, 0, 0, -1500*E*J/L**3, 1500*E*J/L**3, > > -150*E*J/L**2], [0, 0, 0, 0, 0, -150*E*J/L**2, -150*E*J/L**2, 20*E*J/ > > L]]) > > > Any suggestions how to solve this in sympy? > > We need to figure out some algorithm to calculate generalized > eigenvalue problems symbolically. Do you have any idea how to do that? > > I am not surprised that B^-1 is a no go, that's the same with > numerical eigen problems. > > Btw, just curious --- what is your application? I myself need this in > quantum mechanics. > > Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.