Marcel,

I believe you are correct that sympy has a problem with this. I ran into 
issues when trying to define the behavior of integration and 
differentiation for the equation class I have defined. Unfortunately, I am 
completely swamped with committee and large class administration duties 
right now, so cannot really spend time on this. My basic thoughts are that 
to make this work well, SymPy would need to be expanded to include the 
concept of a partial differential. I believe some of that has been 
discussed on this list. I will write again, if I find time to dig up the 
discussions.

Jonathan

On Tuesday, October 5, 2021 at 12:34:08 PM UTC-5 
m.ol...@jacobs-university.de wrote:

>
> Hello,
>
> I am currently converting, for teaching purposes, a number of code 
> examples from Mathematica to sympy in order to have a purely Python-based 
> teaching environment (the numerical part has long been done in 
> Numpy/Scipy).  
>
> I have now run into a situation where I can get some code to work in a 
> mathematically correct way, but produce output that makes me think I am not 
> doing things quite right.
>
> The task is to use sympy to verify the order of a finite difference time 
> integrator for an ODE (for the sake of simplicity, autonomous), which 
> involves Taylor expanding the error with respect to the stepsize parameter, 
> the substituting the differential equation and its derivatives.
>
> The attached code does just that, here with the implicit midpoint rule as 
> a simple example.   The issue I have is that sympy does not seem to have 
> the notion of an abstract derivative, so the series expansion produces 
> terms where Subs is used to represent derivatives with an argument that is 
> not simply a symbol.  In the end, however, I have to force evaluation with 
> doit((), so that terms cancel properly, which has the side effect that all 
> Subs are resolved and I get nonsense terms like
>
>   Derivative(f(y(0)), y(0))
>
> Of course, I could just ignore this as I have already achieved my goal, 
> but I am trying to teach "good" sympy and this result strikes me as not 
> being formulated the way it should.
>
> Any comments highly appreciated!
>
> Marcel
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/3a35d4c8-c439-4259-bf03-5ba8a27e4cf3n%40googlegroups.com.

Reply via email to