Skip to main content
Engineering LibreTexts

1.4.2: Entering Large Numbers and Small Numbers

  • Page ID
    97141
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

      It is common in the USA to enter numbers >= 1000 using commas. However, commas are not used that way in MATLAB and Octave. As you will read in the chapter on vectors, commas are used to separate elements of a vector. One way to enter large numbers is to simply leave out the commas, as shown in these examples:

      a = 1000

      b = 54321

      If you enter b with a comma:

      b = 54,321

      the result is is 2 separate numbers:

      b =    54
      ans =   321

      That is not what is intended.

      According to the World Bank, the 2023 population of Brazil is 215,313,498

      (World Bank, Brazil Population)

      In MATLAB or Octave, this can be entered as:

      Brazil_population= 215313498

      Alternatively this can be entered using scientific notation (also called exponent notation):

      Brazil_population= 215.313498E6 % The "E" indicates 

      The speed of light in vacuum can be written (approximately) as

      c = 3.0E8 % m/s 

      The "E" can be either upper or lower case:

      c = 3.0e8 % m/s

      Similar notation can be used for very small numbers. For example the wavelength of a red LED might be 650 nm

      red_wavelength = 650e-6 % meters

       


      This page titled 1.4.2: Entering Large Numbers and Small Numbers is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Carey Smith.