Re: [sympy] Boolean function generation

2012-09-07 Thread Aaron Meurer
Sure.  We are glad to help people out with this.

We have a guide at
https://github.com/sympy/sympy/wiki/Development-workflow that
describes the process of using git and pushing your patch to GitHub.
So I would start there.  Let us know if you have any questions based
on this.  Basically what you need to do is (if you haven't already):

- Clone SymPy
- Add your changes to the clone
- Fork SymPy on GitHub
- Do the necessary steps so that you can push to your fork (add a
remote, add your ssh keys, etc.; these are all described in the wiki
page)
- Create a pull request

And from there we will discuss your changes on the pull request.  So
let us know if you are able to perform the above steps.  I know that
git can be a bit confusing to new users, but once you get the hang of
it, it makes a lot of things a lot easier.

Aaron Meurer

On Wed, Sep 5, 2012 at 2:30 PM, Sachin Joglekar srjoglekar...@gmail.com wrote:
 m actually new to open source coding and sympy..can you please guide me as
 to how i should submit the module?


 On Wednesday, September 5, 2012 7:42:37 AM UTC+5:30, Aaron Meurer wrote:

 As far as I know we don't.  I think it would make a useful addition.
 It would be great if you could submit it.

 Aaron Meurer

 On Sun, Sep 2, 2012 at 11:21 AM, Sachin Joglekar
 srjogl...@gmail.com wrote:
  Does sympy have any method to generate the Sum Of Products form of a
  function from its truth table? in our college we have developed a module
  using sympy and its been very helpful in saving tym in designing
  circuits..Can we use it to contribute to sympy in some way?
 
  --
  You received this message because you are subscribed to the Google
  Groups
  sympy group.
  To view this discussion on the web visit
  https://groups.google.com/d/msg/sympy/-/Q2swCbGlla0J.
  To post to this group, send email to sy...@googlegroups.com.
  To unsubscribe from this group, send email to
  sympy+un...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/sympy?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 sympy group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/sympy/-/LcO_K90M6_EJ.

 To post to this group, send email to sympy@googlegroups.com.
 To unsubscribe from this group, send email to
 sympy+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/sympy?hl=en.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.



Re: [sympy] Undesirable behavior from cse

2012-09-07 Thread Larry Wigton


On Thursday, September 6, 2012 6:26:38 PM UTC-7, smichr wrote:

 On Fri, Sep 7, 2012 at 1:40 AM, Larry Wigton lbw...@aol.com javascript: 
 wrote: 
  Python code using cse from sympy: 
  
  from sympy import * 
  x=Symbol('x') 
  y=Symbol('y') 
  eq1 = 5*x**3*y**2 + y**3 
  eq2 = 4*x**2*y**3 + y**2 
  eq = [eq1,eq2] 
  print eq 
  (red,rep) = cse(eq) 
  print red 
  print rep 
  eq = [eq2,eq1] 
  print eq 
  (red,rep) = cse(eq) 
  print red 
  print rep 
  
  *** 
  
  Output from the code: 
  
  [5*x**3*y**2 + y**3, 4*x**2*y**3 + y**2] 
  [(x0, y**3), (x1, x0**(2/3))] 
  [5*x**3*x1 + x0, 4*x**2*x0 + x1] 
  
  [4*x**2*y**3 + y**2, 5*x**3*y**2 + y**3] 
  [(x0, y**2), (x1, x0**(3/2))] 
  [4*x**2*x1 + x0, 5*x**3*x0 + x1] 
  
  ** 

 Current master gives 

 [5*x**3*y**2 + y**3, 4*x**2*y**3 + y**2] 
 [(x0, y**2)] 
 [x0*(5*x**3 + y), x0*(4*x**2*y + 1)] 
 [4*x**2*y**3 + y**2, 5*x**3*y**2 + y**3] 
 [(x0, y**2)] 
 [x0*(4*x**2*y + 1), x0*(5*x**3 + y)] 

 googling sympy bleeding edge if you would like to get the most 
 up-to-date (and soon to be released) 0.7.2 version. 




Thank you for telling me about the Bleeding edge version of sympy.

Unfortunately it does not work for case which worked before.

Test case for bleeding edge version of sympy:

**

pg00 = Symbol('pg00')
pg01 = Symbol('pg01')
eq1 = sympify(pg01**2/pg00**2)
eq2 = sympify(1.0 - 2*pg01/pg00)
eq3 = sympify(pg01*(1.0 - pg01/pg00))
eq = [eq1,eq2,eq3]
print eq
(red,rep) = cse(eq)
print red
print rep



Output from code:

[pg01**2/pg00**2, 1.0 - 2*pg01/pg00, pg01*(1.0 - pg01/pg00)]
Traceback (most recent call last):
  File mytest3.py, line 12, in module
(red,rep) = cse(eq)
  File /acct/lbw9902/gitstuff/sympy/sympy/simplify/cse_main.py, line 313, 
in cse
reduced_exprs[j] = update(expr)
  File /acct/lbw9902/gitstuff/sympy/sympy/simplify/cse_main.py, line 309, 
in lambda
update = lambda x: x.subs(subtree, sym)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/basic.py, line 852, in subs
rv = rv._subs(old, new)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/cache.py, line 88, in 
wrapper
func_cache_it_cache[k] = r = func(*args, **kw_args)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/basic.py, line 951, in 
_subs
rv = fallback(self, old, new)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/basic.py, line 938, in 
fallback
arg = arg._subs(old, new, **hints)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/cache.py, line 88, in 
wrapper
func_cache_it_cache[k] = r = func(*args, **kw_args)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/basic.py, line 949, in 
_subs
rv = self._eval_subs(old, new)
  File /acct/lbw9902/gitstuff/sympy/sympy/core/mul.py, line 1276, in 
_eval_subs
rat.append(ndiv(c_e, old_e))
  File /acct/lbw9902/gitstuff/sympy/sympy/core/mul.py, line 1186, in ndiv
if not b.q % a.q or not a.q % b.q:
AttributeError: 'Infinity' object has no attribute 'q'

**

Output from sympy 7.1

[pg01**2/pg00**2, 1.0 - 2*pg01/pg00, pg01*(1.0 - pg01/pg00)]
[(x0, 1/pg00), (x1, pg01*x0)]
[x1**2, -2*x1 + 1.0, pg01*(-x1 + 1.0)]

***

So it looks like bleeding edge version of sympy still needs some work.

   Larry Wigton

 

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/HAC2fglIj6YJ.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.