Question: Linearizing differential equations

Hi! I was wondering if anyone knows of a way to taylor expand an expression around a function. For example, let's say I have an expression like

expression := diff(f(r), r$2) + exp(-f(r))*(1 - g(r))^2

and I want this expression to be linear order in f and g. If I try

mtaylor(expression, [f(r), g(r)], 2)

I get an error. I don't want to replace f(r) with just f (for example) because then all of the derivative terms vanish, and I want this to also be of linear order. 

Ultimately, I want to take a nonlinear diff equation that I get somehow, linearize it, and then plug in the result to dsolve.

Thanks!

Please Wait...