ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 26 Jul 2016 22:41:17 +0200Detecting highest order derivative of a function in an equationhttps://ask.sagemath.org/question/34243/detecting-highest-order-derivative-of-a-function-in-an-equation/ I am working with some code that generates an equation with a number of derivatives. I do not know the order of the derivatives or the order. If I was working with something algebraic, for example:
a, b, c = var('a,b,c')
eqn = a**2 + 3*b + c
I could use something like
coeffs = eqn.coefficients(a)
highest_order = coeffs[-1][1]
to find out the highest order of `a`. It would also be okay if i could figure out the order of every derivative of a given function in an equation. I can do this if I know before-hand what the order of the derivative is
function('f')
eqn += f(a,b,c).diff(a,b)
eqn.find(f(a,b,c).diff(a,b))
and see that in fact that derivative is there somewhere. But what I really want, is for
eqn = f(a,b,c).diff(a,b) + b*f(a,b,c).diff(b,3) + c
to have something that (a) tells me 'eqn has `[D[0,1](f)(a,b,c), D[1,1,1](f)(a,b,c)]`' or, (b) 'the highest order derivative of `eqn` is `D[1,1,1](f)(a,b,c)`'. jupsalTue, 26 Jul 2016 22:41:17 +0200https://ask.sagemath.org/question/34243/