Re: [sympy] New to sympy,open source

2014-12-04 Thread Sudhanshu Mishra
Hey Devendra,

Go through this document to see how to get involved:

https://github.com/sympy/sympy/wiki/introduction-to-contributing

To learn about GitHub and Git, start with this
https://try.github.io/levels/1/challenges/1

Regards
Sudhanshu Mishra
www.sudhanshumishra.in

On Thu, Dec 4, 2014 at 12:53 PM, Devendra Bendkhale deven1028...@gmail.com
wrote:

 Hi I am new to sympy .I study Computer Science and Engineering in Indian
 Institue of Technology,Guwahati. I like python and maths. Also I liked
 concept of symbolic mathematics of sympy. I want to contribute to sympy.
 After reading some posts and articles I came to know that github is used
  to merge code in sympy . I have never used it before . Please could anyone
 help me in getting started.

 Thanks!!

 --
 You received this message because you are subscribed to the Google Groups
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sympy/774ef61a-ed35-41aa-9261-2f5ed70a4343%40googlegroups.com
 https://groups.google.com/d/msgid/sympy/774ef61a-ed35-41aa-9261-2f5ed70a4343%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAFW_KCSsdGMuhEtzM1nQvy%2BKR-B%2B1QoW57q955nXsVhjnRiKpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] Re: problem in solving inequations

2014-12-04 Thread bruno . pincon5


On Thursday, December 4, 2014 7:23:28 AM UTC+1, Chris Smith wrote:

 Could you do `print filldedent(R);print filldedent(L)` so I can see what 
 the expressions are that you are trying to solve?



   Sorry my list L of 4 relationals was latter renamed R...  Here they are
  (btw I was not able to use filldedent, using from sympy import * so
   I used print(R) and reformat with my editor to have an element per line) 
:

  R = [(-k**8 + 8*k**6 - 8*k**4 - 16*k**2 - 64)/(k*(k**8 - 2*k**6 - 4*k**4 
- 16*k**2 + 8))  0, 
 (-k**8 + 8*k**6 - 8*k**4 - 16*k**2 - 64)/(k*(k**8 - 2*k**6 - 4*k**4 - 
16*k**2 + 8))  0, 
 (k**8 - 6*k**6 + 8*k**2 + 96)/(k*(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 
8)) = 0, 
 (k**8 - 2*k**7 + 4*k**6 + 4*k**5 - 16*k**4 + 8*k**3 - 40*k**2 + 24*k - 
64)/(k*(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 8)) = 0]

  The symbol k is restricted to be real and in (2,3].  

(k is introduced with k = symbols('k',real=True,positive=True)).


  In fact even if I try to solve for only the first relational I meet the 
same error message :

  res= solve([k2, k = 3, R[0]],k)

Traceback (most recent call last):

File stdin, line 1, in module

File /usr/lib/python2.7/site-packages/sympy/solvers/solvers.py, line 674, 
in solve

symbols=symbols)

File /usr/lib/python2.7/site-packages/sympy/solvers/inequalities.py, line 
434, in reduce_inequalities

poly_reduced.append(reduce_rational_inequalities([exprs], gen, assume))

File /usr/lib/python2.7/site-packages/sympy/solvers/inequalities.py, line 
209, in reduce_rational_inequalities

solution = solve_rational_inequalities(eqs)

File /usr/lib/python2.7/site-packages/sympy/solvers/inequalities.py, line 
144, in solve_rational_inequalities

global_interval -= denom_interval

File /usr/lib/python2.7/site-packages/sympy/core/sets.py, line 250, in 
__sub__

return self.intersect(other.complement)

File /usr/lib/python2.7/site-packages/sympy/core/sets.py, line 133, in 
complement

return self._complement

File /usr/lib/python2.7/site-packages/sympy/core/sets.py, line 1229, in 
_complement

% self)

ValueError: {RootOf(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 8, 0)}: Complement 
not defined for symbolic inputs


Bruno


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/08b5c016-5952-4775-9372-c1d7ae83b2c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] Re: problem in solving inequations

2014-12-04 Thread bruno . pincon5

  Oups I just saw that my first and second relationals are the same. So I 
have to solve for only 3 relationals.

  I just went to try the wolfram alpha online calculator, I got :

   1/ for the first relational :

   solve((-k**8 + 8*k**6 - 8*k**4 - 16*k**2 - 64)/(k*(k**8 - 2*k**6 - 
4*k**4 - 16*k**2 + 8))  0, k  2, k = 3)

alpha gives:

2ksqrt(2/3 (2+(53-3 sqrt(201))^(1/3)+(53+3 sqrt(201))^(1/3)))

2/ for the third one:

solve((k**8 - 6*k**6 + 8*k**2 + 96)/(k*(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 
8)) = 0, k  2, k = 3)

   alpha gives:

sqrt(2/3+1/3 (404-36 sqrt(109))^(1/3)+1/3 2^(2/3) (101+9 
sqrt(109))^(1/3))=k=3

   3/ and for the fourth one:

 solve((k**8 - 2*k**7 + 4*k**6 + 4*k**5 - 16*k**4 + 8*k**3 - 40*k**2 + 24*k 
- 64)/(k*(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 8)) = 0, k  2, k = 3)

   alpha gives:

2k=3


  Bruno

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/004501b1-b4a1-416d-acc4-862329a485c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] Sympy assumptions

2014-12-04 Thread Paul Royik
Suppose that I have an expression

e = x**2+sqrt(a**2*b**2)
What is the best way to assign to expression assumption that all variables 
are Positive, so that equivalent of e is x**2+ab?

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/d06b2195-1c60-4317-9d19-4909d10c2e30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] Sympy assumptions

2014-12-04 Thread Ondřej Čertík
On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik distantjob...@gmail.com wrote:
 Suppose that I have an expression

 e = x**2+sqrt(a**2*b**2)
 What is the best way to assign to expression assumption that all variables
 are Positive, so that equivalent of e is x**2+ab?

It should be done like this:

In [11]: refine(e, Q.positive(a)  Q.positive(b))
Out[11]:
___
 2 ╱  2  2
x  + ╲╱  a ⋅b


But unfortunately that doesn't work. So the only other way is the old
way like this:

In [12]: a = Symbol(a, positive=True)

In [13]: b = Symbol(b, positive=True)

In [14]: x**2+sqrt(a**2*b**2)
Out[14]:
   2
a⋅b + x


Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVALOT_JKL_4RYEJwWvru7seC1o2%2BcR8tTOj02xEkbdKvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] Eigenvalues of a matrix with symbolic coefficients

2014-12-04 Thread Oscar Benjamin
I'm having some problems getting sympy to compute eigenvalues of a
matrix with symbolic coefficients.

A trivial example is:

In [4]: M = Matrix([[y, 0], [0, z]])

In [5]: M
Out[5]:
⎡y  0⎤
⎢⎥
⎣0  z⎦

In [6]: M.eigenvals()
Out[6]:
⎧   ____   ⎫
⎪  ╱2╱2⎪
⎨y   z   ╲╱  (y - z)   y   z   ╲╱  (y - z) ⎬
⎪─ + ─ - ─: 1, ─ + ─ + ─: 1⎪
⎩2   2 2   2   2 2 ⎭

Clearly the eigenvalues should be y and z so something has gone wrong.

It seems that perhaps what happens is that the characteristic
polynomial is expanded and then not re-factored when finding
solutions:

In [7]: (M - x*eye(2))
Out[7]:
⎡-x + y0   ⎤
⎢  ⎥
⎣  0 -x + z⎦

In [8]: (M - x*eye(2)).det()
Out[8]:
 2
x  - x⋅y - x⋅z + y⋅z

In [9]: solve((M - x*eye(2)).det(), x)
Out[9]:
⎡   __ __⎤
⎢  ╱2 ╱2 ⎥
⎢y   z   ╲╱  (y - z)y   z   ╲╱  (y - z)  ⎥
⎢─ + ─ - ─, ─ + ─ + ─⎥
⎣2   2 22   2 2  ⎦

In [10]: factor((M - x*eye(2)).det())
Out[10]: (x - y)⋅(x - z)

In [11]: solve(factor((M - x*eye(2)).det()), x)
Out[11]: [y, z]

Presumably det calls expand and I'm not sure why it would want to do
that. Also solve has clearly spotted that this is a second order
polynomial since we're using the quadratic formula but no attempt at
factorisation is made. I guess that without knowing knowing the sign
of y - z you can't know whether sqrt((y-z)**2) is y - z or z - y so
the quadratic formula cannot be simplified even though the original
polynomial could.

Is there some way to adjust this behaviour with flags etc.? Or is it
just a case where sympy has some room for improvement?

Oscar

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxQqEwSOnm0rR3qnfpKBEorgdcMYgVFSjjYL3Rc%2B5K4YeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] Sympy assumptions

2014-12-04 Thread Paul Royik
I know this way, but is there any way to change  this after symbol creation?

On Thursday, December 4, 2014 6:29:27 PM UTC+2, Ondřej Čertík wrote:

 On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik distan...@gmail.com 
 javascript: wrote: 
  Suppose that I have an expression 
  
  e = x**2+sqrt(a**2*b**2) 
  What is the best way to assign to expression assumption that all 
 variables 
  are Positive, so that equivalent of e is x**2+ab? 

 It should be done like this: 

 In [11]: refine(e, Q.positive(a)  Q.positive(b)) 
 Out[11]: 
 ___ 
  2 ╱  2  2 
 x  + ╲╱  a ⋅b 


 But unfortunately that doesn't work. So the only other way is the old 
 way like this: 

 In [12]: a = Symbol(a, positive=True) 

 In [13]: b = Symbol(b, positive=True) 

 In [14]: x**2+sqrt(a**2*b**2) 
 Out[14]: 
2 
 a⋅b + x 


 Ondrej 


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/0057f9b0-377e-4409-aee8-d8284e1e0f06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] Eigenvalues of a matrix with symbolic coefficients

2014-12-04 Thread Colin Macdonald
On 04/12/14 16:57, Oscar Benjamin wrote:
 I'm having some problems getting sympy to compute eigenvalues of a
 matrix with symbolic coefficients.
 
 A trivial example is:
 
 In [4]: M = Matrix([[y, 0], [0, z]])
 
 In [5]: M
 Out[5]:
 ⎡y  0⎤
 ⎢⎥
 ⎣0  z⎦
 
 In [6]: M.eigenvals()
 Out[6]:
 ⎧   ____   ⎫
 ⎪  ╱2╱2⎪
 ⎨y   z   ╲╱  (y - z)   y   z   ╲╱  (y - z) ⎬
 ⎪─ + ─ - ─: 1, ─ + ─ + ─: 1⎪
 ⎩2   2 2   2   2 2 ⎭

I think this has been improved in the dev version after 0.7.6.  I
remember commenting on an old issue on this which was then recently
closed, but I cannot locate at the moment...  test on git master?

Colin

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/54809D92.4010708%40maths.ox.ac.uk.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [sympy] Eigenvalues of a matrix with symbolic coefficients

2014-12-04 Thread Oscar Benjamin
On 4 December 2014 at 17:44, Colin Macdonald macdon...@maths.ox.ac.uk wrote:
 In [4]: M = Matrix([[y, 0], [0, z]])

 In [5]: M
 Out[5]:
 ⎡y  0⎤
 ⎢⎥
 ⎣0  z⎦

 In [6]: M.eigenvals()
 Out[6]:
 ⎧   ____   ⎫
 ⎪  ╱2╱2⎪
 ⎨y   z   ╲╱  (y - z)   y   z   ╲╱  (y - z) ⎬
 ⎪─ + ─ - ─: 1, ─ + ─ + ─: 1⎪
 ⎩2   2 2   2   2 2 ⎭

 I think this has been improved in the dev version after 0.7.6.  I
 remember commenting on an old issue on this which was then recently
 closed, but I cannot locate at the moment...  test on git master?

Yes, you're right. git master shows:

In [3]: Matrix([[y, 0], [0, z]]).eigenvals()
Out[3]: {y: 1, z: 1}

And also:

In [8]: (M - x*eye(2)).det()
Out[8]:
 2
x  - x⋅y - x⋅z + y⋅z

In [9]: solve((M - x*eye(2)).det(), x)
Out[9]: [y, z]

Thanks for that,
Oscar

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxQ3p4bkzy8rLETuy-3b6QkhxbYHW-71khcuWJdMr%2BAC9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] a bug: intersection of Line3D and plane

2014-12-04 Thread zxo102
Hi there, 

Using sympy0.7.6.win32, I run the following python script to try to find 
the intersection of a Line3D and a Plane. The coordinates for 
Point3D are from my intermediate result.  I test the script in python 2.7.8 
(Case 1) and python 3.4.2 (Case 2) and got different results.  

#

from sympy import *

l2 = Line3D(Point3D(5004459633/5, 
-891926590718643/1000, 231800966893633/100), 
Point3D(5004459633/50, -222981647679771/250, 
231800966893633/100))

p2 = Plane(Point3D(402775636372767/100, 
-97224357654973/100, 216793600814789/100), 
(-9.0087501922, -4.81170658872543e-13, 0.0))

print(p2.is_parallel(l2))
print(p2.intersection(l2)
###


Case 1:
=

Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] 
on win32
Type copyright, credits or license() for more information.
  RESTART 

 
False
[Point3D(4, -1, 2)]


Case 2:
==
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 
bit (Intel)] on win32
Type copyright, credits or license() for more information.
  RESTART 

 
False
[]

If it is a bug, where do I know it is fixed?

ouyang

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/f6dd0753-9904-4152-ba4b-0413a7bc9400%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.