Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Feb 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 af[x] is only lengthf[x]. – Daniel Lichtblau Feb 20 '12 at 23:32
1  
@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.

To summarise, one should almost always switch to dimensionless units before numerically solving a problem.

share|improve this answer
1  
Your advise remind me an almost forgotten juvenile favorite en.wikipedia.org/wiki/Mr._Tompkins – Dr. belisarius Mar 8 '12 at 1:37
    
This is useful to know but it still seems very weird that Mathematica would produce a dimensionally inconsistent solution to a dimensionally consistent equation. I'd be interested to know more about this but I can't think of a good way to formulate a question. – David Z Jan 4 at 14:11
1  
@DavidZ: The use of units in DSolve and allied functions was discussed a bit in this question: DSolve returns a “wrong” solution – Michael Seifert Jan 5 at 17:06
1  
@MichaelSeifert Thanks, that's useful. Though the manipulation that solves that particular case ($\log A - \log B \to \log\frac{A}{B}$) is standard practice in physics. What motivated my comment was the situation in this question of mine, which doesn't seem to be so easily dealt with. There are no logarithms involved there (unless they're "hidden" somehow). – David Z Jan 5 at 17:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.