# Using physical dimensions in Mathematica DSolve

I would like to calculate a system of two differential equations in Mathematica using DSolve, like:

fx''[x] + a*fx[x] == -I*eta*fy''[x] - b*fy[x], ...


where fx[x] and fy[x] are unknown functions. Using DSolve I can easily find some solutions of the type fx[x] = C[1]*cosh[x/L] + C[2]*a*sinh[x/L], where L is a term of the dimension of x.

The problem is, that the parameters a and b in my equations have physical dimension (e.g. meter). From the analysis of the solution the two terms in the result have different physical dimension, which is nonsensical. Another option is that Mathematica rescaled C[1] so that finally it has dimension of a*C[2].

My question is: Can I somehow control the physical dimensions of the parameters (a,b) in the differential equations or the constants C[1], C[2] in the result?

-

## migrated from stackoverflow.comFeb 20 '12 at 17:05

This question came from our site for professional and enthusiast programmers.

You input appears to have the same issue. If x and a have dimensions of length then f''[x] has dimensions of length^2*f[x] whereas a*f[x] is only length*f[x]. –  Daniel Lichtblau Feb 20 '12 at 23:32
@DanielLichtblau: If x has the dimension of length, f''[x] of course has the dimension (dimension of f[x])/length^2. For the equations to be dimensionally correct, a must have the dimension 1/length^2, and b must have the dimension dim(eta)/length^2. –  celtschk Feb 21 '12 at 9:32

It is generally better to work in dimensionless units to start with. In your case, your a and b have units of $L^{-2}$, while eta is dimensionless. Taking fx''[x] + a*fx[x] == -I*eta*fy''[x] - b*fy[x] as an example, you could use $\xi=x/L$, $\alpha=a L^2$, $\beta=b L^2$ (all of which are now dimensionless), whereupon your differential equation becomes $L^{-2}\left(\partial_{\xi,\xi}F_x(\xi)+\alpha F_x(\xi)+i\eta \partial_{\xi,\xi}F_y(\xi)+\beta F_y(\xi)\right)=0$, where I have set $F_x(\xi)=f_x(x)$ and similarly for $y$. Solving the equation in the brackets is what you really should do; no problems like you mention above can now arise.