Something like expr.replace(Abs(a*guardlength - length), a*guardlength -
length), where a = Wild('a'). If you are getting strange results you can
try Wild('a', exclude=[guardlength, length]).
Aaron Meurer
On Sat, Jan 3, 2015 at 4:51 PM, Andrew Spielberg aespielb...@gmail.com
wrote:
Sorry, one
On Fri, Jan 2, 2015 at 9:50 PM, Andrew Spielberg aespielb...@gmail.com
wrote:
Sorry for the double post. It seems replace is very weak as well, not
being able to detect multiples :-/
In [60]: expr.replace(math.Abs(guardlength - 0.5*length), guardlength -
0.5*length)
Out[60]:
Hi Aaron,
w.r.t. killing the Abs, that's not sufficient, because sometimes I need the
Abs( ) to turn into -Id( ).
One of those, exp, was created via simpify. The other, expr, was created
from the ground up using Symbols. No assumptions are being made.
-Andy S.
On Sat, Jan 3, 2015 at 2:28 PM,
Sorry, one more thing - I can't get the wildcards to work. Can you provide
an example?
-Andy S.
On Sat, Jan 3, 2015 at 6:50 PM, Andrew Spielberg aespielb...@gmail.com
wrote:
Hi Aaron,
w.r.t. killing the Abs, that's not sufficient, because sometimes I need
the Abs( ) to turn into -Id( ).
On Fri, Jan 2, 2015 at 12:13 PM, Andrew Spielberg aespielb...@gmail.com
wrote:
Hi guys,
Thanks for your help so far. I am revisiting this after ignoring this
issue for a while.
I'm still trying to come up with a good way to use this. I've noticed the
following:
Say:
a = Symbol('a')
b
Sorry for the double post. It seems replace is very weak as well, not
being able to detect multiples :-/
In [60]: expr.replace(math.Abs(guardlength - 0.5*length), guardlength -
0.5*length)
Out[60]: width*(-2*guardlength + length + Abs(2*guardlength -
length))/Abs(2*guardlength - length)
In
This may be a dumb question, but can you please explain what is going on
here...? exp was made using simpify, expr was created from scratch.
Replace operates on them differently.
In [48]: exp
Out[48]: width*(-2*guardlength + length + Abs(2*guardlength -
length))/Abs(2*guardlength - length)
In
As I said, it's *very* proof of concept. Many advanced things don't work.
In this case, I think the issue is with the assumptions in general. They
can't deduce from the facts And(Q.positive(-beamwidth),
Q.positive(-length), Q.positive(0.9*beamwidth - length))
that 0.866025403784438*beamwidth -
Note that if you want to kill all abs in your expression, there's an easier
way. expr.replace(Abs, Id)
Aaron Meurer
On Fri, Nov 14, 2014 at 5:02 PM, Aaron Meurer asmeu...@gmail.com wrote:
As I said, it's *very* proof of concept. Many advanced things don't work.
In this case, I think the
refine_abs isn't doing the trick here either. Am I using this module
incorrectly?
On Tue, Nov 11, 2014 at 6:09 PM, Andrew Spielberg aespielb...@gmail.com
wrote:
Thanks guys. This seems to be mostly working so far.
Any idea why this wouldn't be, though?
In [1]: assumptions
Out[1]:
Hi,
On 11 November 2014 01:13, Aaron Meurer asmeu...@gmail.com wrote:
Q is just a namespace for the assumptions, like Q.positive or Q.real.
refine() simplifies things based on assumptions.
I think we shouldn't use refine() and simplifies together as this
only can increase confusion.
Thanks guys. This seems to be mostly working so far.
Any idea why this wouldn't be, though?
In [1]: assumptions
Out[1]: And(Q.positive(-beamwidth), Q.positive(-length),
Q.positive(0.9*beamwidth - length))
In [2]: exp
Out[2]: 0.866025403784439*beamwidth*(0.866025403784438*beamwidth -
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
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,
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
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
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 =
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 Aaron,
18 matches
Mail list logo