Basic Calculation and Graphing                     


Dr. Andrzej Korzeniowski
Department of Mathematics, UTA

Lesson 1


Mathematica operations are based on the concept of a list {a, b, ..., c} where a, b,...  are symbols or numbers.  Use built-in palettes : BasicInput (shown as default next to the notebook) found in Files->Palettes->BasicInput. To put an expression of choice in a given place click the cursor in that place and then click the desired item from palette. Use Format-> Show ToolBar to see in the left-upper corner the attribute of the cell containing the active cursor.  Input cells hold commands that execute mathematical operations while Output cells store the answer.  Other layout options are: Text, Title, Section, etc. (word processing only and not to be executed).  Expressions are stored in cells displayed  as blue brackets on the right-hand side.  Cells can be formatted  or operated on by being selected (clicking on cell bracket to highlight it in black) then going to Cell (main menu) and using pull-down menus. Most useful initially  are: Cell Grouping (first choose Manual Grouping ->Ungroup Cells) so each executable expression is entered in a separate single Input cell for easy corrections, Divide Cell (put cursor in a desired place in the cell), Merge Cell (highlight cells to be merged).  Use the online HELP in the main menu to familiarize yourself  with many  other features. To delete a cell highlight the cell and press Delete key. Use copy, cut, paste, undo, from Edit to avoid unnecessary typing.





TYPING TEXT.  To type a text highlight a cell and choose Text from the ToolBar.  

NUMERICAL EVALUATION. To evaluate an  expression Expr  numerically use N[Expr] or Expr//N. To evaluate with n digit of accuracy use N[Expr,n]


FUNCTIONS.  All  elementary functions  MUST begin with a CAPITAL LETTER
followed by BRACKET [x] in place of parenthesis (x). List of  basic functions:
Sin[x], Cos[x],Tan[x], Cot[x], ArcSin[x], ArcTan[x], Log[x](=ln x = natural logarithm), Log [b, x] = [Graphics:Images/lesson1_gr_25.gif]x),  [Graphics:Images/lesson1_gr_26.gif] (exponential function base natural number ⅇ = 2.71828182, where ⅇ must be taken from the BasicInput palette (do NOT use 'e' from the keyboard),
Abs[x] (= |x| = absolute value of x ).

BRACKETS [ . ]  Used exclusively for defining functions, i.e., f[x]  NOT  f(x).
Parentheses are used only for grouping symbols in algebraic/numerical expressions.  
In fact, never use   [.], {.} in algebraic/numerical expressions.



Warning: The graph above is NOT a true picture!!!
A true picture
, i.e., with the units of length on the x and y axes equal,  is rendered by the
graphics option shown below (the default is 1/Golden Ratio = [Graphics:Images/lesson1_gr_29.gif]=.618)



DEFINITIONS.  To define expressions use " = " while for defining functions the syntax is f [x_ ] = [Graphics:Images/lesson1_gr_32.gif]+[Graphics:Images/lesson1_gr_33.gif],  or  g [x_ , y_ ] = (x + y - 1) / 3,  i.e., x_ = x followed by the underline symbol _.  Semicolon ";" at the end of the expression prevents writing it back to the screen. ": = " instead of " = " causes the output (after its execution) not to be displayed on the screen .


CONDITIONAL DEFINITION of f [x] .   Depending on what the x-values are:





Most  equations (e.g., polynomials  of degree 5 or higher) cannot be solved symbolically.  
One uses in those cases the built-in functions to obtain approximate numerical solution.


GRAPH TRACING.  One can change the position and size of the graph by using the mouse: Click on the graph+hold+drag
(= moving), click+hold corners+drag (= sizing).  Also, by pressing the Ctrl key one can move the mouse cursor to trace the
points on the graph and read the coordinates in the left lower corner of the notebook in the {x,y} form.  The graph tracing feature allows one to find approximate solutions to f [x] = 0, by following the graph of f [x] in the vicinity of its x-axis crossing.  After initial location of  x = a  such that  f [a] ≈  0; then one replots f [x]  on the interval  [a - δ, a + δ ], where  δ  is a small number and traces the graph again.  One may repeat those steps several times (the effect is to "zoom in" and a graph will eventually look like a straight line after several zoom-ins) until a desired accuracy is achieved.

MULTIPLE PLOTS.  To plot  f(x), g(x), h(x)  together use  Plot[{f[x], g[x], h[x]}, {x, a, b}];





DISCONTINUITY.   To graph the actual discontinuity of  f(x)  at  x = 1  one must remove the vertical segment
at  x = 1  by building the graph of  f(x)  separately on  [0,1)  and  [1,2] and then combine them together.



Usually one identifies the vertical line segment over the point  x = a  as a point of discontinuity of  the function and
therefore no need for DisplayTogether[ . ] arises.

Converted by Mathematica      March 27, 2001