Re: [sympy] defining a derivative

2016-10-17 Thread Riccardo Rossi
iterating a little more, unfortunately the "doit" fails at the next bend... this code from sympy import * u,B = symbols('u B') e = B*u #here i use an expression instead of a function s = Function('s')(e) print(diff(s,u).doit()) is expected to give somethign like B*Derivative(s(e),e) instead

Re: [sympy] defining a derivative

2016-10-17 Thread Riccardo Rossi
Dear Aaron, your suggestion did work, HOWEVER i had to upgrade sympy to 1.0. It did nothing on 0.7.6 (the default one on ubuntu 16.04) only writing here to "document" this behaviour regards Riccardo -- You received this message because you are subscribed to the Google Groups "sympy" group.

Re: [sympy] defining a derivative

2016-10-16 Thread Aaron Meurer
On Sun, Oct 16, 2016 at 4:59 AM, Riccardo Rossi wrote: > Dear Aaron, > > first of all thank you for answering. > > before i start subclassing, let me ask if i can do something easier: can i > use "subs"? > > right now i am failing, but there might be some obvious error in

Re: [sympy] defining a derivative

2016-10-16 Thread Riccardo Rossi
Dear Aaron, first of all thank you for answering. before i start subclassing, let me ask if i can do something easier: can i use "subs"? right now i am failing, but there might be some obvious error in what i do... in any case i also tried (and failed) with your suggestion, surely due to my

Re: [sympy] defining a derivative

2016-10-14 Thread Aaron Meurer
If you want to define advanced things you need to subclass from Function rather than using symbols(cls=Function). For derivatives, you should define fdiff, which should return the derivative of the function without consideration of the chain rule. For example, search for "fdiff" in this file to