MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Treating units as positive constants?

  • To: mathgroup at
  • Subject: Re: Treating units as positive constants?
  • From: mek at (Mark E. Kotanchek)
  • Date: Mon, 2 Nov 92 09:13:51 EST

For this particular problem,

   I am doing some example calculations involving kinetic
   molecular theory for a freshman class. I want to carry units
   throughout, but I am stumped on how to have Mathematica
   simplify Sqrt[meter^2] to meter, etc.  Is there a way to do this
   without appearing overly complicated to the students (for
   example without having to introduce FullForm, Power, /., and
   such like)?

probably the approach you want is to redefine some Mma functions before you  
get into the problem, i.e.,

   Sqrt[x_^y_] := x^(y/2)/;EvenQ[y];
   Power[x_^y_,z_] := x^(y/2) /; EvenQ[y] && z==1/2;

I just include these re-definitions (which are a composite of previous  
discussions in the mmaGroup) at the start of every file in an initialization  
cell. If I really knew what I was doing, I suppose I could put them in a  
package and call them via something like,


but I haven't gotten around to that yet. ;)

For what it's worth,

Mark Kotanchek
Guidance & Control Dept - 363 ASB
Applied Research Lab/Penn State
P.O. Box 30
State College, PA 16804

e-mail:	mek at (NeXTmail)
TEL:	(814)863-0682
FAX:	(814)863-7843

  • Prev by Date: How to calculate Fisher Information?
  • Next by Date: A Boolean 0/1 function in Mma?
  • Previous by thread: Re: Treating units as positive constants?
  • Next by thread: Re: Listable vs. Thread