On Jul 30, 10:58 pm, Aaron S. Meurer <asmeu...@gmail.com> wrote: > Hi! > > I ran your script in SymPy 0.6.7 and got the same thing you did, with the > slow performance. But I also ran it in the latest git master and it ran the > whole thing in just under a minute. So something in the git master has > fixed. Actually, I have no doubt in my mind what has done it: the new > polys. Basically, the polys in SymPy have been rewritten completely and now > many operations, especially those related to simplification, are an order of > magnitude faster than they were before. > > So basically, until SymPy 0.7.0 comes out (which could be some time; we don't > exactly have a roadmap for it yet), I would recommend that you work off of > the bleeding edge development version, which is the git master. Since your > script has a shebang line, I am assuming you are on some kind of Unix. > Basically, if you have never used git before, you need to just install it and > run > > git clone git://github.com/sympy/sympy.git > > in whatever directory you want to put it, and then > > cd sympy > ./bin/isympy > > or you can install it using > > ./setup.py install > > (sorry if you already know how to use git, but I am just trying to be helpful > since most people don't) > > If you want to contribute to SymPy, which you are always welcome to do so, > there are more things about git to learn, but if you just want to pull down > the bleeding edge, that is it. The command > > git pull > > will update it whenever you want. > > Please let us know how that works out for you. > > Aaron Meurer > > P.S., I just realized that this is the second time in so many days that I > have explained this in an email, so I think I am going to make a wiki page > for it :)
http://code.google.com/p/sympy/wiki/GettingTheBleedingEdge > > On Jul 30, 2010, at 7:14 PM, Nico wrote: > > > > > Hi all, > > > this is a SymPy first-timer writing. > > I just constructed a symbolic 3x3 matrix and would like to get the > > determinant of it (code -- approx 30 lines -- is below), but this > > appears to be a major task -- sympy hangs for ages (i.e., five minutes > > and more). I don't know what I'm doing wrong -- is that a bug in > > SymPy; using v0.6.7 here. > > > Any hints? > > > Cheers, > > Nico > > > ========================= *snip* ========================= > > #! /usr/bin/env python > > # -*- coding: utf-8 -*- > > ''' > > Calculates the J^{-1} J{-T} for where J is the Jacobian of the > > bilinear mapping of the reference quadrilateral (-1,1)^2 to a given > > quadrilateral in space. > > ''' > > from sympy import pprint, Symbol > > import sys > > sys.displayhook = pprint > > from sympy.matrices import * > > > # x0,...,x4 determine the quadrilateral > > x00 = Symbol( 'x00' ) > > x01 = Symbol( 'x01' ) > > x02 = Symbol( 'x02' ) > > x0 = Matrix( [ x00, x01, x02 ] ) > > > x10 = Symbol( 'x10' ) > > x11 = Symbol( 'x11' ) > > x12 = Symbol( 'x12' ) > > x1 = Matrix( [ x10, x11, x12 ] ) > > > x20 = Symbol( 'x20' ) > > x21 = Symbol( 'x21' ) > > x22 = Symbol( 'x22' ) > > x2 = Matrix( [ x20, x21, x22 ] ) > > > x30 = Symbol( 'x30' ) > > x31 = Symbol( 'x31' ) > > x32 = Symbol( 'x32' ) > > x3 = Matrix( [ x30, x31, x32 ] ) > > > # The bilinear map > > # > > # F(hat{x}, hat{y} = alpha + beta hat{x} + gamma hat{y} + delta > > hat{x} hat{y} > > # > > # maps the reference quadrilateral (-1,1)^2 to the actual > > quadrilateral > > # determined by the points x0,...,x3. > > alpha = ( x0 + x1 + x2 + x3 ) / 4 > > beta = ( - x0 + x1 + x2 - x3 ) / 4 > > gamma = ( - x0 - x1 + x2 + x3 ) / 4 > > delta = ( x0 - x1 + x2 - x3 ) / 4 > > > # The Jacobian of F is formed by > > # > > # J ( hat{x}, hat{y} ) = [ beta + delta hat{y}, gamma + delta hat{x}, > > C ]. > > # > > # The last column can be chosen arbitrarily, so to avoid singularities > > take it > > # to be the cross product of the first two columns. > > hatx = Symbol( 'hat{x}' ) > > haty = Symbol( 'hat{y}' ) > > C1 = beta + delta * haty > > C2 = gamma + delta * hatx > > C3 = C1.cross( C2 ).transpose() > > > J = C1.row_join(C2).row_join(C3) > > > #print J.det().simplify() > > print J > > print J.det() > > print J.inv() > > ========================= *snap* ========================= > > > -- > > 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 > > athttp://groups.google.com/group/sympy?hl=en. -- 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.