WolframLang: Arithmetic Basics

By Xah Lee. Date: . Last updated: .

here's the syntax for basic arithmetic.

Addition

(* short syntax *)
3+2 === 5

(* FullForm syntax *)
Plus[3, 2] === 5

Substraction

3-2 === 1

(* FullForm syntax *)
Plus[3,-2] === 1

Multiplication

3 * 2 === 6

(* FullForm syntax *)
Times[3, 2] === 6

Multiplication can also be done with a space between numbers.

3 2 === 6

Division

3/2. == 1.5

(* FullForm syntax *)
Times[3, Power[2., -1]] == 1.5

when integer is divided by another integer, result is an exact fraction.

Power

3^2 === 9

(* FullForm syntax *)
Power[3, 2] === 9

Remainder, modular arithmetic

(* remainder, or modular arithmetic *)
Mod[5, 2] === 1

Testing even/odd

EvenQ[4] === True

OddQ[3] === True

Symbolic Result vs Numerical Result

WolframLang: Force Numerical Result