Re: [sympy] Re: How to do this simplification of boolean variables?

2013-03-15 Thread Chris Smith
If you replace name and _name with 0 in your expression and subtract the result from the initial expression, that will give you the ones that *do* have name and _name. Then, if you have an Add (have_name.is_Add) you could count the terms (len(have_name.args)) and expand the result after replacing _

Re: [sympy] GSoC Proposal - ODE Solver using Lie Groups

2013-03-15 Thread Aaron Meurer
It sounds ok to me, but try to prioritize your work, in case you don't get to one because the other is harder than you thought. Aaron Meurer On Mar 14, 2013, at 9:58 PM, Manoj Kumar wrote: I'd just like to clarify if my post was a bit ambiguous. I would like to implement both of these in a sing

[sympy] Re: How to do this simplification of boolean variables?

2013-03-15 Thread Roderick de Nijs
Thanks for your comments! @Aaron, I dont see how what you say would work. @smichr, instead of using Not(x) to represent the complement, i make a new symbol _x, which does not raise NotImplemented exceptions when calling expand(). I have an implementation running, the function ignores the coeff

Re: [sympy] Implementation of derivative and integral steps in Gamma

2013-03-15 Thread Aaron Meurer
For multiargument functions (including Pow), you could replace the arguments that depend on x with x and those that don't with a (if there are more than one of the first type you might use f(x) instead of x). For example, if you have x**2, use the rule derived from x**a. For x**x, use f(x)**g(x).

[sympy] Re: Numerical evaluation of a Sympy function

2013-03-15 Thread Patrice Haldemann
Thank you very much. You have been most helpful. I wish you a nice weekend. Kind regards Patrice Le vendredi 15 mars 2013 09:42:34 UTC+1, Patrice Haldemann a écrit : > I recently started to learn Python and I have stumbled over an issue since > quite a few days. > How to evaluate a fun

Re: [sympy] Re: Implementation of derivative and integral steps in Gamma

2013-03-15 Thread David Li
That would be a good idea. Looking at the code, everything has an _eval_derivative method which should work. My only concern is that, for instance, in Pow it combines the power, chain, and exponential rules into one expression. In any case, most of the code I added was related to printing and form

Re: [sympy] Re: Implementation of derivative and integral steps in Gamma

2013-03-15 Thread Matthew Rocklin
> I don't know if it's idiomatic, but one suggestion is to derive the > derivative rules automatically from diff. At the very least use a fallback > so it works for functions you don't have rules for. > I agree that it'd be unfortunate to rewrite all of the differentiation logic. Maybe there is a

Re: [sympy] Re: Implementation of derivative and integral steps in Gamma

2013-03-15 Thread Matthew Rocklin
> If this an "idiomatic" use of strategies then I'll convert the rest of the code. There is no idiomatic or agreed upon use of strategies. They're new, experimental, and used almost exclusively by me. The only good idea I can push with confidence is that you should strive to separate your functi

Re: [sympy] Re: Implementation of derivative and integral steps in Gamma

2013-03-15 Thread Aaron Meurer
I don't know if it's idiomatic, but one suggestion is to derive the derivative rules automatically from diff. At the very least use a fallback so it works for functions you don't have rules for. Aaron Meurer On Mar 15, 2013, at 10:42 AM, David Li wrote: Okay, so I'd just like to make sure I'm u

Re: [sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Aaron Meurer
Maybe use collect() with x and _x and then replace any instance of a multiple of x + _x with 1. Aaron Meurer On Mar 15, 2013, at 7:46 AM, Roderick de Nijs wrote: Hi, smichr Unfortunately not, a constraint I have is that if x and _x appear in other places that do not simplify out, I would like

Re: [sympy] Numerical evaluation of a Sympy function

2013-03-15 Thread Aaron Meurer
The first argument to evalf tells it how many decimal places to evaluate to. You want subs, either the method or the argument to evalf. Aaron Meurer On Mar 15, 2013, at 4:17 AM, Patrice Haldemann wrote: I recently started to learn Python and I have stumbled over an issue since quite a few days.

[sympy] Re: Implementation of derivative and integral steps in Gamma

2013-03-15 Thread David Li
Okay, so I'd just like to make sure I'm using strategies/rules correctly. I have the gist of the derivative implementation at https://gist.github.com/lidavidm/5171100. - The rules convert the function to be differentiated into a namedtuple corresponding to the derivative rule to be applie

Re: [sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Chris Smith
@mrocklin, I wonder if any of the unify tools -- maybe one to "collect identities" -- might be used for this. -- 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+unsu

Re: [sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Chris Smith
How are you representing the Not variables? Within a Not? Because you could find out who is Not-ed and then replace a given Not with a (1-not_var) and only keep the replacement if it caused terms to disappear. >>> eq a*b*c*x + a*b*c*Not(x) + a*y >>> eq.atoms(Not) set([Not(x)]) >>> _.pop().args[0]

Re: [sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Roderick de Nijs
Hi, smichr Unfortunately not, a constraint I have is that if x and _x appear in other places that do not simplify out, I would like to keep those parts with their original literals. El viernes, 15 de marzo de 2013 14:16:05 UTC+1, smichr escribió: > > On Fri, Mar 15, 2013 at 6:37 PM, Roderick

Re: [sympy] GSOC 2013, Linear Algebra

2013-03-15 Thread Stefan Krastanov
This is certainly an important project, however it is also rather difficult. Moreover, there was some tangential work on sparse matrices (and maybe symbolic matrix expressions) that must somehow be combined in a coherent module. Most importantly, there is some work done on that by Mateusz Paprocki

Re: [sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Chris Smith
On Fri, Mar 15, 2013 at 6:37 PM, Roderick de Nijs wrote: > I have boolean variables that can be negated or not, so _x=1-x, in a > sum-of-monomials type of expression. Of course, the regular and negated > literals are treated as different symbols in sympy. > > I would like to do the simplificatio

[sympy] How to do this simplification of boolean variables?

2013-03-15 Thread Roderick de Nijs
I have boolean variables that can be negated or not, so _x=1-x, in a sum-of-monomials type of expression. Of course, the regular and negated literals are treated as different symbols in sympy. I would like to do the simplification: a*b*c*x + a*b*c*_x + other terms = a*b*c a*b*c*x - a*b*c*_x

[sympy] GSOC 2013, Linear Algebra

2013-03-15 Thread Saurabh Jha
Hi, My name is Saurabh Jha. I am a third year student at an Indian University. My major is Computer Science and Engineering. I am interested in Google Summer of Code 2013 and more specifically want to work on matrix module of sympy. I saw the ideas list and found two points concerned with rewriti

Re: [sympy] Numerical evaluation of a Sympy function

2013-03-15 Thread Chris Smith
Oops, I see I got the decimal point wrong, but you get the idea. Also note that if you use floats you will get a Float (SymPy's version of the float) automatically, but if you use integers or Rationals, you will not: >>> h.subs(x, 2) cos(2) >>> _.n() -0.416146836547142 >>> h.subs(x, S(1)/2) cos(1/

Re: [sympy] Numerical evaluation of a Sympy function

2013-03-15 Thread Chris Smith
On Fri, Mar 15, 2013 at 2:27 PM, Patrice Haldemann wrote: > I recently started to learn Python and I have stumbled over an issue since > quite a few days. > How to evaluate a function at let say x=2. > > example > h=diff(sin(x)) > print(h(2.)) > =cos(x) The subs method will substitute one or mor

[sympy] Numerical evaluation of a Sympy function

2013-03-15 Thread Patrice Haldemann
I recently started to learn Python and I have stumbled over an issue since quite a few days. How to evaluate a function at let say x=2. example h=diff(sin(x)) print(h(2.)) =cos(x) or print (N(h(x),2.) =cos(x) or print (h(x).evalf(2.)) =cos (x) but never the value of cos(2.) Coul

[sympy] Re: Vector Calculus module

2013-03-15 Thread Prasoon Shukla
I won't be available till Tuesday (19th March); going on a field trip. In the meanwhile, please keep posting ideas/suggestions/problems if any. Thanks. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving e