Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
On Jun 2, 2011, at 10:09 PM, Ronan Lamy wrote: > Le jeudi 02 juin 2011 à 21:28 -0600, Aaron S. Meurer a écrit : >> On Jun 2, 2011, at 9:21 PM, Ronan Lamy wrote: >> >>> Le jeudi 02 juin 2011 à 17:07 -0600, Aaron S. Meurer a écrit : On May 31, 2011, at 11:11 AM, Ronan Lamy wrote: >

Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Ronan Lamy
Le jeudi 02 juin 2011 à 21:28 -0600, Aaron S. Meurer a écrit : > On Jun 2, 2011, at 9:21 PM, Ronan Lamy wrote: > > > Le jeudi 02 juin 2011 à 17:07 -0600, Aaron S. Meurer a écrit : > >> On May 31, 2011, at 11:11 AM, Ronan Lamy wrote: > >> > >>> Le mardi 31 mai 2011 à 09:43 -0700, Vinzent Steinberg

[sympy] SymPy and gmpy

2011-06-02 Thread casevh
Hello, I'm the maintainer of gmpy. I am working on a new version (gmpy2) and I'm curious if there are any enhancements or improvements that would help SymPy? casevh -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to

Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
On Jun 2, 2011, at 9:21 PM, Ronan Lamy wrote: > Le jeudi 02 juin 2011 à 17:07 -0600, Aaron S. Meurer a écrit : >> On May 31, 2011, at 11:11 AM, Ronan Lamy wrote: >> >>> Le mardi 31 mai 2011 à 09:43 -0700, Vinzent Steinberg a écrit : On May 30, 9:52 pm, Mateusz Paprocki wrote: > That co

Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Ronan Lamy
Le jeudi 02 juin 2011 à 17:07 -0600, Aaron S. Meurer a écrit : > On May 31, 2011, at 11:11 AM, Ronan Lamy wrote: > > > Le mardi 31 mai 2011 à 09:43 -0700, Vinzent Steinberg a écrit : > >> On May 30, 9:52 pm, Mateusz Paprocki wrote: > >>> That could work: > >>> > >>> ZZ.sum([1, 2, 3]) -> sum([1,

Re: [sympy] Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
I created http://code.google.com/p/sympy/issues/detail?id=2445 for this. Aaron Meurer On Jun 2, 2011, at 9:01 PM, Aaron S. Meurer wrote: > I see. It would be nice to have a function, call it timings_graph() or > something, that acts similar to the timed() function. You just pass it some > li

Re: [sympy] Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
I see. It would be nice to have a function, call it timings_graph() or something, that acts similar to the timed() function. You just pass it some lists of source code that you want to plot (or maybe multiple lists for multiple lines), a list of x-axis values, and other information like axes

[sympy] Some changes to representations in sympy.physics.quantum

2011-06-02 Thread Tomo Lazovich
Hello everyone, I've been working on changing represent.py and related functions in sympy.physics.quantum so that we can represent operators and states in position and momentum bases. As a start to this, after discussion with Brian and Ondrej, I started trying to build functions to give default la

Re: [sympy] Borrowing ideas from Polys to Matrix

2011-06-02 Thread Mateusz Paprocki
Hi, On 3 June 2011 01:15, Aaron S. Meurer wrote: > > In [1] you will find a very simple comparison of Integer, int and mpz. > This applies to the rational case as well, just the difference is even > bigger. > > Did you make those graphs manually, or do you have some program that > automates it?

Re: [sympy] Re: Problem with user-defined functions

2011-06-02 Thread Aaron S. Meurer
Is there a specific reason why you want to use evalf() to do your lookups, or is it just because you want something that will recurse down the expression tree? Aaron Meurer On Jun 2, 2011, at 2:10 PM, luke wrote: > My bad, sorry for my inexperience with sympy, final code: (this is > really w

Re: [sympy] Re: Problem with user-defined functions

2011-06-02 Thread Aaron S. Meurer
This is indeed a very interesting application of SymPy. Here we see one example of the power of symbolic computer algebra systems, which is that symbolic preprocessing, even very simple preprocessing like what we have here, can greatly optimize arbitrary code execution. If your expressions a

Re: [sympy] Solving equations with exp

2011-06-02 Thread Aaron S. Meurer
Yeah, it would be cool to have assumptions for functions. Stuff like one-to-one, onto, increasing, strictly increasing (implies one-to-one), continuous, etc. Aaron Meurer On Jun 2, 2011, at 12:52 PM, Christophe BAL wrote: > Hello. > > >>> On the other hand, maybe solve should be able to tell

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Aaron S. Meurer
On Jun 2, 2011, at 10:13 AM, sherjiloz...@gmail.com wrote: > Yes and no and no. > Numpy/scipy matrices have their backend in C/fortran types. Arbitrary objects > can't be put inside them. > > That's where sympy comes in and finds a market for its use. I'm adding a > dtype(the usgae of this na

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Aaron S. Meurer
On Jun 2, 2011, at 9:48 AM, Brian Granger wrote: > On Thu, Jun 2, 2011 at 1:28 AM, Mateusz Paprocki wrote: >> Hi, >> >> On 2 June 2011 04:09, Brian Granger wrote: >>> >>> Is there a link somewhere to documentation about the groundtypes in >>> polys? I am interested why such things are needed

Re: [sympy] Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
> In [1] you will find a very simple comparison of Integer, int and mpz. This > applies to the rational case as well, just the difference is even bigger. Did you make those graphs manually, or do you have some program that automates it? It would be nice to have something that can make timing gr

Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Aaron S. Meurer
On May 31, 2011, at 11:11 AM, Ronan Lamy wrote: > Le mardi 31 mai 2011 à 09:43 -0700, Vinzent Steinberg a écrit : >> On May 30, 9:52 pm, Mateusz Paprocki wrote: >>> That could work: >>> >>> ZZ.sum([1, 2, 3]) -> sum([1, 2, 3]) >>> RR.sum([1.0, 2.0]) -> mpmath.fsum([1.0, 2.0]) >>> EX.sum([x, y, z

Re: [sympy] Re: repr and srepr

2011-06-02 Thread Aaron S. Meurer
On Jun 1, 2011, at 9:35 PM, Ronan Lamy wrote: > Le mercredi 01 juin 2011 à 20:12 -0600, Aaron Meurer a écrit : >> A few things: >> >> - Even if we made isympy play nice, doctests assume just a regular >> pure Python shell. So any doctest of a function that somehow has a >> list, tuple, or dict o

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
My bad, sorry for my inexperience with sympy, final code: (this is really working!) class SUM(Function): nargs = 1 def _eval_evalf(cls, prec): print cls.args map = Code("""function () { emit("sum",{%(field)s:this.%(field)s}); }"""

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
Nope in spite of my enthusiasm cls.args wont work properly as it will give me a and not a :) I'll put back my eval since it worked. Hope that was of any help! On Jun 2, 9:32 pm, luke wrote: > WAIT, I didn't see that you use > self.arg[0]!! that's why my code was giving me 57, I just need to ca

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
WAIT, I didn't see that you use self.arg[0]!! that's why my code was giving me 57, I just need to call cls.arg[0], great now I can remove the eval ;)! thanks again On Jun 2, 9:30 pm, luke wrote: > Actually you're wrong. Every instance of a class in python has its own > attributes and editing the

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
Actually you're wrong. Every instance of a class in python has its own attributes and editing the attributes of one instance of a class wont modify the attributes of the other classes. Try: class MyClass: def __init__(self,var): self.var=var then execute: >>> a = MyClass(10) >>> pri

Re: [sympy] Solving equations with exp

2011-06-02 Thread Christophe BAL
Hello. >>> On the other hand, maybe solve should be able to tell >>> that f(x) - f(y) == 0 implies the solution x == y >>> (but there may be more solutions unless f is one-to-one). Ir could be a nice feature to have the possibility to declare a function to be one-to-one so as to solve the very si

Re: [sympy] Trying out Tox

2011-06-02 Thread Aaron S. Meurer
Do you know if there is a way to have a tox.ini file that is tracked by git, but to still locally set somehow the paths to various Python binaries (for example, I have two binaries for each version of Python, one 32-bit and one 64-bit)? Aaron Meurer On May 28, 2011, at 1:42 PM, Vlada Peric

Re: [sympy] Uses and Size of Sympy Matrices

2011-06-02 Thread Aaron Meurer
I use Matrices in the Risch algorithm. See https://github.com/asmeurer/sympy/blob/integration3/sympy/integrals/prde.py#L155. The function in the test at https://github.com/asmeurer/sympy/blob/integration3/sympy/integrals/tests/test_prde.py#L59 should give you an idea of a typical usage. The matr

Re: [sympy] Re: Problem with user-defined functions

2011-06-02 Thread Ronan Lamy
Le jeudi 02 juin 2011 à 09:35 -0700, luke a écrit : > Yes, that worked. But I had to restructure the code > > class SUM(Function): > nargs = 2 > @classmethod > def eval(cls, arg): > cls.arg=arg > @classmethod > def _eval_evalf(cls, arg): > map = Code("""function

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
Yes, that worked. But I had to restructure the code class SUM(Function): nargs = 2 @classmethod def eval(cls, arg): cls.arg=arg @classmethod def _eval_evalf(cls, arg): map = Code("""function () { emit("sum",{%(field)s:this.%(field)s});

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread sherjilozair
Yes and no and no. Numpy/scipy matrices have their backend in C/fortran types. Arbitrary objects can't be put inside them. That's where sympy comes in and finds a market for its use. I'm adding a dtype(the usgae of this name might be wrong) argument to sympy matrices. 6 basic types, ints, rati

Re: [sympy] Re: Problem with user-defined functions

2011-06-02 Thread Ronan Lamy
Le jeudi 02 juin 2011 à 08:03 -0700, luke a écrit : > Oh, thanks a lot. Now it's working fine. > Now the only problem is that the code is evaluated when calling > sympify, and not when calling evalf. > Could I ask you what is the way to keep the function lazy? I explain > myself better. Since the f

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Brian Granger
I am a bit confused here as well. Are you considering adding a dtype argument to sympy.Matrix? Are you consider making sympy.Expr objects work inside numpy matrices? Are you considering making sympy.Expr work inside scipy.sparse matrices? Cheers, Brian On Wed, Jun 1, 2011 at 9:27 PM, SherjilOza

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Brian Granger
On Thu, Jun 2, 2011 at 1:28 AM, Mateusz Paprocki wrote: > Hi, > > On 2 June 2011 04:09, Brian Granger wrote: >> >> Is there a link somewhere to documentation about the groundtypes in >> polys?  I am interested why such things are needed?  It sort of sounds >> like there are two semi-independent c

Re: [sympy] an old pull request

2011-06-02 Thread Brian Granger
Sorry I haven't gotten to this review yet, we are in the middle of the last week of classes+finals. I will do this soon though. Cheers, Brian On Thu, Jun 2, 2011 at 3:44 AM, krastanov.ste...@gmail.com wrote: > Hi, > > I'm writing about an old pull request regarding some bugs/enhancements in >

[sympy] Re: Problem with user-defined functions

2011-06-02 Thread luke
Oh, thanks a lot. Now it's working fine. Now the only problem is that the code is evaluated when calling sympify, and not when calling evalf. Could I ask you what is the way to keep the function lazy? I explain myself better. Since the function SUM has to operate on a database if I have something l

[sympy] an old pull request

2011-06-02 Thread krastanov.ste...@gmail.com
Hi, I'm writing about an old pull request regarding some bugs/enhancements in the printing of the quantum module: https://github.com/sympy/sympy/pull/186 A week ago I explained it in more details here: https://groups.google.com/d/topic/sympy/ZacngABe3Ws/d

Re: [sympy] My first gsoc pull request

2011-06-02 Thread Tom Bachmann
no hurry :-) On 02.06.2011 06:38, Aaron Meurer wrote: I'll also try to review it, though I presently a little backlogged because of my vacation. Aaron Meurer On Tue, May 31, 2011 at 11:35 AM, Ondrej Certik wrote: Hi Tom, On Tue, May 31, 2011 at 8:21 AM, Tom Bachmann wrote: Hi all, I just

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Mateusz Paprocki
Hi, On 2 June 2011 06:27, SherjilOzair wrote: > scipy.sparse implements a dtype kwarg argument, but which currently > cannot take in arbitrary unknown types though. > Comparing two entities from two very different libraries may be misleading, because SciPy has different needs and SymPy has diff

Re: [sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread Mateusz Paprocki
Hi, On 2 June 2011 04:09, Brian Granger wrote: > Is there a link somewhere to documentation about the groundtypes in > polys? I am interested why such things are needed? It sort of sounds > like there are two semi-independent code bases living here... > See my previous response. Unfortunately

Re: [sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread Mateusz Paprocki
Hi, On 2 June 2011 09:56, SherjilOzair wrote: > Well, if Domain.sum(...) is significantly faster than sum(elements of > Domain), then its pretty reasonable that it should be implemented. sum > is almost as important as +, -, * and /. sum is used in many > algorithms. Matrix algorithms particular

[sympy] Re: A simple idea regarding groundtypes for Matrix

2011-06-02 Thread SherjilOzair
I added my views there. http://code.google.com/p/sympy/issues/detail?id=2042 On Jun 2, 9:34 am, SherjilOzair wrote: > I need review on this style for matrix groundtypes, i.e. having a list > of builtin dtypes, and an other option for misc backends. > Do you think the list of builtins is good eno

[sympy] Re: Borrowing ideas from Polys to Matrix

2011-06-02 Thread SherjilOzair
Well, if Domain.sum(...) is significantly faster than sum(elements of Domain), then its pretty reasonable that it should be implemented. sum is almost as important as +, -, * and /. sum is used in many algorithms. Matrix algorithms particularly use sum for dot products. If you see my code for the

Re: [sympy] Problem with user-defined functions

2011-06-02 Thread Mateusz Paprocki
Hi, On 2 June 2011 09:07, luke wrote: > Hi eveyone, > I'm developing an web application which has to interact with "user- > defined formulas" of some financial kpis. > I decided to use sympy to have a more solid math engine. > Basically the input I reiceve is very simple, it might be in the wors

[sympy] Problem with user-defined functions

2011-06-02 Thread luke
Hi eveyone, I'm developing an web application which has to interact with "user- defined formulas" of some financial kpis. I decided to use sympy to have a more solid math engine. Basically the input I reiceve is very simple, it might be in the worst case something like: kpi -> "(log(sum('productio