On Thu, May 28, 2009 at 10:23 PM, Luke hazelnu...@gmail.com wrote:
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
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 ond...@certik.cz wrote:
On Wed, May 27, 2009 at 6:05 PM, Luke hazelnu...@gmail.com wrote:
I like the first way for the fact that it just has 'x' instead of 'x
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[1]
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 module
print 'print A[1]', Vector(sin(q1)*A[1] + cos(q1)*A[1])
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
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
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 keep in
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__()
It
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 basti...@gmail.com wrote:
Luke wrote:
Sebastian,
Thanks for the reply. I have read printer.py, str.py, and
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 message
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
Luke wrote:
I'm trying to better understand how Sympy is structured with regard to
Function and Symbol.
In most problems I have encountered with ODE's (and PDE's, but I'll
limit my discussion to ODE's) of the form:
dx/dt = f(x, t) x \in R^n, f: R^n x R --- R^n
there simply is no
Fabian,
I think the example you gave is good, but I think it would be better
if you could imply that x == x(t) upon instantiation, rather than
anytime you need to take the derivative, so that you would have
something like:
In [1]: t = Symbol('t')
In [2]: x = Symbol('x', args=[t])
In [3]:
Here is a concrete example of the behavior that I think would be very
useful:
(1) variables x{3}'
(2) e = sin(x1 - x2)
- (3) e = SIN(x1-x2)
(4) f = x3*e*tan(x2)*sin(e)
- (5) f = x3*TAN(x2)*e*SIN(e)
(6) test = dt(f)
- (7) test = TAN(x2)*e*SIN(e)*x3' + x3*e*SIN(e)*x2'/COS(x2)^2 +
On Wed, May 27, 2009 at 12:53 PM, Luke hazelnu...@gmail.com wrote:
Fabian,
I think the example you gave is good, but I think it would be better
if you could imply that x == x(t) upon instantiation, rather than
anytime you need to take the derivative, so that you would have
something like:
We discuss this on IRC with Luke and Fabian. Now I understand -- Luke
wants the result of differentiating not to be instances of
Derivative() class, but rather some other symbols, e.g it should
substitute them for symbols at the end.
One way to do it is to subclass the Symbol() class that does
I like the first way for the fact that it just has 'x' instead of 'x
(t)', but I like the second way because it is simpler and easier to
implement.
Is there a way to redefined how x = Symbol('x')(t) would print? I
guess subclassing would be one option, take care of it there, and then
use the
On Wed, May 27, 2009 at 6:05 PM, Luke hazelnu...@gmail.com wrote:
I like the first way for the fact that it just has 'x' instead of 'x
(t)', but I like the second way because it is simpler and easier to
implement.
The first way needs patching sympy, exactly because it things that x
is just x
What I wrote in the other thread is wrong. You can make x an implicit
function of t. Do
t = Symbol('t')
x = Function('x')(t)
x_ = diff(x, t)
x
x(t)
x_
d
──(x(t))
dt
See the docstring for dsolve.
I agree that typing f(x) and f(x).diff(x) is very time consuming if
you have a lot
19 matches
Mail list logo