What's the result that you would expect? I get

In [31]: diff(F_tensor, b)
Out[31]: -2⋅(-a - b⋅x[i] + y[i])⋅x[i]

By the way, your code should just be i = Idx('i'). map returns a list in
Python 2 and an iterator in Python 3.

Aaron Meurer



On Fri, Aug 8, 2014 at 1:46 PM, Станислав Иванов <[email protected]>
wrote:

> >>> from __future__ import division ... ... from sympy import * ... from
> sympy.tensor import IndexedBase, Idx ... ... a, b = symbols('a b') ...
> F_tensor = symbols('F_tensor', cls=Function)
> ... ... i = map(Idx, ['i']) ... ... x = IndexedBase('x') ... y =
> IndexedBase('y') ...
> >>> F_tensor = (y[i] - (b*x[i]+a))**2
> >>> F_tensor
> (−a−bx[i]+y[i])2
> >>> diff(F_tensor, b)
>  −2(−a−bx[i]+y[i])2 x[i](−a−bx[i]+y[i])−1
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/37834bb3-bae0-4678-9471-34b0afacca9e%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/37834bb3-bae0-4678-9471-34b0afacca9e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To post to this group, send email to [email protected].
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%3D6Jzb10-0-JVagocdsHfgTdCm%3D7HGzkU2_cA369h_JvL4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to