Change variables and expand around new variable (Mathematica)

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 3K views
ramparts
Messages
44
Reaction score
0
I have a differential expression that I want to expand to some order around infinity (it's for calculating weak-field limits in GR). I have two functions, B(r) and n(r), and some expression involving them along the lines of

n[r] (3 r B'[r]^2 - 4 B[r] (2 B'[r] + r B''[r]))

Basically I want to change variables to x=1/r and expand this expression around x=0 to, say, 5th order. This seems like it would be fairly simple, but I must be doing something wrong because Mathematica keeps giving me errors like

General::ivar: "1/r is not a valid variable."

I've tried several ways of doing this, but I'm still learning Mathematica so I'd appreciate having the right way pointed out! Thanks.

(I've also tried expanding around {r,Infinity,5} and just gotten a symbolic result which wasn't useful.)
 
Physics news on Phys.org
I don't have Mathematica, but I suggest that you create a simplified example of this situation and see if error happens. If it does, you can post the example. If it doesn't, it might lead to some other aspect of the problem that you failed to capture in the example.
 
I think the problem boils down to this: given a differential expression (like the one I posted) I don't know how, in Mathematica, to change variables and have Mathematica do all the chain rule through. I've since learned that Maple can do this (and indeed I've been using Maple for what I need to do) with its dchange function in the PDETools. I wonder how one can get the same functionality within Mathematica.
 
I can't help with that. I suggest you ask in the forum section Physics Forums > Other Sciences > Computing & Technology. > Math & Science Software