Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

Re: Treating units as positive constants?

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Treating units as positive constants?
  • From: mek at guinan.psu.edu (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.,

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

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,

   Needs["myUtilities`mmaIsStupidFix`"];

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

For what it's worth,

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

e-mail:	mek at guinan.psu.edu (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