[sympy] Re: pip install broken for python 3.3

2013-09-11 Thread Angus Griffith
Is there a workaround for this? I have a python2 application that depends on Sympy and I'm trying to upgrade the dependency to 0.7.3. I've tried a few things but nothing successful yet. (Either the package isn't found or it tries (and consequently) fails to install the python3 version.) sympy

[sympy] Finding whether a number is real

2013-09-11 Thread Thilina Rathnayake
Hi All, I am trying to implement the solutions for cubic Thue equation and to do that I have to solve cubic equations. I use `solve()` to do this. But I am having a little trouble filtering out real solutions from the solution list returned by `solve()`. I tried the following. In [5]: from sy

[sympy] Re: Finding whether a number is real

2013-09-11 Thread mario
The solutions are correct but the real solution is not written in a simple form >>> solutions = solve(2*x**3 - 3*x**2 - 3*x - 1) >>> solutions[1].n() 2.26116669667966 - 0.e-23*I >>> solutions = [s.expand(complex=True) for s in solutions] >>> solutions[1] 1/2 + 3**(1/3)/2 + 3**(2/3)/2 On Wednes

[sympy] Re: pip install broken for python 3.3

2013-09-11 Thread Angus Griffith
I found a workaround: install Sympy from the git repo. For example: pip install git+https://github.com/sympy/sympy.git@sympy-0.7.3 On Wednesday, 11 September 2013 20:04:47 UTC+10, Angus Griffith wrote: > > Is there a workaround for this? > > I have a python2 application that depends on Sympy and

Re: [sympy] Re: Finding whether a number is real

2013-09-11 Thread Thilina Rathnayake
Hi Mario, Thank you for the reply. `solutions = [s.expand(complex=True) for s in solutions]` worked for me, now `im()` and `is_real()` return the correct results. Of course the solutions were correct, the problem was with `im()` and `is_real()` not being able to calculate the correct results. Ma

[sympy] A possible bug in integrate

2013-09-11 Thread Peter Luschny
Consider (F1) sqrt(1+x^3)/x (F2) sqrt(1+1/x^3)*sqrt(x) According to Mathematica's online integrator (I1) integral F1 dx = (2/3)*(sqrt(x^3+1)-arctanh(sqrt(x^3+1))) (I2) integral F2 dx = (2*sqrt(1/x^3+1)*x^(3/2)*(sqrt(x^3+1)-arctanh(sqrt(x^3+1/(3*sqrt(x^3+1)) SymPy Live computes (I1) as (

[sympy] How do I print equality?

2013-09-11 Thread Boris Kheyfets
Hello SymPy users, Suppose I have a = b**2, and I want to pprint: 2 a = b How can I do it? The closest I can get is: #!/usr/bin/python from sympy import * var("a b") a = b**2 pprint({"a": a) But it - prints : instead of = and also - prints ugly {} around equality (or assignme

[sympy] Numerical evaluation in exec?

2013-09-11 Thread Boris Kheyfets
Why this d2bdy2 = b_i.diff(y_i, 2)exec("pprint({{'{0}': {0}}})".format("d2bdy2")) is not equivalent to def assign_and_pprint(Name, Expr): exec("{Name} = {Expr}".format(Name=Name, Expr=Expr)) exec("pprint({{'{Name}': {Name}}})".format(Name=Name)) assign_and_pprint("d2bdy2", b_i.diff(

Re: [sympy] Re: pip install broken for python 3.3

2013-09-11 Thread Ondřej Čertík
On Wed, Sep 11, 2013 at 4:04 AM, Angus Griffith <16sn...@gmail.com> wrote: > Is there a workaround for this? > > I have a python2 application that depends on Sympy and I'm trying to upgrade > the dependency to 0.7.3. > > I've tried a few things but nothing successful yet. (Either the package > isn'

Re: [sympy] A possible bug in integrate

2013-09-11 Thread Ondřej Čertík
Hi Peter! On Wed, Sep 11, 2013 at 7:19 AM, Peter Luschny wrote: > Consider > > (F1) sqrt(1+x^3)/x > (F2) sqrt(1+1/x^3)*sqrt(x) > > According to Mathematica's online integrator > > (I1) integral F1 dx = (2/3)*(sqrt(x^3+1)-arctanh(sqrt(x^3+1))) > (I2) integral F2 dx = > (2*sqrt(1/x^3+1)*x^(3/2)*(sq

Re: [sympy] A possible bug in integrate

2013-09-11 Thread Aaron Meurer
On Wed, Sep 11, 2013 at 10:37 AM, Ondřej Čertík wrote: > Hi Peter! > > On Wed, Sep 11, 2013 at 7:19 AM, Peter Luschny > wrote: >> Consider >> >> (F1) sqrt(1+x^3)/x >> (F2) sqrt(1+1/x^3)*sqrt(x) >> >> According to Mathematica's online integrator >> >> (I1) integral F1 dx = (2/3)*(sqrt(x^3+1)-arct

Re: [sympy] Numerical evaluation in exec?

2013-09-11 Thread Aaron Meurer
It's because the string form of the expression contains division of numeric literals, which exec evaluates to floats. If you want to avoid this, you should use sympify(), or use the srepr() form of the expression instead of the str() form. Aaron Meurer On Wed, Sep 11, 2013 at 7:51 AM, Boris Kheyf

Re: [sympy] How do I print equality?

2013-09-11 Thread Aaron Meurer
Use Eq(), like Eq(a, b**2). Aaron Meurer On Wed, Sep 11, 2013 at 7:24 AM, Boris Kheyfets wrote: > Hello SymPy users, > > Suppose I have a = b**2, and I want to pprint: > > 2 > a = b > > How can I do it? The closest I can get is: > > #!/usr/bin/python > > from sympy import * > > var("a b") >

Re: [sympy] A possible bug in integrate

2013-09-11 Thread Ondřej Čertík
On Wed, Sep 11, 2013 at 11:23 AM, Aaron Meurer wrote: > On Wed, Sep 11, 2013 at 10:37 AM, Ondřej Čertík > wrote: >> Hi Peter! >> >> On Wed, Sep 11, 2013 at 7:19 AM, Peter Luschny >> wrote: >>> Consider >>> >>> (F1) sqrt(1+x^3)/x >>> (F2) sqrt(1+1/x^3)*sqrt(x) >>> >>> According to Mathematica's

Re: [sympy] Re: Finding whether a number is real

2013-09-11 Thread Aaron Meurer
is_real should return the right thing regardless of the form of the expression. See also https://code.google.com/p/sympy/issues/detail?id=4011. I would avoid expanding unless that's the only way to tell. Also note that in general, the real solution from a cubic cannot be written without a nested I

Re: [sympy] Divide by zero when transforming to numerics

2013-09-11 Thread Aaron Meurer
With your example, it matters what order you substitute the variables. If you substitute vx=0 first, you get 0/sqrt(vy**2 + vz**2) == 0. If you substitute vy=vz=0, you get vx/sqrt(vx**2), which should simplify to sqrt(vx) for vx >= 0 (which it is, since vx=0). Can you assume nonnegative for these v

Re: [sympy] A possible bug in integrate

2013-09-11 Thread Aaron Meurer
At https://github.com/sympy/sympy/pull/2128 the algorithms are implemented to simplify this, namely In [1]: a = integrate(sqrt(1 + x**3)/x) In [2]: minpoly(a.diff(x) - sqrt(1 + x**3)/x) Out[2]: x This means that the input satisfies the polynomial x=0, i.e., it is identically 0. This hasn't been

Re: [sympy] Divide by zero when transforming to numerics

2013-09-11 Thread Gilbert Gede
I think a really common example that came up in mechanics was with trig expressions. Here's a simple example (simple relative to actual mechanics expressions): sin(q1(t))*sin(q2(t))*cos(q1(t)) / (sin(q1(t))*sin(q2(t)) + sin(q1(t))*cos(q2(t))) When I substitute in q1(t) = 0, q2(t) = 0, I get nan.

Re: [sympy] Divide by zero when transforming to numerics

2013-09-11 Thread Jason Moore
Thanks Aaron. The main assumption that we can make for our package is that these variables are real numbers, so that will still leave us with divide by zero issues. Maybe once I have a list of expressions that are common to our problems, we can figure out how to deal with that subset. Jason moore

Re: [sympy] Numerical evaluation in exec?

2013-09-11 Thread Boris Kheyfets
Thanks for a reply. I tried it, but: exec("{Name} = sympify({Expr})".format(Name=Name, Expr=Expr)) gives the same, and exec(sympify("{Name} = {Expr}".format(Name=Name, Expr=sympify(Expr gives an error... On Wed, Sep 11, 2013 at 9:29 PM, Aaron Meurer wrote: > It's because the string f

Re: [sympy] How do I print equality?

2013-09-11 Thread Boris Kheyfets
Cool thanks. On Wed, Sep 11, 2013 at 9:30 PM, Aaron Meurer wrote: > Use Eq(), like Eq(a, b**2). > > Aaron Meurer > > On Wed, Sep 11, 2013 at 7:24 AM, Boris Kheyfets > wrote: > > Hello SymPy users, > > > > Suppose I have a = b**2, and I want to pprint: > > > > 2 > > a = b > > > > How can I

Re: [sympy] Divide by zero when transforming to numerics

2013-09-11 Thread Jason Moore
It should only evaluate to zero if the limit of the expression with respect to the evaulated variables goes to zero. 1/x, for example, would not be one that should evaluate to zero. But it would certainly be interesting to know if our operations plus dervitives in mechanics, only ended up with expr

Re: [sympy] Re: Feynman diagrams

2013-09-11 Thread Ondřej Čertík
On Wed, Sep 11, 2013 at 3:55 PM, F. B. wrote: > OK, now I have come to the generalized case. As of now we have two > algorithms in SymPy's master: > > Kahane's algorithm > gamma trace algorithm for simplified expressions (simplified = no Lorentz > contractions) Excellent! > > There are some limi

[sympy] solve eager to round to zero?

2013-09-11 Thread G B
I'm not sure what's causing this, but solve seems to want to call small constants zero: In [1]: from sympy import * In [2]: E,m,c=symbols('E,m,c') In [3]: Energy=Eq(E,m*c**2) In [4]: solve(Energy,E) Out[4]: [c**2*m] In [5]: E2=Energy.subs(c,3e8) In [6]: solve(E2,E) Out[6]: [9.0e+16*m] In [7]:

[sympy] Re: Feynman diagrams

2013-09-11 Thread F. B.
OK, now I have come to the generalized case. As of now we have two algorithms in SymPy's master: 1. Kahane's algorithm 2. gamma trace algorithm for simplified expressions (simplified = no Lorentz contractions) There are some limitations, namely: 1. in dimensional regularization,

[sympy] Re: solve eager to round to zero?

2013-09-11 Thread G B
This appears to have been introduced in 0.7.3. I reverted to 0.7.2 and get the expected results. On Wednesday, September 11, 2013 3:27:22 PM UTC-7, G B wrote: > > I'm not sure what's causing this, but solve seems to want to call small > constants zero: > > In [1]: from sympy import * > In [2]:

Re: [sympy] Theano + Sympy for system of ODEs: Mapping dictionary issue and a few questions

2013-09-11 Thread Guy Parsey
Hello, Due to an up coming conference and a need to get my code in a working state, I have taken a brute force approach which seems to be working pretty well (I am in the middle of testing it). I am very much interested in working with Matt's advice on building up the ODE function from Theano v

[sympy] adding modules to cgi with python

2013-09-11 Thread Erin Hodgess
Hello! Here is a CGI script: #!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # from __future__ import division # from sympy import init_printing integrate Symbol exp cos erf # Create instance of FieldStorage form = cgi.FieldStorage() # Get data from fields first_name

[sympy] how to put sympy in a cgi file

2013-09-11 Thread Erin Hodgess
Hi! I'm trying to run sympy from a Python cgi script. This is what I have: #!/usr/bin/python # Import modules for CGI handling import cgi, cgitb # from __future__ import division # from sympy import init_printing integrate Symbol exp cos erf # Create instance of FieldStorage form = cgi.Fiel

Re: [sympy] Digest for sympy@googlegroups.com - 9 Messages in 7 Topics

2013-09-11 Thread Elita Lobo
On Wed, Sep 11, 2013 at 4:04 PM, wrote: > Today's Topic Summary > > Group: http://groups.google.com/group/sympy/topics > >- pip install broken for python 3.3 <#1410c95d4814c66b_group_thread_0>[1 > Update] >- PyDy Visualization Milestone <#1410c95d4814c66b_group_thread_1> [1 >Update

Re: [sympy] Re: pip install broken for python 3.3

2013-09-11 Thread Angus Griffith
You're right. For some reason (lack of sleep?) I assumed setuptools used pip (but actually it uses easy_install). The actual problem is with setuptools (maybe this is a known problem?). I repeated the steps in the gist (virtualenv etc) with a basic setup.py and it still happens: http://pastebin

Re: [sympy] Re: pip install broken for python 3.3

2013-09-11 Thread Aaron Meurer
Yes, unfortunately, it doesn't seem to be possible to make separate Python 2/3 tarballs work with easy_install. This will be fixed in the next version because we have moved to a single codebase for the two, so there will no longer be separate tarballs. Aaron Meurer On Wed, Sep 11, 2013 at 10:58 P