Calculator Operations

Index

This index gives a list of keywords that are associated with various cells in this Notebook. If you Command-Double-click one of the keywords below,  Mathematica  will find the cell associated with that keyword, select it, and display it in the center of  your window.

Abs    
Addition  
ArcCos  
ArcCot  
ArcCsc  
ArcSec  
ArcSin  
ArcTan  
Arg  
Calculation`approximate  
Calculation`arbitrary precision  
Conjugate  
Cos  
Cosh  
Cot  
Coth  
Csc  
Csch  
Degree  
Division  
E  
Exp  
Exponentiation  
Factorial  
I  
Im  
Infinity  
Log  
Multiplication  
N  
Number`complex  
Pi  
Re  
Sec  
Sech  
Sin  
Sinh  
Sqrt  
Subtraction  
Tan  
Tanh

Arithmetic

Syntax (see pages 47 and 193)

x ^y      gives x  to the power y .

-x          gives the arithmetic opposite of x .

x /y       gives x  divided by y .

x y z  or  x *y *z        gives the product of x , y, and z .

x + y + z       gives the sum of x , y,  and z .

Grouping of Operations

Arithmetic operations in Mathematica  are grouped according to the standard mathematical convention. Thus, exponentiation is done first, then division,  multiplication, and lastly, addition and subtraction. If there are nested exponentials, they are evaluated from right to left. Consecutive divisions or subtractions are evaluated from left to right. You can always control grouping by explicitly using parentheses.

Addition and Multiplication

5 + 2 4

(5 + 2) 4

Repeated Subtraction

5 - 4 - 2

5 - ( 4 - 2)

Division and Multiplication

1 / 3 4

1 3 / 4

Repeated Exponentiation

2 ^ 3 ^ 2

(2 ^ 3) ^ 2

Exact, Approximate and Arbitrary-Precision Calculations

Syntax (see pages 48, 51, 534 and 545)

expr  //N    gives an approximate numerical value for expr .

N[expr , n ] gives a numerical value for expr  calculated with n -digit precision.

Exact Integer Arithmetic

2^100

Approximate Numerical Results

Note that the answer is given in scientific notation.

2^100 //N

N[2^100]

Arithmetic with Fractions

The symbol % stands for the last result.

1/3 + 2/7

N[%]

Approximate Arithmetic

Note  that whenever you give a number with an explicit decimal point, Mathematica  produces an approximate numerical result.

452/62

452./62

Arbitrary-Precision Calculation

N[ Pi^2, 50]

Common Mathematical Constants

Syntax (see pages 50 and 566)

Pi  is the ratio of the perimeter of a circle to its diameter. It is approximately equal to 3.14159.

E  is the base of the natural logarithm. It is approximately equal to 2.71828.

Degree  is the degrees-to-radians conversion factor. It is equal to Pi/180.

I  is the square root of minus 1.

Infinity  represents a positive infinite quantity.

Arbitrary-Precision Value of a Constant

Note that mathematical  constants are exact quantities in Mathematica, so you must use N to get an approximate numerical value.

N[E, 50]

Common Mathematical Functions

Syntax ( see pages 49, 550 and 727)

Sqrt[x ]  gives the square root of x .

Exp[x ]  gives the exponential of x .

Log[x ]  gives the natural logarithm of x .

Log[b , x ]  gives the logarithm base b  of x .

Sin[x ], Cos[x ], Tan[x ], Csc[x ], Sec[x ] and Cot[x ]   give the value of the trigonometric functions at x  radians.

ArcSin[x ], ArcCos[x ], ArcTan[x ], ArcCsc[x ], 
ArcSec[x ], and ArcCot[x ]  give the value of the  inverse trigonometric functions at x .

Sinh[x ], Cosh[x ], Tanh[x ], Csch[x ], Sech[x ], and Coth[x ]   give the value of the hyperbolic functions at x .

n !   gives n  factorial.

Abs[x ]   gives the absolute value of x .

Square Root

Sqrt[16]

A Note on Exact and Approximate Results

Mathematica  tries to give exact values for mathematical functions when you give it exact input. Thus, Sqrt[16] gives 4, but Sqrt[2] is returned unevaluated. To get an approximate numerical result, you can use N or include an explicit decimal point.

Exact and Approximate Results

Sqrt[2]

N[ Sqrt[2] ]

Sqrt[2] //N

Sqrt[2.0]

Trigonometric Function with an Exact  Result

Note that the arguments to trigonometric functions are always in radians.

Sin[Pi/3]

N[%]

Trigonometric Function with an Approximate Result

Note the explicit use of the decimal point.

Tan[2.]

Trigonometric Function Using Degrees

Multiplying by the constant Degree converts the argument to radians.

Tan[2 Degree] //N

Inverse Trigonometric Function

ArcCsc[1]

ArcTan[.12]

A Note on Inverse Functions

An inverse function is the solution to an equation. For example, the inverse or arc sine function gives a solution to the equation y  = Sin[x ]. However, there are many such solutions. Thus, in defining an inverse function one must choose a "principal value". For the inverse trigonometric and hyperbolic functions there are standard choices made in mathematics. These same choices are used by Mathematica.  For example, the values of ArcSin are always in the range -Pi/2 to Pi/2.  For information on a specific inverse function, see  its reference guide entry in The Mathematica  Book.

Hyperbolic Functions

Tanh[.12]

ArcCsch[3.2]

Exponential

Exp[2.3]

E^2.3

Natural Logarithm

Recall that the natural log is a logarithm base E.

Log[5.654]

Common Logarithm

Recall that the common log is a logarithm base 10.

Log[10, 100]

Logarithm Base Two

Log[2, 256]

Factorial

10!

Absolute Value

Abs[-2.3]

Abs[2.3]

Complex Numbers

Syntax (see pages 52, 562 and 604)

x  + I y   is a complex number with real part x  and imaginary part y .

Re[z ] gives the real part of z .

Im[z ]  gives the imaginary part of z .

Conjugate[z ] gives the complex conjugate of z .

Abs[z ] gives the absolute value or norm of z .

Arg[z ] gives the argument of z .

Exact Complex Arithmetic

(4 + 3 I) / (2 - I)

Complex Square Root

Sqrt[-4]

Complex Exponential

Exp[ 2.3 + -1.2 I ]

Complex Trigonometric Functions

Sin[ -1.2 + 3.21 I]

A Note on Complex Functions and Branch Cuts

In Mathematica , all trigonometric and hyperbolic functions,
as well as exponentials and logarithms, can take complex arguments and return complex values. Certain of these functions, such as the logarithm and inverse trigonometric functions, essentially give solutions to equations. In almost all cases, there are many possible solutions to the equations. Unique "principal" values nevertheless have to be chosen for the functions. These choices cannot be made continuous over the whole complex plane. Instead, lines of discontinuity, or branch cuts, must occur. Mathematica  makes the standard mathematical choices for these. For the specific choices made, see page 565.