[sympy] UnicodeDecodeError when using xsym("*")

2009-05-28 Thread Luke
I subclassed StrPrinter to define my own printing of some of my classes, and I can't seem to make xsym("*") work. I keep getting a UnicodeDecodeError. Here is a code snippet of what I'm doing: else: if i == 0: if isinstance(e.dict[

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Well, print xsym("*") works, i.e. it prings a nice small *, i.e., when you do x*y in isympy, this is the default behavior. but when I put xsym("*") into a string that is used in the _print_Vector(self, e) function in my subclass of StrPrinter, it doesn't print, instead it generates the UnicodeDeco

[sympy] Improving match

2009-05-28 Thread asmeurer
The match function is the most important part of dsolve. It relies on it heavily to determine what type an ODE is to see if it can solve it and if so how. Unfortunately, it currently has some issues: 1) Issue 1429 (http://code.google.com/p/sympy/issues/detail? id=1429&q=match). The following re

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Sebastian
Luke wrote: > Ok, thanks. > > Any ideas regarding the xsym("*") error? Not really, I don't even know where this xsym comes from and what it does, but maybe you are printing unicode to a non-unicode terminal? Sebastian --~--~-~--~~~---~--~~ You received this mes

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Ok, thanks. Any ideas regarding the xsym("*") error? Thanks, ~Luke On May 28, 6:26 pm, Sebastian wrote: > Luke wrote: > > Sebastian, > >   Thanks again for the responses, I really appreciate it.  I was a > > little confused in your second example, see below. > > > On May 28, 5:17 pm, Sebastian

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Sebastian
Luke wrote: > Sebastian, > Thanks again for the responses, I really appreciate it. I was a > little confused in your second example, see below. > > On May 28, 5:17 pm, Sebastian wrote: >> Luke wrote: >>> Sebastian, >>> Thanks for the reply. I have read printer.py, str.py, and repr.py, >>>

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Sebastian, Thanks again for the responses, I really appreciate it. I was a little confused in your second example, see below. On May 28, 5:17 pm, Sebastian wrote: > Luke wrote: > > Sebastian, > >   Thanks for the reply.  I have read printer.py, str.py, and repr.py, > > and am still confused a

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Also, how can I get the xsym("*") character to display correctly? When I do print xsym("*") it works fine, i.e., I get the small dot that looks nice. But in my printing methods where I build the string for the outputs, and I do something like: s += print_pydy(e.dict[k]) + xsym('*') + k.__str__()

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Sebastian
Luke wrote: > Sebastian, > Thanks for the reply. I have read printer.py, str.py, and repr.py, > and am still confused as to how to properly customize Sympy's printing > system. > > Suppose I want to put the _print_myclass(self, e) code into my > subclass of StrPrinter. What methods should I k

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Sebastian, Thanks for the reply. I have read printer.py, str.py, and repr.py, and am still confused as to how to properly customize Sympy's printing system. Suppose I want to put the _print_myclass(self, e) code into my subclass of StrPrinter. What methods should I keep in the classes themsel

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Sebastian
Hi Luke, I think all your questions are answered in the docstring of printing/printer.py. There it tells you in which order it is tried to print an object. 1) Let the object print itself if it has the method defined as printmethod. 2) Use the method defined in the Printer if available. 3) Use so

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
One thing I forgot to ask: I'm getting weird error messages when I try to use the xsym("*") character. I had put it in my _sympystr_ method of one of my classes, and I keep getting the following error: File "t.py", line 53, in print 'print A[1]', Vector(sin(q1)*A[1] + cos(q1)*A[1]) File

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
Sorry, I accidentally clicked send before I had finished. A few questions: So here is part of my PyDyPrinter class: class PyDyPrinter(StrPrinter): printmethod = "_pydystr_" ... def _print_sin(self, e): name = str(e.args[0]) if name[0] == "q": index = name[

[sympy] Re: Function vs. Symbol

2009-05-28 Thread Luke
I'm a little unclear about a few things with regards to how to properly subclass StrPrinter. On May 27, 5:08 pm, Ondrej Certik wrote: > On Wed, May 27, 2009 at 6:05 PM, Luke wrote: > > > I like the first way for the fact that it just has 'x' instead of 'x > > (t)', but I like the second way b