You need to include the assumptions in the call to refine:
>>> refine(sqrt((x - y)**2), Q.positive(x - y))
x - y
If I remember correctly, the `assuming` context manager also works for
this, but I can't be certain.
On Monday, November 10, 2014 6:30:25 PM UTC-6, Andrew Spielberg wrote:
>
> Hi Aar
Hi Aaron,
Thanks for the reply. One of the main things I'm hoping to do is make
absolute values go away. I frequently in my code am getting things like (x
- y) / Abs(x - y). I know x - y is > 0, so this is just 1.
I should note that when I run your code, I get the following:
In [1]: x, y = sy
Q is just a namespace for the assumptions, like Q.positive or Q.real.
refine() simplifies things based on assumptions. This example returns x -
y, because sqrt((x - y)**2) is equal to x - y if x - y is positive (but not
in general).
What kinds of simplifications are you expecting to get out of yo
Aha, thanks so much!
-Andy S.
On Mon, Nov 10, 2014 at 5:00 PM, Aaron Meurer wrote:
> nsimplify tries to convert floating point numbers into exact numbers, like
> sqrt(2) or pi + 1. The tolerance flag specifies how close the exact number
> needs to be to the floating point number. For example:
>
Hi Aaron,
Thanks for the speedy reply. I'm not sure I fully understand what this
example does, or how. Could you perhaps elaborate? What is Q? What is
the difference between refine and simplify?
I should note that the entirety of my constraints will be linear, so if the
current functionality
There is a framework to do this with refine, like refine(sqrt((x - y)**2),
Q.positive(x - y)), but not much is implemented yet, so the simplifications
possible are quite limited (in fact, there's not much more than the one
that I just showed that is implemented).
Aaron Meurer
On Mon, Nov 10, 2014
nsimplify tries to convert floating point numbers into exact numbers, like
sqrt(2) or pi + 1. The tolerance flag specifies how close the exact number
needs to be to the floating point number. For example:
In [8]: nsimplify(pi.evalf(), tolerance=0.1)
Out[8]: 22/7
In [9]: nsimplify(pi.evalf(), tole
Hi all,
When creating variables, I know you can provide certain constraints on the
domain of that variable. For instance, one could say that a certain
variable, x, is positive, real, rational, etc. These constraints affect
the way the simplify function behaves.
I am wondering, without creati
Thanks a ton - yes, using N and then specifying a tolerance with N worked.
Out of curiosity then, what is the point of the nsimplify tolerance? What
does that do? I appear to be misunderstanding it.
-Andy S.
On Sunday, November 9, 2014 8:38:00 PM UTC-5, Aaron Meurer wrote:
>
> I think you wan
On Mon, Nov 10, 2014 at 2:33 PM, Ondřej Čertík wrote:
> On Mon, Nov 10, 2014 at 10:54 AM, Amir Farbin wrote:
>> Hi,
>>
>>
>> I'm trying to convert expressions sympy to theano... following:
>>
>>
>> http://matthewrocklin.com/blog/work/2013/03/28/SymPy-Theano-part-2/
>>
>>
>> And I run into a failu
On Mon, Nov 10, 2014 at 10:54 AM, Amir Farbin wrote:
> Hi,
>
>
> I'm trying to convert expressions sympy to theano... following:
>
>
> http://matthewrocklin.com/blog/work/2013/03/28/SymPy-Theano-part-2/
>
>
> And I run into a failure that appears simple to fix. Here's a simple
> example:
>
>
> fro
Hi,
I'm trying to convert expressions sympy to theano... following:
http://matthewrocklin.com/blog/work/2013/03/28/SymPy-Theano-part-2/
And I run into a failure that appears simple to fix. Here's a simple
example:
from sympy.printing.theanocode import theano_function
im=sp.sqrt(-1)
x=
On Monday, November 10, 2014 10:55:47 AM UTC+1, Deepanshu Vijay wrote:
>
> Hey, I am a *newbie* to the Open Source and this Organization. I know
> coding languages like* Python*, and *C.*
> In Web Development , I know *HTML, CSS, javscript, jquery, MySQL*.
> Can you *let me know some easy bug* s
Hi,
On 9 November 2014 17:24, Darek Cidlinský wrote:
> I would like to have sympy simplify a monstrous polynom ratio:
>
> In [2]: E=1/(2*x1**2 - 4*x1*x2 + 2*x2**2 + 2*y1**2 - 4*y1*y2 + 2*y2**2) *
> (-y1*r1**2 + y2*r1**2 + y1*r2**2 - y2*r2**2 + y1*x1**2 + y2*x1**2 -
> 2*x1*x2*y1 - 2*x1*x2*y2 + y1*
Deepanshu,
Checkout this page:
https://github.com/sympy/sympy/wiki/introduction-to-contributing
And easy issues can be found here:
https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+to+Fix%22
Jason
moorepants.info
+01 530-601-9791
On Mon, Nov 10, 2014 at 4:55 AM, De
Deepanshu,
This wiki page gives info on getting started:
https://github.com/sympy/sympy/wiki/introduction-to-contributing
Let us know if you're stuck somewhere.
Sushant Hiray,
Senior Undergrad CSE,
IIT Bombay
On Mon, Nov 10, 2014 at 3:25 PM, Deepanshu Vijay <
deepanshuvijay01...@gmail.com> w
Hey, I am a *newbie* to the Open Source and this Organization. I know
coding languages like* Python*, and *C.*
In Web Development , I know *HTML, CSS, javscript, jquery, MySQL*.
Can you *let me know some easy bug* so that I can start my journey with the
aim to contribute my share in the Open Sour
I would like to have sympy simplify a monstrous polynom ratio:
In [2]: E=1/(2*x1**2 - 4*x1*x2 + 2*x2**2 + 2*y1**2 - 4*y1*y2 + 2*y2**2) *
(-y1*r1**2 + y2*r1**2 + y1*r2**2 - y2*r2**2 + y1*x1**2 + y2*x1**2 -
2*x1*x2*y1 - 2*x1*x2*y2 + y1*x2**2 + y2*x2**2 + y1**3 - y2*y1**2 - y1*y2**2
+ y2**3)
In [
18 matches
Mail list logo