In science, engineering, and mathematics,
the 4 main types of numbers used in computation
are integers.. rational numbers.. real numbers.. and complex numbers.
In Mathematica and the Wolfram Language
the 4 built-in types of numbers
are integers.. rational numbers.. real numbers.. and complex numbers.
Popular languages like C++, Java, Python, and JavaScript do NOT have these types built in.
However, the Wolfram Language has had these numeric types since 1988
when version 1.0 was released.
An impressive example of the design that has gone into the Wolfram Language.
An integer is just a whole number.
As you type in an integer, a small space is inserted between each block of 3 digits.
This is because some people use commas as separators,
while others use periods.
To avoid any confusion, a space is a nice compromise to use.
If you would prefer to use a comma or a period,
you can set this in the preferences.
If you raise this integer to the 20th power,
you will see that the exact result is given.
Since it requires more than one line to display,
a 3-dot symbol is used
to let you know the output continues on the next line.
Another way to type an exponent is by pressing CTRL + ^ .
When you are done typing the exponent, press the right arrow
and execute the command.
A rational number is a fraction where the numerator and denominator are both integers.
To enter a fraction in a friendly form,
first type the numerator..
then press CTRL + /
and finally enter the denominator.
Press the right arrow to leave fraction-typing mode and evaluate the input.
You can now use this rational number in a computation,
and Mathematica gives the exact output.
Any expression with rational numbers using the standard 4 arithmetic operations
will ALWAYS return another rational number.
It is worth pointing out that an integer is also a rational number,
because any integer can be written as a fraction with denominator 1.
A real number is any number that has zero or more digits after the decimal point.
While you can type as many digits as you need,
the output is typically truncated.
You can see all of the digits by using the function "FullForm".
Scientific notation is the standard way
to write very large - or very small - real numbers.
Because it is used so commonly,
there is a short-hand way to write a number in scientific notation.
Simply leave out the 10,
and write *^.
It should be noted that
integers are a subset of the rational numbers,
and every rational number is also a real number.
If you write a fraction as a decimal,
it will either terminate..
or eventually have a repeating block.
Mathematica has had built in support for complex numbers from day 1.
If you take the square root of -1, you get i.
Notice how the ‘i’ is displayed.
The double stroke lets you know
you are working with the square root of -1, and not the letter ‘i’.
To type in the square root of -1,
hit Escape - i i - Escape.
You can also use a capitol “I” for the square root of -1.
To extract the real part of the complex number z,
just use the “Re” function.
And for the imaginary part, use the “Im” function.
We’ve seen that integers are a subset of the rational numbers,
and the rationals are a subset of the reals.
Well, the real numbers are a subset of the complex numbers.
This is because any real number is just a complex number..
with an imaginary part of 0.
Unlike some other programming languages,
Mathematica and the Wolfram Language do NOT have any size limits built in.
However,
your computer does not have an infinite amount of memory,
so every system will have its own size limit.
To find the maximum number that can be represented on your particular system,
look at the value of “$MaxNumber".
And to find the minimum possible number,
enter “$MinNumber".
If you try to enter a number larger than MaxNumber,
Mathematica will output an Overflow.
And if you enter a number smaller than MinNumber,
Mathematica will return an Underflow.
Learning Mathematica and the Wolfram Language
requires more than YouTube.
You will need sample notebooks,
exercises,
and short example videos.
Socratica is here to help.
We are building a course
to help you become a PRO
with the Wolfram computational platform.
For updates,
please join our Mathematica mailing list
on our website - socratica.com