[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Toon Verstraelen
Aaron S. Meurer wrote: > Do you think we would need to run a configure [0] script for this? I > am not highly familiar with this, but it seems that any time I > download come C that needs to be compiled (i.e., an open source > software package), it uses configure and make to ensure that it

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Toon Verstraelen
Ondrej Certik wrote: > Configure is a big pain. Yes, I suggest to use strictly ansi C, then > we are fine. If we need any other math libraries besides what's in the > ansi C, then I suggest we simply attach the C file implementing for > example the bessel functions or somethig -- or, we just use mp

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Toon Verstraelen
Vinzent Steinberg wrote: > You could use tcc [1], which is much faster (especially if you use > libtcc and avoid any file creation -- sadly it's usually a pain to set > it up). See sympy/utilities/compilef.py for an interface. There is > also some primitive and specialized code generation. > > The

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 3:25 AM, Toon Verstraelen wrote: > Ondrej Certik wrote: >> Configure is a big pain. Yes, I suggest to use strictly ansi C, then >> we are fine. If we need any other math libraries besides what's in the >> ansi C, then I suggest we simply attach the C file implementing for >>

[sympy] Re: error raising

2009-06-08 Thread smichr
On Jun 8, 5:50 am, Ondrej Certik wrote: > > I agree that some deep backtrace is confusing, especially if it's > something that the users do frequently. > > Could you please paste here the exact output, so that we can discuss > some particular example? > ### >>> from sympy import * >>> x=var('x'

[sympy] factor a negative 1 out of a fraction

2009-06-08 Thread Ryan Krauss
So, I have yet another simplification question. What is the correct way to factor a minus one out of this: In [108]: type(x2_tf_ds) Out[108]: In [109]: x2_tf_ds Out[109]: -Gc*k/(-Gc*k - k*m1*s**2 - k*m2*s**2 - m1*m2*s**4) This didn't work: In [110]: sympy.simplify(x2_tf_ds) Out[110]: -Gc*k/(-G

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Aaron S. Meurer
You might look into could_extract_minus_sign: >>> sympify('-Gc*k/(-Gc*k - k*m1*s**2 - k*m2*s**2 - m1*m2*s**4)').could_extract_minus_sign() True >>> sympify('Gc*k/(-Gc*k - k*m1*s**2 - k*m2*s**2 - m1*m2*s**4)').could_extract_minus_sign() False Perhaps simplify() should do if expr.could_extra

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Brian Granger
I haven't followed this too closely, but why not simply write a simple setup.py script for the generated code and let distutils create the extension module? Calling gcc by hand will be quite painful if you really want to do it in a cross platform manner. Cheers, Brian --~--~-~--~~-

[sympy] Re: simplification changes exponent

2009-06-08 Thread Ryan Krauss
I am running the same version of sympy and python 2.6 and cannot reproduce your error either: In [6]: a,y=sympy.var('a y') In [7]: a Out[7]: a In [8]: y Out[8]: y In [9]: sympy.simplify(y**5/a) Out[9]: y**5/a In [10]: sympy.simplify(a*y**5) Out[10]: a*y**5 In [11]: sympy.__version__ Out[11]: '

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Ryan Krauss
I like that. I am glad to write a patch if this is the desired behavior of simplify. Does there need to be a check for whether or not something is a fraction first? Is checking for denom == 1 the best way to do that? In [146]: a,b = x2_tf_ds.as_numer_denom() In [147]: a Out[147]: Gc*k In [148

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Aaron S. Meurer
I wouldn't bother checking. If the expression is not a fraction, yes the denom term will be 1, but the code I suggested will do nothing to it. >>> (-x).could_extract_minus_sign() True >>> n,d = (-x).as_numer_denom() >>> n -x >>> d 1 >>> -n/-d -x One thing you might want to consider is t

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 11:57 AM, Brian Granger wrote: > > I haven't followed this too closely, but why not simply write a simple > setup.py script for the generated code and let distutils create the > extension module?  Calling gcc by hand will be quite painful if you > really want to do it in a c

[sympy] Re: simplification changes exponent

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 12:07 PM, Ryan Krauss wrote: > I am running the same version of sympy and python 2.6 and cannot reproduce > your error either: > In [6]: a,y=sympy.var('a y') > > In [7]: a > Out[7]: a > > In [8]: y > Out[8]: y > > In [9]: sympy.simplify(y**5/a) > Out[9]: y**5/a > > In [10]:

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 12:36 PM, Aaron S. Meurer wrote: > I wouldn't bother checking.  If the expression is not a fraction, yes the > denom term will be 1, but the code I suggested will do nothing to it. (-x).could_extract_minus_sign() > True n,d = (-x).as_numer_denom() n > -x

[sympy] Re: error raising

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 8:45 AM, smichr wrote: > > > > On Jun 8, 5:50 am, Ondrej Certik wrote: >> >> I agree that some deep backtrace is confusing, especially if it's >> something that the users do frequently. >> >> Could you please paste here the exact output, so that we can discuss >> some parti

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Ryan Krauss
Cool. I can do this in the next couple of days (also need to learn to use git-rebase and clean up my branches so I can see the forest). On Mon, Jun 8, 2009 at 1:53 PM, Ondrej Certik wrote: > > On Mon, Jun 8, 2009 at 12:36 PM, Aaron S. Meurer > wrote: > > I wouldn't bother checking. If the expr

[sympy] Re: git and site-package coexistence

2009-06-08 Thread Ondrej Certik
On Sun, Jun 7, 2009 at 3:35 PM, smichr wrote: > > >> >> Try it without the quotes. Entries are separated by newlines, not >> arbitrary whitespace, so quotes are unnecessary. Examine your >> sys.path. >> >> -- > > That was the solution. Thanks to all that gave suggestions. I like the > idea of the

[sympy] Re: git and site-package coexistence

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 1:05 PM, Ondrej Certik wrote: > On Sun, Jun 7, 2009 at 3:35 PM, smichr wrote: >> >> >>> >>> Try it without the quotes. Entries are separated by newlines, not >>> arbitrary whitespace, so quotes are unnecessary. Examine your >>> sys.path. >>> >>> -- >> >> That was the solutio

[sympy] Re: factor a negative 1 out of a fraction

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 1:03 PM, Ryan Krauss wrote: > Cool.  I can do this in the next couple of days (also need to learn to use > git-rebase and clean up my branches so I can see the forest). Excellent. Ping me if you have some other patches that are still not in. Ondrej --~--~-~--~

[sympy] Re: Test for symbol

2009-06-08 Thread Ondrej Certik
On Sun, Jun 7, 2009 at 7:32 AM, Alan Bromborsky wrote: > > Gael Varoquaux wrote: >> On Sun, Jun 07, 2009 at 08:38:44AM -0400, Alan Bromborsky wrote: >> >>> Actually what I should have asked is how can you test if a function has >>> a particular argument >>> >> >> Check out the inspect module. >> >

[sympy] making fraction put minus terms in the denom

2009-06-08 Thread Aaron S. Meurer
Would doing this be a good idea (see patch below)? It would fix the failed doctest that I uncommented, but it might do unexpected things with some exponents. >>> print fraction(exp(y-x)) (exp(y - x), 1) >>> print fraction(exp(x-y)) (1, exp(y - x)) What do you think? Changing this doesn't se

[sympy] Re: running tests before committing

2009-06-08 Thread Ondrej Certik
Hi Vinzent, On Sat, Jun 6, 2009 at 7:57 AM, Vinzent Steinberg wrote: > > What about a git hook that runs all tests affected by a change before > committing? See for example > > http://github.com/Arora/arora/blob/ca6cf65947ca10ace90291efa6b7160c9bb6d2a3/git_hooks/pre-commit_autotest I think that

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Robert Kern
On Mon, Jun 8, 2009 at 13:40, Ondrej Certik wrote: > > On Mon, Jun 8, 2009 at 11:57 AM, Brian Granger wrote: >> >> I haven't followed this too closely, but why not simply write a simple >> setup.py script for the generated code and let distutils create the >> extension module?  Calling gcc by hand

[sympy] Re: How can I know if a symbol a fraction or not?

2009-06-08 Thread Ondrej Certik
On Sat, Jun 6, 2009 at 3:25 AM, smichr wrote: > > > > On Jun 6, 12:36 pm, Ivannie wrote: >> Hello everyone, >> >>     Now I am doing something on trigsimp in simplify.py, I wonder how >> can I get to know if a symbol a fraction? >> > > Do you mean a symbol or do you mean an expression? I'm not su

[sympy] Re: matching

2009-06-08 Thread Ondrej Certik
On Fri, Jun 5, 2009 at 9:27 PM, smichr wrote: > > > > On Jun 5, 9:32 am, "Aaron S. Meurer" wrote: >> I cannot reproduce this.  match returns None for me in that case.  If >> it returns b:3, then it is wrong. > > I'm not sure what's different. I just synced my python sympy with the > git master sy

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 1:18 PM, Robert Kern wrote: > scipy.weave already has most of the infrastructure that you need. Do you mean the build support stuff? Or code generation? Btw, to learn it, just download the scipy repo and read the files in scipy/weave, like scipy/weave/doc/tutorial.txt Ond

[sympy] Re: codegen: tests that generate output files

2009-06-08 Thread Robert Kern
On Mon, Jun 8, 2009 at 14:39, Ondrej Certik wrote: > > On Mon, Jun 8, 2009 at 1:18 PM, Robert Kern wrote: >> scipy.weave already has most of the infrastructure that you need. > > Do you mean the build support stuff? Or code generation? Build support. > Btw, to learn it, just download the scipy r

[sympy] Re: running tests before committing

2009-06-08 Thread Vinzent Steinberg
On Jun 8, 9:15 pm, Ondrej Certik wrote: > Hi Vinzent, > > On Sat, Jun 6, 2009 at 7:57 AM, Vinzent > > Steinberg wrote: > > > What about a git hook that runs all tests affected by a change before > > committing? See for example > > >http://github.com/Arora/arora/blob/ca6cf65947ca10ace90291efa6b716

[sympy] Question regarding nonsquare Jacobian

2009-06-08 Thread Ben Goodrich
Can someone tell me if there is a subtle reason why the jacobian function in matrices.py is restricted to only work when the Jacobian is square? The example in the documentation is from sympy import symbols, sin, cos rho, phi = symbols("rho phi") X = Matrix([rho*cos(phi), rho*sin(phi)]) Y = Matr

[sympy] Re: Question regarding nonsquare Jacobian

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 5:24 PM, Ben Goodrich wrote: > > Can someone tell me if there is a subtle reason why the jacobian > function in matrices.py is restricted to only work when the Jacobian > is square? > > The example in the documentation is > > from sympy import symbols, sin, cos > rho, phi =

[sympy] Re: Question regarding nonsquare Jacobian

2009-06-08 Thread Ben Goodrich
Thank you. I will do that. -- Ben --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr

[sympy] Re: Question regarding nonsquare Jacobian

2009-06-08 Thread Ben Goodrich
On Jun 8, 8:08 pm, Ben Goodrich wrote: > Thank you. I will do that. -- Ben This is now issue 1465 at http://code.google.com/p/sympy/issues/detail?id=1465 which has my patch. In my opinion, the previous behavior is inconsistent with the definition of a Jacobian, so I hope the patch can be commi

[sympy] Re: Question regarding nonsquare Jacobian

2009-06-08 Thread Ondrej Certik
On Mon, Jun 8, 2009 at 10:29 PM, Ben Goodrich wrote: > > On Jun 8, 8:08 pm, Ben Goodrich wrote: >> Thank you. I will do that. -- Ben > > This is now issue 1465 at > > http://code.google.com/p/sympy/issues/detail?id=1465 > > which has my patch. In my opinion, the previous behavior is > inconsisten

[sympy] Re: matching

2009-06-08 Thread smichr
> > Thanks. It might be a problem just on windows -- I already installed > windows7 into a virtualbox, so I'll try to go over it soon. > There is some change that has taken place in the patching that is causing the problem. 0.6.4 doesn't show the problem, but 0.6.5-git does. In 0.6.4 (3*x).match(

[sympy] Re: matching

2009-06-08 Thread Ondrej Certik
On Tue, Jun 9, 2009 at 12:45 AM, smichr wrote: > >> >> Thanks. It might be a problem just on windows -- I already installed >> windows7 into a virtualbox, so I'll try to go over it soon. >> > > There is some change that has taken place in the patching that is > causing the problem. 0.6.4 doesn't s