[Date Index] [Thread Index] [Author Index]
Re: Incompatible units?
On 3/19/09 at 5:25 AM, mathias.lindner at web.de (Mathias Lindner) wrote: >Today I struggled with the units package - again... >Let me show you what I did: >Dynamic[Subscript[\[Tau], p]] >Subscript[l, case] >\[Lambda] = \Convert[Subscript[l, case]/Dynamic[Subscript[\[Tau], p]], 1] >This input results in: >27.4889 Meter Milli >281 Meter Milli >Convert::incomp : Incompatible units in (281 Meter Milli)/(27.4889 >Meter Milli) and 1. (281 Meter Milli)/(27.4889 Meter Milli) >If I don't use dynamic but constant tau_p everything is fine... So >Mathematica isn't able to to reduce this fraction? What's the reason >for this behaviour and what can I do about it? I interpret your "everything is fine" to mean you got the result you expected/wanted. And it is not at all obvious to me why you are really attempting to do. It appears you want to use a subscripted variable. While this can be done in Mathematica using the Notations package, it is not as simple as just setting Subscript[\[Tau], p] to some value. Mathematica sees things with Head Subscript as totally different than things with Head Symbol. And it is things with Head Symbol Mathematica treats as variables that can be assigned values. That is, unless you go to a bit of trouble, Mathematica does not work as you might expect with subscripts. I strongly suspect this is the issue you are encountering rather than a specific issue with the units package. Try your code using simple symbols without the subscripts. If this works and you really want subscripted variables, learn how to use the Notations package.