Mathcad PrimerMathcad手册.docx
《Mathcad PrimerMathcad手册.docx》由会员分享,可在线阅读,更多相关《Mathcad PrimerMathcad手册.docx(26页珍藏版)》请在冰豆网上搜索。
![Mathcad PrimerMathcad手册.docx](https://file1.bdocx.com/fileroot1/2023-4/25/0ab4a58f-9eae-4dfa-93cd-859d53908b38/0ab4a58f-9eae-4dfa-93cd-859d53908b381.gif)
MathcadPrimerMathcad手册
AMathcadPrimer
ThisdocumentwillsummarizemanyofthefeaturesofMathcad11andhowthesefeaturesareusedtosolvephysicalchemistryproblems.ItisnotareplacementfortheMathcadReferenceGuidebyMathsoft®.
YouneedtoenablePrintLayoutViewinWord(View,PrintLayout).
YoucanCTRL-clickanytopictogotoanysectionoryoucanscrolldown.
Contents
TheMathcadWindow2
EnteringText3
EquationsandVariables3
ImportantWarningaboutTypicalScientificSymbols6
SelectingandEditing7
VariableNames7
Units8
DefiningYourOwnUnits9
EasyGraphs10
RangeVariablesandGraphs12
ZoomandTraceFunctionsinaGraph14
DataandDataFiles:
ExcelData15
EnteringDataintoMathcad16
CopyingDatafromEXCEL17
NumericalCalculations17
NumericalRootsofEquations18
SymbolicCalculation19
SymbolicIntegration20
TheAssumeKeyword21
PartialDerivatives22
SolvingEquations22
TheMathcadWindow
WhenyoustartMathcad,thescreenshouldappearasshownbelow.Aseriesofmenuitemsarelisted,andunderneaththemenuaretoolbars.AnancillarytoolbarcalledMathappearstotheright.Inthisdocument,menucommandswillbenotedasItem1,item2,andsoforth.Asanexample,theprintpreviewcommandwouldbetypedas:
File,PrintPreview.ToexecutethecommandyouwouldpointtoFile,thenselectPrintPreviewfromthedrop-downlist.
Ifyoudonotseealltheitemsinthegraphic,gotoView,Toolbars,andselectthetoolbarsthatyouwishtosee.Yourfirstassignmentistocheckthevariousmenuitemstoseewhattheycontain.
Thepageboundaryshowsyouwhatwillfitonanormalpagewhenthedocumentisprinted.Materialtotherightoftheboundarywillprintonthenextpage.
ThetoolbarunderthemenuistheStandardtoolbarandcontainsiconsfor:
Newdocument,Opendocument,Save,Print,PrintPreview,andsoon.Theseiconshavetooltips(littletagsthatinformyouoftheirfunctions).Ifyouforgetwhatanicondoes,holdthemousepointeroveritforasecondandthetooltipwillappear.
Notetheredcrosshairinthedocumentwindow.ThisistheinsertionpointinMathcadandanytypedinformationwillappearatthispoint.Clickingthemouseinanewlocationmovestheinsertionpoint(tryit!
).
EnteringText
InMathcad,textisdifferentfrommathematics.Textinformationandmathinformationhavetheirseparatefonts,colors,andstyles.Theformattingtoolbar(theonerightabovetheactualdocument)hasastyleboxthatinformsyouofthetypeofinformationthatisbeingtypedorselectedinthedocument.Thedefaultstyleisvariablessowhenyoutype,Mathcadassumesyouaretypingmathematics.
Ifyouwishtotypetext,firsttypeaquotationmark,“.ThequoteopensatextregioninMathcadandyoucantypeanytextthatyouwish.Clickanywhereoutsidethetextregiontostop.
AnygoodMathcaddocumentshouldcontaintexttoannotateandexplainthecalculations.Youcan,andshould,changetheappearanceoftexttodistinguishitfrommath.YoucandothisbytypingFormat,Style.Thisbringsuptheformatdialogbox.Tochangethetextfont,chooseNormalandclickmodify.Clickthefontboxandyoumaychangethefontstyle,size,andcolor.Agoodchoiceistomaketextfontadifferentcolorthantheblackfontusedforvariables.
EquationsandVariables
Mathematicalexpressionsaretypedintheusualway,usingthe+,–,/,and*keysforaddition,subtraction,division,andmultiplication.Exponentsareenteredwiththe^key.Youmustremembertoincludethemultiplicationsymbolinallexpressions.Mathcadwillinterpretxyasanewvariable,andnotastheproductofxandy.Herewetype5*12=andyoucanseetheresultis60.Ifwetype512=Mathcadinterpretsthesecondstatementasthenumber512asyoucanseefromtheresult.
Forgettingthemultiplicationsymbol(*)isthemostcommonsourceofheadachesforMathcadbeginners.
AconvenientwaytoseemultiplicationistogotoTools,Worksheetoptions,Display.Ifyoumakethemultiplicationsymboladot,largedot,or,itwillbehardtomiss.
Youmustfirstdefineavariablebeforeyouuseitinacalculation.Intheexamplebelow,xisnotdefinedatthebeginningandishighlightedbyMathcadinred(anerror):
Todefineavariable,usethe:
=operator.Youenterthisbytypingacolon.The:
=isanassignmentoperatorinMathcad;itstatesthatthevariableontheleftisassignedthevalueorexpressionontheright.Youcannotdefineanexpressionontherightsideofthisoperator;14:
=sin(x)willproduceanerror.
Sometypicaluses:
Trytheassignmentoperatorbytypingx:
12.5andobservetheresult.Commonmathematicalfunctionscanbefoundbyusingthefunctionicon,f(x)onthetoolbar.Trydefininganewvariabletobethecosineofyandsetyequalto15.
Toevaluateanexpression,usethe“normal”equalssignjustasyouwouldinnormalmathematics.
Noticethatthefunctionisalwaysontheleftsideoftheassignmentoperator.Anexpressionsuchas
makesnosensetoMathcad.
Exercise:
Defineavariabletorepresentthedistanceasafunctionoftime.Thedistancefollowsthisexpression:
initial_position+11.5*time+1.2*time2.
Settheinitialpositionto255andcalculatethepositionattime=2,12,25.
Exercise:
Harmonicmotionfollowsasinusoidalpattern:
position=amplitude*sin(time)+phase.
Defineavariabletorepresentthepositionasafunctionoftimewhentheamplitudeis1.5andthephaseiszero.Calculatethepositionattime=0,12,24,44.
Whatchangetopositionoccursifthephasechanges?
ImportantWarningaboutTypicalScientificSymbols
Mathcadhasabuilt-insetofunitsthatareusedforcancellationandobtainingtheunitsofananswer.Thisisaverypowerfulconceptbutsometimestheseunitscancauseconfusionwhenyoutrytomakethemvariables.Acommonexampleisg.Weallliketousegforgrams,butMathcadhasalreadydefinedthissymbolastheaccelerationduetogravity:
ThisproblemalsooccursforT.WeliketouseTfortemperature,butitrepresentsTesla,thebuilt-inunitformagneticfluxdensity.YoucanuseTinthismanner:
T=325K,whereKisthesymbolforkelvintemperature.Anotherproblemexistsforthelettere.WetypicallyuseeasthechargeonanelectronbutinMathcad,erepresentsthebaseofnaturallogarithms(e=2.781828….).Mathcadalsowriteseasexpasinex=exp(x).
SelectingandEditing
Mathcadexpressionscanbeeditedusingthestandardwindowsmethodsforcut,copy,andpaste.Beforeeditingpartofanexpression,theappropriatesectionmustbeselected.Toselectanarea,clickinsidetheexpression;theredcrosshairwillbecomeablueselectioncursorthatlookslike,or.Thesmall“foot”onthecursorindicateswhichwaythedatawillbeselected.willselecttotheright,whilewillselecttotheleft.Usetheinsertkeytochangethedirection.Thespacebarrepeatedlyexpandstheselection,andtheandkeysmoveitrightandleftrespectively.Tryitonanexpressiontoseehowthesekeyswork
Thespacebarchangestheselectionbypartsofanexpression(piecesconnectedby+,–,*,/),whilethearrowsmovecharacterbycharacter.Itiseasiertoobservethantoexplain.Buildandexpressionsuchas
andtryit.
Onceapartofanexpressionisselected,youcancutit,deleteit,orcopyit.Youcanalsoedititbysubstitutingdifferentoperators.Textiseditedinthesamemanner.AnyselecteditemcanbepastedintoanotherdocumentsuchasaWorddocumentoranExcelspreadsheet.AlloftheMathcadworkinthisprimerwaspasteddirectlyfromMathcadintoWord.
VariableNames
Mathcadallowsalmostanynameforavariableaslongasthenameisnotapredefinedfunction.Someexamplevariablesare:
Variablenamescanbeanycombinationofalphanumericcharacters.Thesenamesshouldbeginwithaletterandshouldnotcontainsymbolsexceptfortheunderscore(_),percent(%),oraprime(`).Youcannotuseunitsymbolsorbuilt-infunctionsasnames(toseealistofbuilt-infunctions,clickthef(x)onthetoolbar).Someexamplesofvariablesare:
This_is_a_variableokay
Mass_protonokay
Variable_4okay
Vokay
1st_valueinvalid;beginswithanumber.
Sin(X)invalid;sinisabuilt-infunction.
Alistofpredefinedfunctionscanbefoundbyclickingthef(x)icononthetoolbar.
Assimpleexampleofvariables,wecalculatePfromtheidealgaslaw.Definesomevaluesandevaluatethepressure.
Thevariablesaredefinedinthefirstline;Pisthendefined(asnRT/V)andevaluated.Ifanyvariableisleftundefined,theundefinedquantitieswillbeinred(anerror).Inthisexample,wedeletethedefinitionforV,thereforePcannotbecalculated.
Youcanputasubscriptaspartofavariablenamebyusingtheperiodcharacteronthekeyboard.Ifwetypev.initial(that’svperiodinitial),weget
inthedocument.Subscriptedvariablenamescanbequiteuseful.
Units
Bydefault,MathcadwillusetheSIunitsystemforallcalculations.YoucanchangethisintheTools,Worksheetoptions,Displaycommand.GototheUnitstabandchooseasystemofunitsorsetittonone.Youenteraunitforanyquantitybymultiplyinganumericalvaluebytheunit.Ifyouwantavolumeof15liters,youtypeV:
15*L.Thepreviousgaslawexample,withunitsis:
MathcadautomaticallycancelsunitsandproducestheresultinPascals(thedefaultSIunitforpressure).Ifyoupreferadifferentunitfortheresult,clicktheexpressionandablackboxwillappearafterthePaunit.Double-clickthisboxandasetofpossibleunitswillbeshown;youcanchoosetheunitsyouwant.Herewechangetheanswertoatmospheres.
Aneasywayto