Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Chris Smith
OK, I think it's all lok after all. Here's the reason: 1) refine changes the sqrt(1/w) to 1/sqrt(w) 2) this doesn't get flattened out by Mul since Mul isn't doing (all) simplification 3) simplify will simplify to the desired expression 3b) but powsimp doesn't do so, so simplify is smarter about wa

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Chris Smith
Ondrej said in the inline comment that fx is -c1 so perhaps he just forgot that; if he was intending to solve for c1 then c1 is the negative of what he obtains at the end. As far as the refine working, I think the only problem is that the refine process doesn't check for the negated term (or doesn

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
If you don't get the sign you expect, it probably means you are choosing the wrong solution. Use dfx = solve(eq, f(x).diff(x))[0] instead. Aaron Meurer On Wed, May 15, 2013 at 10:11 PM, Chris Smith wrote: > I looked at your notes and as far as I see, the minus sign at the end is > correct: > >

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
We should improve dsolve(), so that it solve that equation. I think we need a new hint, which works if the equation does not depend on f(x), but only on f(x).diff(x) and x. In that case, we can solve for f(x).diff(x) and integrate (the hint will need a caveat that if solve missed a solution then i

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Chris Smith
I looked at your notes and as far as I see, the minus sign at the end is correct: >>> eq (-l**2 + x**2)*sqrt(1/(l**2 - x**2)) >>> eq.subs(l**2-x**2,p).subs(p,l**2-x**2) -sqrt(l**2 - x**2) >>> p.is_positive 1 And as for "an easy way to get at the expression of the last Piecewise expr/cond pair, it

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Chris Smith
Ahhh...I didn't see the "1/" part. `x*sqrt(1/x)` is not, in general, equal to `sqrt(x)` as can be verified with `x=-3` since `sqrt(1/x) != 1/sqrt(x)` ``` >>> sqrt(1/x).subs(x,-3.) 0.577350269189626*I >>> (1/sqrt(x)).subs(x,-3.) -0.577350269189626*I ``` I can't view any issues -- don't know why. C

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Ondřej Čertík
On Wed, May 15, 2013 at 9:34 PM, Aaron Meurer wrote: > > > > On Wed, May 15, 2013 at 9:23 PM, Ondřej Čertík > wrote: >> >> On Wed, May 15, 2013 at 9:20 PM, Ondřej Čertík >> wrote: >> > On Wed, May 15, 2013 at 9:04 PM, Aaron Meurer >> > wrote: >> >> Are you using the git master? refine(f, Q.pos

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
On Wed, May 15, 2013 at 9:23 PM, Ondřej Čertík wrote: > On Wed, May 15, 2013 at 9:20 PM, Ondřej Čertík > wrote: > > On Wed, May 15, 2013 at 9:04 PM, Aaron Meurer > wrote: > >> Are you using the git master? refine(f, Q.positive(a**2-b**2)) works > for > >> me. I think we only very recently fixed

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
I think the function you want is powdenest. Powsimp applies x**a*x**b = x**(a + b) and x**a*y**a = (x*y)**a. This identity is (x**a)**b = x**(a*b). See the powers section of the new tutorial that you are supposed to be helping me write: http://docs.sympy.org/tutorial/tutorial/simplification.html#

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Ondřej Čertík
On Wed, May 15, 2013 at 9:20 PM, Ondřej Čertík wrote: > On Wed, May 15, 2013 at 9:04 PM, Aaron Meurer wrote: >> Are you using the git master? refine(f, Q.positive(a**2-b**2)) works for >> me. I think we only very recently fixed the assumptions on Abs so that >> sqrt(Abs(x)) == x automatically. >

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Ondřej Čertík
On Wed, May 15, 2013 at 9:04 PM, Aaron Meurer wrote: > Are you using the git master? refine(f, Q.positive(a**2-b**2)) works for > me. I think we only very recently fixed the assumptions on Abs so that > sqrt(Abs(x)) == x automatically. You are right, the master works with refine. However, powsim

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
Are you using the git master? refine(f, Q.positive(a**2-b**2)) works for me. I think we only very recently fixed the assumptions on Abs so that sqrt(Abs(x)) == x automatically. Aaron Meurer On Wed, May 15, 2013 at 8:53 PM, Ondřej Čertík wrote: > Hi, > > I have two questions: > > In [1]: from s

Re: [sympy] Re: How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Aaron Meurer
On Wed, May 15, 2013 at 9:01 PM, Ondřej Čertík wrote: > On Wed, May 15, 2013 at 8:53 PM, Ondřej Čertík > wrote: > > Hi, > > > > I have two questions: > > > > In [1]: from sympy import refine, Q, var, sqrt > > > > In [2]: var("a b") > > Out[2]: (a, b) > > > > In [3]: f = (a**2-b**2) * sqrt(1 / (a*

[sympy] Re: How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Ondřej Čertík
On Wed, May 15, 2013 at 8:53 PM, Ondřej Čertík wrote: > Hi, > > I have two questions: > > In [1]: from sympy import refine, Q, var, sqrt > > In [2]: var("a b") > Out[2]: (a, b) > > In [3]: f = (a**2-b**2) * sqrt(1 / (a**2-b**2)) > > In [4]: f > Out[4]: (a**2 - b**2)*sqrt(1/(a**2 - b**2)) > > In [5

Re: [sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Chris Smith
If a**2 - b**2 is positive then it doesn't matter whether a and b are complex or not. >>> p=Symbol('p', positive=True); e=a**2-b**2; f.subs(e,p).subs(p,e) sqrt(a**2 - b**2) -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group

[sympy] How to simplify (a**2-b**2) / sqrt(a**2-b**2) to sqrt(a**2 - b**2)

2013-05-15 Thread Ondřej Čertík
Hi, I have two questions: In [1]: from sympy import refine, Q, var, sqrt In [2]: var("a b") Out[2]: (a, b) In [3]: f = (a**2-b**2) * sqrt(1 / (a**2-b**2)) In [4]: f Out[4]: (a**2 - b**2)*sqrt(1/(a**2 - b**2)) In [5]: refine(f, Q.positive(a**2-b**2)) Out[5]: (a**2 - b**2)/sqrt(Abs(a**2 - b**2)

Re: [sympy] Generalized Pauli matrices? (and Gell-Mann matrices)

2013-05-15 Thread Stefan Krastanov
There are already a few prototype-stage proposals about this that might give you an idea how to proceed: - Pernici employed abstract tensors for this here https://github.com/sympy/sympy/pull/1699 It is unmerged. Search for "gamma matrices" in the pull request description. Only a small part of this

Re: [sympy] Generalized Pauli matrices? (and Gell-Mann matrices)

2013-05-15 Thread Aaron Meurer
Sounds good to me. Aaron Meurer On Wed, May 15, 2013 at 2:20 PM, F. B. wrote: > What about generalizing the Pauli matrices to any dimension? > > Pauli matrices generate the algebra of SU(2), Gell-Mann matrices the one > of SU(3). > > Wikipedia has an article about a generalization for SU(N): >

Re: [sympy] modify XFAIL so it only fails for given reason

2013-05-15 Thread Aaron Meurer
I have pushed a very basic start to my xfail branch that you can start your work on. It still has a few TODOS: - I didn't change any tests - I didn't fix the py.test version - It should automatically include the skip exception - It should not kill the test runner if it is used incorrectly. - I di

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Aaron Meurer
This is the method I suggested for abs and arg In [35]: solve([abs(x) - 1, arg(x) - pi/2, log(abs(x)) + arg(x)*I - log(x)]) Out[35]: ⎡⎧ ⅈ⋅π π⎫⎤ ⎢⎨log(│x│): log(x) - ───, arg(x): ─, │x│: 1⎬⎥ ⎣⎩2 2⎭⎦ If solve would go a little

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Aaron Meurer
I guess solve is smart enough to treat re(x), im(x), and x as separate variables. This then becomes a linear system of equations. Aaron Meurer On Wed, May 15, 2013 at 2:14 PM, Jaime Alonso-Martínez < jalonsomarti...@gmail.com> wrote: > Thanks to you both for the answers!! > > smichr, I don't re

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Jaime Alonso-Martínez
Yes, that issue is certainly related!! I didn't find it when searching. El martes, 14 de mayo de 2013 23:14:28 UTC+2, Aaron Meurer escribió: > > It seems the first bug has been fixed in the git master. > solve((re(x)-2,im(x)-1),x) now > gives []. > > [] doesn't mean it is ignored. It just means

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Jaime Alonso-Martínez
Thanks to you both for the answers!! smichr, I really don't understand why it is needed to add the third equation to abtain a solution. Could you give me a clue? Jaime. El miércoles, 15 de mayo de 2013 05:12:29 UTC+2, smichr escribió: > > There is a missing relationship that you can supply fo

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Jaime Alonso-Martínez
You said that "Right now, if abs(x) is present it is replaced with `sqrt(x**2)`" Shouldn't it be replaced by sqrt(x*conjugate(x)) ? El miércoles, 15 de mayo de 2013 08:00:02 UTC+2, smichr escribió: > > Right now, if abs(x) is present it is replaced with `sqrt(x**2)`. I guess > that should be `

[sympy] Generalized Pauli matrices? (and Gell-Mann matrices)

2013-05-15 Thread F. B.
What about generalizing the Pauli matrices to any dimension? Pauli matrices generate the algebra of SU(2), Gell-Mann matrices the one of SU(3). Wikipedia has an article about a generalization for SU(N): Generalizations_of_Pauli_matrices

Re: [sympy] solve((re(x)-2,im(x)-1),x) returns 2

2013-05-15 Thread Jaime Alonso-Martínez
Thanks to you both for the answers!! smichr, I don't really understand why it is needed to add the third equation that you add (re(x)+I*im(x)-x). What does it change? Could you give me a clue? I am trying to understand the capabilities of sympy regarding complex numbers, since I would like to u

[sympy] Re: Vector Calculus module

2013-05-15 Thread Prasoon Shukla
But that is exactly my question - where else can dyadics be used? Perhaps someone from the physics community can comment? 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

Re: [sympy] Status of Quantum Mechanics Module

2013-05-15 Thread Tomo Lazovich
Hi Luke, I'm the author of the pull request on continuous representations, which dates back to GSoC 2011. At the PR link ( https://github.com/sympy/sympy/pull/573) I put a mini TODO list for what needs to get done for it to actually make it in to the master. Basically, what happened was that I got

Re: [sympy] Status of Quantum Mechanics Module

2013-05-15 Thread lukebovard
Sean, Sounds good. I've been reading about how to set-up the environment but if you are willing to help, that will expedite the process. I'm somewhat familiar with git but I've only ever used it for my own research code and not on any larger development so I'm not 100% confident in the correct

Re: [sympy] modify XFAIL so it only fails for given reason

2013-05-15 Thread Chris Smith
My system is acting up right now...if I can remember I will open this as an issue when it's working again. -- 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+unsubsc

Re: [sympy] Re: Vector Calculus module

2013-05-15 Thread Aaron Meurer
I don't think dyadics are used elsewhere, but the real question is if they are useful outside of physics or not. If they are, then they should be defined outside of physics, and just used in mechanics. If there are certain aspects that only make sense in physics, then they should be defined outside

Re: [sympy] modify XFAIL so it only fails for given reason

2013-05-15 Thread Aaron Meurer
Yes, it should be easy to do. XFAIL is defined in sympy/utilities/pytest.py. Just change it so that it takes an argument, exception, which is caught instead of Exception. The most complicated part is changing the decorator into a function that returns a decorator (I think it's easiest to do using a

Re: [sympy] deprecation warning is clobbering my test resquest

2013-05-15 Thread Aaron Meurer
This is due to my recent change: https://github.com/sympy/sympy/pull/2094. Is this happening because of a change you made, or does it happen in master? I think the statistics module deprecation warning was supposed to be excluded from being raised during tests, but my change disrupted that. Aaro