[sympy] Sympy assumptions

2014-12-04 Thread Paul Royik
Suppose that I have an expression e = x**2+sqrt(a**2*b**2) What is the best way to assign to expression assumption that all variables are Positive, so that equivalent of e is x**2+ab? -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe fro

Re: [sympy] Sympy assumptions

2014-12-04 Thread Ondřej Čertík
On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik wrote: > Suppose that I have an expression > > e = x**2+sqrt(a**2*b**2) > What is the best way to assign to expression assumption that all variables > are Positive, so that equivalent of e is x**2+ab? It should be done like this: In [11]: refine(e, Q.po

Re: [sympy] Sympy assumptions

2014-12-04 Thread Paul Royik
I know this way, but is there any way to change this after symbol creation? On Thursday, December 4, 2014 6:29:27 PM UTC+2, Ondřej Čertík wrote: > > On Thu, Dec 4, 2014 at 7:38 AM, Paul Royik > wrote: > > Suppose that I have an expression > > > > e = x**2+sqrt(a**2*b**2) > > What is the best

Re: [sympy] Sympy assumptions

2014-12-04 Thread Ondřej Čertík
On Thu, Dec 4, 2014 at 10:25 AM, Paul Royik wrote: > I know this way, but is there any way to change this after symbol creation? The right way in my opinion is to just create a symbol with no assumptions and then use refine(). As I wrote below, it doesn't yet work for this case, but it will in t

Re: [sympy] Sympy assumptions

2014-12-05 Thread Francesco Bonazzi
newvars =symbols('x a b', integer=True) e.xreplace(dict(zip([x,a,b], newvars))) I did not test 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+unsubscr...@

Re: [sympy] Sympy assumptions

2014-12-05 Thread Aaron Meurer
They need to be positive. Even for integer x, sqrt(x**2) != x if x is negative. Aaron Meurer On Fri, Dec 5, 2014 at 3:34 PM, Francesco Bonazzi wrote: > newvars =symbols('x a b', integer=True) > e.xreplace(dict(zip([x,a,b], newvars))) > > I did not test this. > > -- > You received this message be

Re: [sympy] Sympy assumptions

2014-12-05 Thread Richard Fateman
You are heading into erroneous waters. It doesn't matter that 3>0. sqrt(9) has two values, +3 and -3. Just because some other systems make this mistake does not mean sympy should do this. If you want to say something about the choice of branch for sqrt(x^2), you have to say something about sqrt(

Re: [sympy] Sympy assumptions

2014-12-05 Thread Francesco Bonazzi
Sorry I mistyped. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit

Re: [sympy] Sympy assumptions

2014-12-06 Thread Yuxiang Wang
Hi Richard, I do get your point that we don't have to make the same mistake with other systems, but I do think there is a benefit for consistency, if they have a purpose in doing that design. For most systems, sqrt() returns the principal/positive square root, so there is only one unique value.

Re: [sympy] Sympy assumptions

2014-12-06 Thread Ondřej Čertík
Hi Richard, On Fri, Dec 5, 2014 at 4:48 PM, Richard Fateman wrote: > You are heading into erroneous waters. > It doesn't matter that 3>0. sqrt(9) has two values, +3 and -3. > Just because some other systems make this mistake does not mean > sympy should do this. > > If you want to say something

Re: [sympy] Sympy assumptions

2014-12-06 Thread Aaron Meurer
Something that I'm not sure about with representing functions as multivalued is, how do you represent arbitrary Riemann surfaces. Another question is computational. How do you compute the surfaces in general (say even for a limited class of expressions, like algebraic functions), and how do you ma

Re: [sympy] Sympy assumptions

2014-12-06 Thread Joachim Durchholz
Am 06.12.2014 um 17:03 schrieb Yuxiang Wang: Hi Richard, I do get your point that we don't have to make the same mistake with other systems, but I do think there is a benefit for consistency, if they have a purpose in doing that design. For most systems, sqrt() returns the principal/positive squ

Re: [sympy] Sympy assumptions

2014-12-06 Thread Ondřej Čertík
On Sat, Dec 6, 2014 at 1:01 PM, Aaron Meurer wrote: > Something that I'm not sure about with representing functions as > multivalued is, how do you represent arbitrary Riemann surfaces. > > Another question is computational. How do you compute the surfaces in > general (say even for a limited clas

Re: [sympy] Sympy assumptions

2014-12-06 Thread Yuxiang Wang
Hi Joachim, I was thinking of Mathematica and MATLAB Symbolic Toolbox, and both doing symbolic math rather than numerical systems. My experience is limited to these two though (that's the two my institution got a license for), so I'd be open to hear on more example / counter-examples. -Shawn

Re: [sympy] Sympy assumptions

2014-12-07 Thread Joachim Durchholz
Am 07.12.2014 um 04:41 schrieb Yuxiang Wang: Hi Joachim, I was thinking of Mathematica and MATLAB Symbolic Toolbox, and both doing symbolic math rather than numerical systems. Ah okay, then my hunch was wrong. Good to know. > My experience is limited to these two though (that's the two my in

Re: [sympy] Sympy assumptions

2014-12-07 Thread Joachim Durchholz
Am 07.12.2014 um 01:30 schrieb Ondřej Čertík: However, then, when you subtract this, you need to write this as: log(a*b) - log(a) - log(b) = 2*pi*I*n Wouldn't you need to write > log(a*b) = log(a) + log(b) as > log(a*b) = log(a) + log(b) + 2*pi*I*n as well? I think there is probably a wa

Re: [sympy] Sympy assumptions

2014-12-07 Thread Joachim Durchholz
Am 06.12.2014 um 21:01 schrieb Aaron Meurer: Something that I'm not sure about with representing functions as multivalued is, how do you represent arbitrary Riemann surfaces. Another question is computational. How do you compute the surfaces in general (say even for a limited class of expression

Re: [sympy] Sympy assumptions

2014-12-10 Thread Richard Fateman
1994 paper by Adam Dingle and Richard Fateman Branch Cuts in Computer Algebra, (ISSAC '94 proceedings. also search online). When you say things about sqrt(), does it generalize to cuberoot? If it does not, you are in trouble, or will be down the road. What is the principal value of (1)^(1/6)

Re: [sympy] Sympy assumptions

2014-12-11 Thread Joachim Durchholz
Am 11.12.2014 um 00:40 schrieb Richard Fateman: 1994 paper by Adam Dingle and Richard Fateman Branch Cuts in Computer Algebra, (ISSAC '94 proceedings. also search online). That paper assumes that everything can be refactored to logarithms plus arithmetic. Does that assumption hold? I could im

Re: [sympy] Sympy assumptions

2014-12-12 Thread Richard Fateman
On Thursday, December 11, 2014 8:16:09 AM UTC-8, Joachim Durchholz wrote: > > Am 11.12.2014 um 00:40 schrieb Richard Fateman: > > 1994 paper by Adam Dingle and Richard Fateman > > Branch Cuts in Computer Algebra, (ISSAC '94 proceedings. also search > > online). > > That paper assumes that ev

Re: [sympy] Sympy assumptions

2014-12-12 Thread Richard Fateman
On Friday, December 12, 2014 9:27:11 PM UTC-8, Richard Fateman wrote: > > > > On Thursday, December 11, 2014 8:16:09 AM UTC-8, Joachim Durchholz wrote: >> >> Am 11.12.2014 um 00:40 schrieb Richard Fateman: >> > 1994 paper by Adam Dingle and Richard Fateman >> > Branch Cuts in Computer Algebra,

Re: [sympy] Sympy assumptions

2014-12-13 Thread Joachim Durchholz
Am 13.12.2014 um 06:27 schrieb Richard Fateman: On Thursday, December 11, 2014 8:16:09 AM UTC-8, Joachim Durchholz wrote: Am 11.12.2014 um 00:40 schrieb Richard Fateman: 1994 paper by Adam Dingle and Richard Fateman Branch Cuts in Computer Algebra, (ISSAC '94 proceedings. also search online)

Re: [sympy] Sympy assumptions

2014-12-13 Thread Alan Bromborsky
You might want to take a look at the book by Garret Sobczyk New Foundations in Mathematics The Geometric Concept of Number Birkhauser On 12/13/2014 09:08 AM, Joachim Durchholz wrote: Am 13.12.2014 um 06:27 schrieb Richard Fateman: On Thursday, December 11, 2014 8:16:09 AM UTC-8, Joachim Du

Re: [sympy] Sympy assumptions

2014-12-13 Thread Joachim Durchholz
Am 13.12.2014 um 15:27 schrieb Alan Bromborsky: You might want to take a look at the book by Garret Sobczyk New Foundations in Mathematics The Geometric Concept of Number Birkhauser That's an interesting book for sure, though I'll probably lack the time to study it myself. I'm not sure how t

Re: [sympy] Sympy assumptions

2014-12-15 Thread Richard Fateman
On Saturday, December 13, 2014 6:08:58 AM UTC-8, Joachim Durchholz wrote: > > Am 13.12.2014 um 06:27 schrieb Richard Fateman: > > > > On Thursday, December 11, 2014 8:16:09 AM UTC-8, Joachim Durchholz > wrote: > >> > >> Am 11.12.2014 um 00:40 schrieb Richard Fateman: > >>> 1994 paper by Ada

Re: [sympy] Sympy assumptions

2014-12-16 Thread Kalevi Suominen
On Saturday, December 6, 2014 10:01:38 PM UTC+2, Aaron Meurer wrote: > > Something that I'm not sure about with representing functions as > multivalued is, how do you represent arbitrary Riemann surfaces. > A practical way of representing a Riemann surface is by means of coordinate functions a

Re: [sympy] Sympy assumptions

2014-12-16 Thread Joachim Durchholz
Am 16.12.2014 um 01:52 schrieb Richard Fateman: On Saturday, December 13, 2014 6:08:58 AM UTC-8, Joachim Durchholz wrote: But that wasn't my point anyway. I was thinking about calculating for all principal roots in parallel, and not choosing at all until it turns out that some choice is incons

Re: [sympy] Sympy assumptions

2014-12-16 Thread Alan Bromborsky
On 12/13/2014 10:23 AM, Joachim Durchholz wrote: Am 13.12.2014 um 15:27 schrieb Alan Bromborsky: You might want to take a look at the book by Garret Sobczyk New Foundations in Mathematics The Geometric Concept of Number Birkhauser That's an interesting book for sure, though I'll probably lac