Archive for August, 2009

Speed improvements for ask() (sympy.queries.ask)

Thursday, August 20th, 2009

I managed to overcome the overhead in ask() that arises when converting between symbol and integer representation of sentences in conjunctive normal.
The result went beyond what I expected. The test suite for the query module got 10x times faster in my laptop. From 26 seconds, it descended to an impressive 2.03 secs. There is still […]

Logic module (sympy.logic): improving speed

Tuesday, August 18th, 2009

Today I’ve been doing some speed improvements for the logic module. More precisely, I implemented an efficient internal representation for clauses in conjunctive normal form.
In practice this means a huge performance boost for all problems that make use the function satisfiable() or dpll_satisfiable(). For example, test_dimacs.py has moved from 2.7 seconds to an impressive 0.3 […]

Refine module

Monday, August 17th, 2009

This commit introduced a new module in sympy: the refine module.
The purpose of this module is to simplify expressions when they are bound to assumptions. For example, if you know that x>0, then you can simplify abs(x) to x. This code was traditionally embedded into the core, but now this will be part of an […]

Query module - finally in trunk

Monday, August 10th, 2009

The query module is finally in the main SymPy repository. I made substantial changes since last post, most of them at the user interface level (thanks to Vinzent and Mateusz for many insightful comments).
Main function is ask(), which replaces the old expression.is_* syntax. You can ask many things. For example, you can ask if a […]

django, change language settings dynamically

Friday, August 7th, 2009

After some failed attempts, I just found how to change the language settings dynamically in django, and I thought it could be useful to someone. Just use function activate() from django.utils.translation. For example:

from django.utils.translation import activate
activate(‘es-ES’)

will change global language settings to ‘es-ES’ (Spain spanish). I use it because I have two forms and I want […]