Re: [sympy] diff(x^x,x)

2015-05-31 Thread Aaron Meurer
Actually, that's not quite true. SymPy has its own boolean types, and
x ^ x gives the SymPy BooleanFalse (S.false). The derivative of this
is 0 not because it interprets it as a numeric 0 but because it
doesn't depend on x, and diff automatically knows that the derivative
of any expression that doesn't depend on x is 0.

Perhaps we should make derivatives of booleans give TypeError. That
would make it much easier to see what is going on.

It may also be worth it to print a warning in SymPy Live when ^ is used.

Aaron Meurer

On Sat, May 30, 2015 at 1:01 PM, Christophe Bal projet...@gmail.com wrote:
 And because  x^x  means  x xor x  which numeric value is  0  or  1  so the
 derivative is equal to zero.


 Christophe BAL
 Enseignant de mathématiques en Lycée et développeur Python amateur
 ---
 French math teacher in a Lycée and Python amateur developer


 --
 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 this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sympy/CAAb4jG%3DudR3U3EG2VDUW5qdAG5TEo8HBxTDWc8f3_4f9a20Vjw%40mail.gmail.com.

 For more options, visit https://groups.google.com/d/optout.

-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6KPDAgP%3DdWcomB98OFiED8qdmOVBNfTvK8OttvvfbVs7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] diff(x^x,x)

2015-05-31 Thread Joachim Durchholz

Am 31.05.2015 um 22:50 schrieb Aaron Meurer:

Perhaps we should make derivatives of booleans give TypeError. That
would make it much easier to see what is going on.


+1

Similarly, integer-valued functions should (probably?) emit a warning if 
a derivative is taken. The derivative is technically correct, but 
usually not what one wanted.



It may also be worth it to print a warning in SymPy Live when ^ is used.


I'll be all for it if somebody picks that up.

--
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/556B7A6C.4030009%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] diff(x^x,x)

2015-05-31 Thread Christophe Bal
I also vote for the TypeError.
Le 31 mai 2015 23:17, Joachim Durchholz j...@durchholz.org a écrit :

 Am 31.05.2015 um 22:50 schrieb Aaron Meurer:

 Perhaps we should make derivatives of booleans give TypeError. That
 would make it much easier to see what is going on.


 +1

 Similarly, integer-valued functions should (probably?) emit a warning if a
 derivative is taken. The derivative is technically correct, but usually not
 what one wanted.

  It may also be worth it to print a warning in SymPy Live when ^ is used.


 I'll be all for it if somebody picks that up.

 --
 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 this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sympy/556B7A6C.4030009%40durchholz.org.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAAb4jGk%3DYo2Wx4AOm83LDyKgZwGxU79FWxzeUAKA1tsqZWCWcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] diff(x^x,x)

2015-05-30 Thread Christophe Bal
And because  *x^x*  means  *x xor x*  which numeric value is  *0*  or  *1*
 so the derivative is equal to zero.


*Christophe BAL*
*Enseignant de mathématiques en Lycée **et développeur Python amateur*
*---*
*French math teacher in a Lycée **and **Python **amateur developer*

-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAAb4jG%3DudR3U3EG2VDUW5qdAG5TEo8HBxTDWc8f3_4f9a20Vjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] diff(x^x,x)

2015-05-30 Thread Francesco Bonazzi
In [1]: x^x
Out[1]: False

In [2]: diff(False, x)
Out[2]: 0



You should use  instead of *^* if you'd like to represent 
exponentiation. The symbol ^ stands for XOR.


On Friday, 29 May 2015 23:17:11 UTC+2, Oscar wrote:


 On 29 May 2015 22:06, Thomas Leitz unruh...@gmail.com javascript: 
 wrote:
 
  Hi,
 
  the online shell at http://live.sympy.org/ tells me
 
  diff(x^x,x) = 0
 
  Why is that?

 ^ doesn't do what you're expecting in Python. Use ** for exponentiation.

 --
 Oscar 


-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/39df2b7e-b133-4c5c-ab4d-f535cd9c3df2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[sympy] diff(x^x,x)

2015-05-29 Thread Thomas Leitz
Hi,

the online shell at http://live.sympy.org/ tells me

diff(x^x,x) = 0

Why is that?

Tom

-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/5f6df3dd-904b-4d1a-afcc-9ce8ff0d7a50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sympy] diff(x^x,x)

2015-05-29 Thread Oscar Benjamin
On 29 May 2015 22:06, Thomas Leitz unruhsc...@gmail.com wrote:

 Hi,

 the online shell at http://live.sympy.org/ tells me

 diff(x^x,x) = 0

 Why is that?

^ doesn't do what you're expecting in Python. Use ** for exponentiation.

--
Oscar

-- 
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 this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxSNEU1dGr9zKOXRq1uFQYYEz10qHNku0JmzGmCqBhAq2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.