On Thu, Jun 4, 2009 at 10:31 AM, smichr <[email protected]> wrote:
>
> I happened across the following unexpected result from sympification
> of an expression:
>
>>>> x=Symbol('x',dummy=True)
>>>> diff(sympify('x**(1/2)'),x)
> 0
>>>> x=Symbol('x')
>>>> diff(sympify('x**(1/2)'),x)
> 1/(2*x**(1/2))

It's because if you create the symbol "x" in sympify (which is what
you are doing), it will not be a dummy symbol *and* if you
differentiate with respect to a dummy symbol, then you should obtain
0, which is a correct answer.

>
> Is this an issue that two different results are obtained when
> differentiating the sympified sqrt(x) expression? If I don't sympify
> the expression first, then using a dummy symbol is no problem:
>
>>>> x=Symbol('x',dummy=True)
>>>> diff(x**(S(1)/2),x)
> 1/(2*_x**(1/2))

Here you are differentiating with respect to the *same* dummy symbol
(unlike the case above).

So all should be fine here.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to