Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
PH15720 Laboratory Techniques An Introduction to MATHCAD Lecture 2 Introduction Review of Last Week Variables Names for Things Using Units Text areas & comments Review of Last Session What, Why & Wherefore ? Starting MathCAD Simple calculations Saving work to M: drive Emailing worksheets Variables #1 Storage for numbers in MathCAD Write formulae without using ‘magic numbers’ Do not re-type intermediate results Simplifies changing parameters Use of variables - Example Compare the 2 solutions to a problem below Which is clearer ? Which is easier to change parameters ? mP vP mA vA 0 s olve vA mP 80 kg mA 60 kg vP m vA 0.3 s vP mP mA vA 0.4 mP vP mA Mass of panel Mass of astronaut velocity of panel Calculate velocity of astronaut m s Display Result 0.3 ( 80 kg) m s 60 kg 0.4 m s Variables #2 Variable set by using <name> := <expression> Assignment operator (:=) created by colon (:) key Declares the variable and sets its value to <expression> Variables #3 Variables displayed by = sign Press = key If variable already defined, MathCAD will print value = Otherwise MathCAD will create assignment operator & placeholder for you to define value := Names for Things Very Important step in problem solving Applicable to all problems Applicable to all solution methods Develop convention & stick to it Naming convention #1 Make names descriptive Use standard physics nomenclature UseCamelCapitalisation Examples: MRocket0 : initial mass VRocketFinal : final velocity Problem should suggest names Naming Convention #2 Keep names short Use comments to explain names Don’t try & put spaces in names Avoid using names already used for mathematical/physical constants (unless you mean it !) g,c,e,q,p MathCAD will warn you Naming Convention #3 Good examples: MBallA := 1.7 kg vBallA0 := 23 m/s Mass of Ball A Velocity of Ball A at t=0 VResA0 := 12 volt Voltage across Resistor A = 12V at t=0 Naming Convention #4 Bad examples: A := 7 m/s vTheBallThrownByJohn := 17 m/s No clue as to physical quantity Probably too short (unless diagram) Conflicts with A = Ampere Way too long g := 19 Redefined acceleration due to gravity Greek Letters Enter into variables etc by: Select from Greek toolbar Type corresponding roman character + <ctrlg> <ctrl-shift-p> = p Enter into text regions (comments) by changing to symbol font Using UNITS #1 All variables in MathCAD may have units attached to them Units propagate through calculations MathCAD checks to ensure ‘sanity’ Results may be manipulated to desired units Using UNITS #2 To enter units: Assign a variable (Name + :) Press * to introduce multiplication Either: Enter units if you know them Press <ctrl-u> or units button to bring up selection dialog Using units #3 Units displayed on result Speed Many possible 85 conversions mph 9 nm 1 10 ReactionTime 0.1 s m 6 m 1 10 m 3 mm 1 10 Dis tance SpeedReactionTime cm 0.01 m Dis tance 3.8 m m 1m Dis tance 12.467 ft km 1 10 m Dis tance 4.156 yd m in 0.025 m ft 0.305 m yd 0.914 m furlong 201.168 m 3 3 mi 1.609 10 m 10 Angs trom 1 10 m 11 bohr 5.292 10 cubit 0.457 m m Using Units #4 To convert units of result Select placeholder after result Type/select desired units for result MathCAD will scale result to new units. Will add extra terms if dimensions wrong 3.8 smph m ft Distance 12.467 Distance 8.5 Placeholder Text Regions #1 Very Important to: Introduce problem Introduce & explain variables Explain solution method Introduce & Explain answer Text Regions #2 Text regions added by: Insert|Text Region “ key Typing a comment. MathCAD will convert the text to a text region when the first space is typed. Text regions moved/resized with mouse – watch cursor change