Group Abstract Group Abstract

Message Boards Message Boards

13
|
43.8K Views
|
15 Replies
|
27 Total Likes
View groups...
Share
Share this post:

Palette for Inputting Typeset Units and Package with Input Aliases

Posted 12 years ago
I have written a palette and a package to help input properly typeset units.  The palette and package allow for quick input of units in Mathematica, avoiding the clunky units-discovery approach involving Wolfram Alpha queries. As an example, the expression below can be inputted quickly using the palette or by using the input aliases that are loaded by the package.

The link to a page for downloads is: http://www.blinn.edu/brazos/natscience/phys/thonan/Mathematica/ .
POSTED BY: Terrence Honan
15 Replies
POSTED BY: Terrence Honan
Posted 10 years ago
POSTED BY: Benny Bomstærk
POSTED BY: Ben Rodanski
POSTED BY: Terrence Honan
POSTED BY: Gianluca Gorni
POSTED BY: Ben Rodanski
POSTED BY: Terrence Honan
POSTED BY: Ben Rodanski
Posted 11 years ago
POSTED BY: Raymond Low
POSTED BY: Dave Lubbers
Posted 12 years ago
Thank you Hans. I've been using the q method myself, and for now I think the q method that Mr Honan came up with is the best method there is. I hope that WRI incorporates this in future MMA releases. I
POSTED BY: Kyle Nguyen
Posted 12 years ago
Hi Kyle I have found the esc q 'symbol' esc approach to be quite seamless especially as there are already quite a large number shortcut inputs that follow that pattern that I already use. At least this way keeps all the unit symbols (eg m, l, s, g, A,...) free to be user defined smbols and not Protected. I installed the palette about a month ago I am finding usage of Mathematica's unit functions so much more accessible. Here's some code I put together to generate a function to format partially worked explanations for my students that were having trouble extracting info from worded problems; converting units and correctly applying Boyle's law - not overly complex but never the less the unit template made entering quantities fast enough to make it possible to use my predefined function on the fly in class.

(*define function*)
boylesLaw[p1_,v1_,p2_,v2_,precision_]:=SetPrecision[Style[Grid[{{"Identify all information given in the question and convert to SI units"},{},{Grid[{{"Subscript[P, 1]","=",p1,"=",N@UnitConvert[p1,kPa]},{"Subscript[V, 1]","=",v1,"=",N@UnitConvert[v1,L]},{"Subscript[P, 2]","=",p2,"=",N@UnitConvert[p2,kPa]},{"Subscript[V, 2]","=",v2},{},{"This question requires Boyle's Law:",SpanFromLeft},{"Subscript[P, 1]Subscript[V, 1]","=" ,"Subscript[P, 2]Subscript[V, 2]"},{"\[Therefore] Subscript[V, 2]","=","(Subscript[P, 1] Subscript[V, 1])/Subscript[P, 2]","=",Column[{Row[{ N@UnitConvert[p1,kPa]," * ",N@UnitConvert[v1,L]}],N@UnitConvert[p2,kPa]},Alignment->Center,Dividers->{None,{None,True,None}}],"=",N@UnitConvert[(v1 p1)/p2,"Liters"]}},Alignment->Left]},{},{Row[{"\[Therefore] the final volume is ",Style[ScientificForm@UnitConvert[(v1 p1)/p2,"Liters"],Bold]}]}},Alignment->Left],"Text"],precision]


(*example usage, quantities can be entered easily using using esc q 'symbol' esc from InputUnits aliases*)
boylesLaw[101kPa,50mL,4atm,"?",3]
POSTED BY: Hans Schmidt
Posted 12 years ago
This unit palette is invaluable for scientists and engineers to conveniently work with units. I switched from Mathcad to Mathematica because of the vastly improved computational resources, but one thing I really miss about Mathcad is its brilliant handling of units--a letter "m" after a number immediately shows up as meters, with a different syntax highlighting than the number itself. This palette (and the hotkey package) is a big step toward that goal, but I'd love to see this fully integrated into Mathematica such that the user could just append a unit naturally after a number--as he/she would on paper--and use that for future calculations. I firmly believe that adding this feature (instead of the clunky and slow Quantity function) to future releases of Mathematica would lead to much greater adoption by scientists and engineers alike.

POSTED BY: Kyle Nguyen
Posted 12 years ago
Awesome palette, it's worthy of full inclusion for Mathematica v10!! It's the physics teacher's dream addition to Mathematica. Thank you for sharing Terry.

Cheers,
POSTED BY: Hans Schmidt
This is excellent, Terrence, - something I needed. I Thanks for sharing!
POSTED BY: Sam Carrettie
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard