CINXE.COM
More about Numbers: Elementary Introduction to the Wolfram Language
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>More about Numbers: Elementary Introduction to the Wolfram Language</title> <meta name="description" content="Learn how the Wolfram Language works with numbers, fractions, decimals, scientific notation, reals, mathematical functions. Written by Stephen Wolfram."> <!-- gl-head-includes.en.html --> <link rel="icon" href="/favicon.ico" sizes="48x48"> <link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml"> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="manifest" href="/manifest.webmanifest"> <meta prefix="og: http://ogp.me/ns#" property="og:image" content="http://www.wolfram.com/share.png"> <meta prefix="og: http://ogp.me/ns#" property="og:image:secure_url" content="https://www.wolfram.com/share.png"> <meta prefix="og: http://ogp.me/ns#" property="og:image:width" content="1200"> <meta prefix="og: http://ogp.me/ns#" property="og:image:height" content="1200"> <link rel="stylesheet" href="//www.wolframcdn.com/fonts/source-sans-pro/1.0/global.css"> <link rel="stylesheet" href="/common/css/gl-styles.en.css"> <script src="//www.wolframcdn.com/consent/cookie-consent.js"></script> <script src="/common/javascript/wal/latest/walLoad.js"></script> <script defer src="/common/js/announcements/script.js"></script> <script src="/common/js/jquery/3.7.1/jquery.min.js"></script> <script src="/common/js/jquery/plugins/migrate/3.5.2/jquery.migrate.min.js"></script> <script src="/common/javascript/gl-head-scripts.en.js"></script> <script src="/common/javascript/analytics.js"></script> <!--/gl-head-includes.en.html --> <link rel="stylesheet" type="text/css" href="/language/css/global.css" > <link rel="stylesheet" type="text/css" href="css/eiwl.css" > <link rel="stylesheet" type="text/css" href="css/clipboard.css" > <link rel="stylesheet" type="text/css" href="/language/elementary-introduction/2nd-ed/css/chapter-cookie.css.en" > <link rel="stylesheet" type="text/css" href="/language/elementary-introduction/2nd-ed/css/eiwl-check-answer-lightbox.css" > <script type="text/javascript" src="js/eiwl.js"></script> <script type="text/javascript" src="js/eiwl-input-popup.js"></script> <script type="text/javascript" src="js/eiwl-check-answer-lightbox.js"></script> <script type="text/javascript" src="js/clipboard.js.en" ></script> <script type='text/javascript'>baselang='23-more-about-numbers.en';</script> </head> <body id="eiwl" class="eiwl gl-header-always-compact-nofooter"> <!-- gl-header.en.html --> <div id="gl-outer-wrapper" class="gl-en cf"> <header id="_header"> <div id="_header-grid" class="_page-width"> <h1 id="_header-logo"> <a href="https://www.wolfram.com/?source=nav" data-walid="GUIHeader"><svg width="177" height="37"><use href="#_top-logo"></use><title>WOLFRAM</title></svg></a> </h1> <nav id="_nav-center"> <div id="_nav-products" class="_each-link"> <a href="https://www.wolfram.com/products/?source=nav" data-walid="GUIHeader" class="_label"><span>Products</span></a> <div class="_dropdown"> <ul class="_dropdown-menu"> <li><a href="https://www.wolfram.com/wolfram-one/?source=nav" data-walid="GUIHeader">Wolfram|One</a> <li><a href="https://www.wolfram.com/mathematica/?source=nav" data-walid="GUIHeader">Mathematica</a> <li><a href="https://www.wolfram.com/notebook-assistant-llm-kit/?source=nav" data-walid="GUIHeader">Wolfram Notebook Assistant + LLM Kit</a> <li><a href="https://www.wolfram.com/wolfram-alpha-notebook-edition/?source=nav" data-walid="GUIHeader">Wolfram|Alpha Notebook Edition</a> <li><a href="https://www.wolfram.com/system-modeler/?source=nav" data-walid="GUIHeader">System Modeler</a> <li><a href="https://www.wolfram.com/products/?source=nav" data-walid="GUIHeader">All Products</a> </ul> </div> </div> <div id="_nav-consulting" class="_each-link"> <a href="https://www.wolfram.com/solutions/?source=nav" data-walid="GUIHeader" class="_label"><span>Consulting & Solutions</span></a> <div class="_dropdown"> <ul class="_dropdown-menu"> <li><a href="https://www.wolframconsulting.com/?source=nav" data-walid="GUIHeader">Wolfram Consulting</a> <li><a href="https://www.wolfram.com/solutions/?source=nav" data-walid="GUIHeader">Industry Solutions</a> <li><a href="https://www.wolfram.com/education/?source=nav" data-walid="GUIHeader">Solutions for Education</a> </ul> </div> </div> <div id="_nav-learning" class="_each-link"> <a href="https://www.wolfram.com/resources/?source=nav" data-walid="GUIHeader" class="_label"><span>Learning & Support</span></a> <div class="_dropdown"> <ul class="_dropdown-menu"> <li><a href="https://www.wolfram.com/wolfram-u/?source=nav" data-walid="GUIHeader">Wolfram U Courses</a> <li><a href="https://www.wolfram.com/language/?source=nav#learning-resources" data-walid="GUIHeader">Wolfram Language Resources</a> <li><a href="https://community.wolfram.com/?source=nav" data-walid="GUIHeader">Wolfram Community</a> <li><a href="https://support.wolfram.com/?source=nav" data-walid="GUIHeader">Support FAQs</a> <li><a href="https://www.wolfram.com/support/contact/?source=nav" data-walid="GUIHeader">Contact Support</a> </ul> </div> </div> <div id="_nav-company" class="_each-link"> <a href="https://www.wolfram.com/company/?source=nav" data-walid="GUIHeader" class="_label"><span>Company</span></a> <div class="_dropdown"> <ul class="_dropdown-menu"> <li><a href="https://www.wolfram.com/company/?source=nav" data-walid="GUIHeader">About Wolfram</a> <li><a href="https://www.wolfram.com/company/careers/?source=nav" data-walid="GUIHeader">Careers</a> <li><a href="https://events.wolfram.com/?source=nav" data-walid="GUIHeader">Events</a> <li><a href="https://education.wolfram.com/programs/?source=nav" data-walid="GUIHeader">Educational Programs</a> <li><a href="https://www.wolfram.com/resources/?source=nav#mobile-apps" data-walid="GUIHeader">All Sites and Resources</a> </ul> </div> </div> <div id="_nav-alpha" class="_each-link"> <a href="https://www.wolframalpha.com/?source=nav" data-walid="GUIHeader" class="_label" target="_blank"><span>Wolfram|Alpha<svg width="9" height="9"><use href="#_top-wa"></use></svg></span></a> </div> </nav> <nav id="_nav-right"> <div id="_nav-cloud" class="_each-link"> <a href="https://www.wolframcloud.com/?source=nav" data-walid="GUIHeader" class="_label" target="_blank"><span><svg width="32" height="24"><use href="#_top-cloud"></use><title>Wolfram Cloud</title></svg></span></a> </div> <div id="_nav-user" class="_each-link"> <a href="https://account.wolfram.com/login/oauth2/sign-in/?source=nav" data-walid="GUIHeader" class="_label" target="_blank"><span><svg width="22" height="25"><use href="#_top-user"></use><title>Your Account</title></svg></span></a> <div class="_dropdown"> <ul class="_dropdown-menu"> <li><a href="https://account.wolfram.com/?source=nav" data-walid="GUIHeader" target="_blank">Your Account</a> <li><a href="https://user.wolfram.com/?source=nav" data-walid="GUIHeader" target="_blank">User Portal</a> </ul> </div> </div> <div id="_nav-search" class="_each-link"> <a href="https://search.wolfram.com/?source=nav" data-walid="GUIHeader" class="_label" target="_blank"><span><svg width="24" height="24"><use href="#_top-search"></use><title>Search</title></svg></span></a> <div class="_dropdown"> <form id="_search-form" action="//search.wolfram.com/" method="get" accept-charset="utf-8" class="no-bfc _page-width"> <div id="_search-wrapper"> <label for="_search-input"><svg width="24" height="24"><use href="#_search-magnifier"></use></svg></label> <button type="button" class="close"><svg width="14" height="14"><use href="#_search-x"></use><title>Close</title></svg></button> <span><input type="search" name="query" placeholder="Search across Wolfram sites" autocomplete="off" id="_search-input"></span> <input type="hidden" name="source" value="GUIHeader" class="cf"> </div> </form> </div> </div> </nav> </div> </header> <noscript id="_noscript" class="remove__ready"> <div> <div><svg class="_noscript-warning"><use href="#_noscript-warning"></use></svg></div> <div>Enable JavaScript to interact with content and submit forms on Wolfram websites. <a href="http://www.enable-javascript.com/" target="_blank" data-walid="GUIFooter" class="chevron-after">Learn how</a></div> </div> </noscript> <div style="height: 0; width: 0; position: absolute; visibility: hidden; top: -999999999999px;"> <svg xmlns="http://www.w3.org/2000/svg"> <g id="_top-icons"> <symbol id="_top-logo" viewBox="0 0 183 38.92"> <g> <path fill="#fff" d="M42.62,9.63h4.87l2.25,12.52,3.33-12.52h4.23l3.96,12.79,2.34-12.79h4.6l-3.96,18.83h-5.32l-3.51-11.71-3.6,11.71h-5.59l-3.6-18.83Z"/> <path fill="#fff" d="M183,28.46h-4.87l-2.25-12.61-3.33,12.61h-4.23l-3.96-12.79-2.34,12.79h-4.6l3.96-18.83h5.32l3.51,11.71,3.6-11.71h5.59l3.6,18.83Z"/> <path fill="#fff" d="M78.39,9.27c6.13,0,9.28,3.69,9.28,9.73s-3.24,9.73-9.28,9.73-9.28-3.78-9.28-9.73c0-6.04,3.15-9.73,9.28-9.73Zm0,15.77c2.97,0,4.23-2.88,4.23-6.04s-1.17-6.04-4.23-6.04-4.23,2.7-4.23,6.04c.09,3.15,1.26,6.04,4.23,6.04Z"/> <path fill="#fff" d="M90.46,9.63h4.96v15.04h7.66v3.69h-12.61V9.63Z"/> <path fill="#fff" d="M105.15,9.63h12.43v3.51h-7.48v4.14h7.12v3.51h-7.12v7.57h-4.96s0-18.74,0-18.74Z"/> <path fill="#fff" d="M120.2,9.63h8.83c3.33,0,5.95,1.53,5.95,4.77,0,2.52-1.17,4.14-3.6,4.77h0c1.62,.45,1.71,1.89,2.61,4.14l1.8,5.14h-5.14l-1.08-3.42c-.99-3.24-1.62-4.05-3.51-4.05h-1.08v7.39h-4.96V9.63h.18Zm4.87,7.84h1.26c1.62,0,3.6-.09,3.6-2.16,0-1.71-1.71-2.07-3.6-2.07h-1.26v4.23Z"/> <path fill="#fff" d="M143.35,9.63h6.04l7.12,18.83h-5.41l-1.35-4.05h-6.94l-1.44,4.05h-5.05l7.03-18.83Zm3.06,3.87h0l-2.43,7.39h4.69l-2.25-7.39Z"/> </g> <path fill="#d10" d="M31.81,19.46l5.41-6.04-7.93-1.71,.81-8.02-7.39,3.24L18.65,0l-4.05,6.94L7.12,3.69l.81,8.02L0,13.42l5.41,6.04L0,25.5l7.93,1.71-.81,8.02,7.39-3.24,4.05,6.94,4.05-6.94,7.39,3.24-.81-8.02,7.93-1.71-5.32-6.04Zm1.35,3.87l-3.51-1.17-2.43-3.15,3.15,1.17,2.79,3.15Zm-11.53,7.48l-2.25,3.78v-3.96l2.34-3.33-.09,3.51Zm-5.23-19.73l-3.78-1.35-2.16-2.97,3.96,1.71,1.98,2.61Zm6.49-2.52l3.96-1.71-2.16,2.97-3.78,1.35,1.98-2.61Zm4.78,3.51l-1.89,2.7,.09-4.14,2.25-3.06-.45,4.5Zm-9.01,17.03l-2.97-4.32,2.97-4.05,2.97,4.05-2.97,4.32Zm-5.59-12.34l-.18-5.23,4.96,1.8v5.14l-4.78-1.71Zm6.31-3.51l4.96-1.8-.18,5.32-4.78,1.62v-5.14Zm-9.82-1.17l-.45-4.41,2.25,3.06,.09,4.14-1.89-2.79Zm7.84,7.75l-2.97,4.05-5.05-1.53,3.24-4.14,4.78,1.62Zm-1.89,7.48l2.34,3.33v3.96l-2.25-3.78-.09-3.51Zm4.32-7.48l4.78-1.62,3.24,4.14-5.05,1.53-2.97-4.05Zm14.42-5.41l-3.69,4.14-4.42-1.62,2.61-3.78,5.5,1.26Zm-12.79-6.58l-2.79,3.6-2.79-3.6,2.79-4.86,2.79,4.86ZM2.97,14.32l5.5-1.17,2.61,3.78-4.42,1.62-3.69-4.23Zm3.96,5.77l3.15-1.17-2.52,3.24-3.6,1.26,2.97-3.33Zm-2.61,4.77l3.69-1.26,3.96,1.17-3.24,.99-4.42-.9Zm5.14,2.34l4.51-1.44,.09,4.77-5.14,2.25,.54-5.59Zm13.7,3.33l.09-4.77,4.51,1.44,.54,5.59-5.14-2.25Zm5.32-4.68l-3.33-1.08,3.96-1.17,3.69,1.26-4.32,.99Z"/> </symbol> <symbol id="_top-wa" viewBox="0 0 9 9"> <path fill="currentColor" d="M2.91,0c-.34,0-.56,.23-.56,.56,0,.39,.22,.62,.56,.62H6.99L.17,7.99c-.22,.23-.22,.56,0,.79,.28,.28,.61,.28,.84,.06L7.83,2.03V6.14c0,.34,.22,.56,.56,.56,.39,0,.61-.23,.61-.56V0H2.91Z"/> </symbol> <symbol id="_top-cloud" viewBox="0 0 31 24"> <path fill="currentColor" d="M16.26,24c-1.19,0-2.38-.33-3.58-1.09-.43-.33-.87-.76-1.19-1.09-.11,0-.33,.11-.43,.11-3.36,.44-6.18-1.09-6.61-3.71v-.44c-2.71-.98-4.44-3.38-4.44-6.11,0-3.6,3.03-6.33,6.83-6.66,.22-1.64,1.08-2.84,2.28-3.71C10.51,.21,12.47-.33,14.42,.21c1.08,.22,2.06,.65,3.03,1.2,1.41-.44,3.03-.44,4.66,0,1.84,.76,3.25,2.18,4.12,4.15,2.71,.33,4.77,2.4,4.77,5.13,0,1.2-.43,2.4-1.3,3.27,.43,.98,.76,1.96,.43,3.06-.65,2.95-4.23,4.69-8.13,3.82h-.22c-.98,1.64-2.38,2.62-4.12,2.95-.43,.11-.98,.22-1.41,.22Zm-3.9-4.47l.33,.44c.33,.44,.76,.87,1.19,1.2,.98,.76,2.17,.98,3.36,.76,1.3-.22,2.6-1.2,3.25-2.62l.33-.65,.76,.11c.22,.11,.43,.11,.76,.22,2.82,.65,5.64-.44,5.96-2.29,.22-.87-.22-1.75-.65-2.18l-.43-.76,.65-.44c.76-.65,1.19-1.64,1.19-2.4,0-1.85-1.63-3.27-3.58-3.27h-.76l-.11-.55c-.43-2.07-1.73-3.27-3.25-3.93-1.19-.44-2.6-.33-3.79,.11l-.43,.22-.43-.33c-.76-.65-1.73-1.09-2.71-1.2-1.41-.22-2.93,0-4.01,.87-.87,.76-1.41,1.85-1.63,3.16l-.11,.87h-1.19c-2.93,0-5.31,2.07-5.31,4.8,0,2.07,1.63,4.04,3.9,4.47l.87,.22-.22,.87c-.11,.22-.11,.44,0,.65,.22,1.42,2.28,2.4,4.44,2.07,.33,0,.65-.11,.87-.22l.76-.22Z"/> <path fill="currentColor" d="M15.61,19.92l-1.75-3-3.08,1.34,.31-3.41-3.39-.72,2.26-2.59-2.26-2.48,3.39-.72-.31-3.41,3.08,1.34,1.75-3,1.75,3,3.08-1.34-.31,3.41,3.39,.72-2.26,2.59,2.26,2.59-3.39,.72,.31,3.41-3.08-1.34-1.75,2.9Zm.41-3.72v.93l.62-.93v-.83l-.62,.83Zm-1.54-.1l.62,.93v-.83l-.62-.83v.72Zm3.08-.21l1.75,.72-.21-1.86-1.54-.41v1.55Zm-5.55-1.14l-.21,1.86,1.75-.72v-1.66l-1.54,.52Zm2.47-1.03l.92,1.45,.92-1.34-.92-1.45-.92,1.34Zm4.32,0l.72,.21,1.13-.21-.82-.31-1.03,.31Zm-8.32,0l1.13,.21,.72-.21-1.03-.31-.82,.31Zm5.86-1.97l.92,1.34,1.64-.41-1.03-1.34-1.54,.41Zm-4.21,.83l1.64,.41,.92-1.34-1.64-.62-.92,1.55Zm7.91-.1l.72,.21-.72-.83-.72-.21,.72,.83Zm-9.04-.52l-.72,.72,.82-.21,.62-.72-.72,.21Zm7.91-1.55l1.54,.62,1.23-1.34-1.95-.31-.82,1.03Zm-9.35-.83l1.23,1.34,1.54-.62-.92-1.14-1.85,.41Zm6.47-.52v1.76l1.64-.62v-1.66l-1.64,.52Zm-2.57,1.24l1.64,.62v-1.86l-1.64-.62v1.86Zm-1.34-1.86l.41,.52v-1.03l-.41-.72v1.24Zm6.58-.41v1.03l.41-.62,.1-1.14-.51,.72Zm-4.01-1.24l.92,1.14,.82-1.14-.92-1.66-.82,1.66Zm-1.44,.72l.92,.31-.31-.41-.92-.52,.31,.62Zm4.11-.31l-.31,.41,.92-.31,.51-.52-1.13,.41Z"/> </symbol> <symbol id="_top-user" viewBox="0 0 21 24"> <path fill="currentColor" d="M17.77,14.77c-.58-.23-1.17-.58-1.87-.69-.93-.35-1.4-.46-1.4-.69,.12-.58,.47-1.27,.7-1.73,.82-1.38,1.28-2.88,1.4-4.5,0-1.96-.7-3.81-1.98-5.31C13.57,.7,12.05,.01,10.42,.01c-1.87-.12-3.62,.69-4.79,2.08s-1.75,3.23-1.52,4.96c.12,1.73,.82,3.46,1.75,4.84,.35,.35,.47,.92,.58,1.38,0,.23-.35,.35-1.4,.69l-1.75,.69C1.08,15.81,.38,18.46,.03,20.42c-.12,.92,.12,1.85,.82,2.54,.58,.69,1.52,1.04,2.33,1.04h14.59c.93,0,1.87-.46,2.45-1.15s.93-1.61,.7-2.65c-.35-2.65-1.4-4.61-3.15-5.42Zm.82,6.69c-.12,.23-.35,.35-.58,.35H3.3c-.23,0-.47-.12-.58-.35-.23-.23-.23-.46-.23-.81,.12-1.27,.7-3.34,1.98-4.04,.47-.23,.93-.46,1.52-.58,1.28-.46,2.92-1.04,2.92-3v-.12c-.12-.81-.47-1.73-.93-2.42-.82-1.15-1.28-2.54-1.4-4.04-.12-1.15,.23-2.31,.93-3.11,.82-.92,1.98-1.27,3.15-1.27,.93,0,1.75,.46,2.33,1.15,.82,.92,1.4,2.19,1.4,3.46-.12,1.27-.47,2.54-1.17,3.69-.47,.81-.82,1.61-1.05,2.54v.23c0,1.96,1.75,2.54,3.04,3,.47,.12,1.05,.35,1.52,.58,1.4,.69,1.87,2.77,2.1,3.92,0,.35-.12,.69-.23,.81Z"/> </symbol> <symbol id="_top-search" viewBox="0 0 24 24"> <path fill="currentColor" d="M23.66,21.85l-6.46-6.45c3.23-4.18,2.51-10.15-1.67-13.49C11.34-1.19,5.24-.47,2.01,3.71S-.5,13.85,3.69,17.2c3.47,2.63,8.25,2.63,11.72,0l6.46,6.45c.48,.48,1.2,.48,1.67,0,.6-.6,.6-1.31,.12-1.79ZM2.49,9.56c0-3.94,3.23-7.16,7.17-7.16s7.17,3.22,7.17,7.16-3.23,7.16-7.17,7.16-7.17-3.1-7.17-7.16Z"/> </symbol> </g> <g id="_search-icons"> <symbol id="_search-magnifier" viewBox="0 0 24 24"> <path fill="#b5b5b5" d="M23.66,21.85l-6.46-6.45c3.23-4.18,2.51-10.15-1.67-13.49C11.34-1.19,5.24-.47,2.01,3.71S-.5,13.85,3.69,17.2c3.47,2.63,8.25,2.63,11.72,0l6.46,6.45c.48,.48,1.2,.48,1.67,0,.6-.6,.6-1.31,.12-1.79ZM2.49,9.56c0-3.94,3.23-7.16,7.17-7.16s7.17,3.22,7.17,7.16-3.23,7.16-7.17,7.16-7.17-3.1-7.17-7.16Z"/> </symbol> <symbol id="_search-x" viewBox="0 0 14 14"> <path fill="#5e5e5e" d="M1.9,13.9l-1.4-1.5L5.6,7L0.5,1.7l1.4-1.5L7,5.5l5.1-5.4l1.4,1.5L8.4,7l5.1,5.4l-1.4,1.5L7,8.5L1.9,13.9z"/> </symbol> </g> <g id="_noscript-icons"> <symbol id="_noscript-warning" viewBox="0 0 28.21 25"> <path d="M27.91,21.7L16.01,1.1c-.84-1.47-2.96-1.47-3.81,0L.3,21.7c-.85,1.47,.21,3.3,1.9,3.3H26c1.69,0,2.75-1.83,1.91-3.3ZM15.75,7.44l-.46,9.42h-2.37l-.48-9.42h3.31Zm-1.65,14.25c-1.12,0-1.87-.81-1.87-1.89s.77-1.89,1.87-1.89,1.83,.79,1.85,1.89c0,1.08-.73,1.89-1.85,1.89Z" fill="#f47821"/> <polygon points="15.77 7.47 15.31 16.89 12.94 16.89 12.46 7.47 15.77 7.47" fill="#fff"/> <path d="M14.1,21.69c-1.12,0-1.87-.81-1.87-1.89s.77-1.89,1.87-1.89,1.83,.79,1.85,1.89c0,1.08-.73,1.89-1.85,1.89Z" fill="#fff"/> </symbol> </g> </svg> </div> <div id="gl-inner-wrapper"> <!--/gl-header.en.html --> <header> <div class="latest-edition-header"> <div class="latest-edition-text">Explore the latest version of <em>An Elementary Introduction to the Wolfram Language</em> »</div> </div> <div class="header-inner"> <div class="eiwl-header-title"><a href="/language/elementary-introduction/2nd-ed/" id="nav-header-link" class="nav-header-link"><div class="author-name">Stephen Wolfram</div>An Elementary Introduction to the Wolfram Language<div class="edition-text">Second Edition (2017)</div></a> </div> <span class="prevnext"><a href="22-machine-learning.html" id="EIWL-WEB-2nd-ed-prev-section-header-23-more-about-numbers" class="km-track-click-no-url"><span><img src="/language/elementary-introduction/2nd-ed/img/top-previous-arrow.png" width="12" height="20" alt=""></span></a><a href="24-more-forms-of-visualization.html" id="EIWL-WEB-2nd-ed-next-section-header-23-more-about-numbers" class="km-track-click-no-url"><span><img src="/language/elementary-introduction/2nd-ed/img/top-next-arrow.png" width="13" height="21" alt=""></span></a></span> </div> </header> <div class="sidebarwrapper"> <div class="sidebarHamburger" id="sidebarHamburger"> <a href="#" id="showSidebar"><img src="/language/elementary-introduction/2nd-ed/img/hamburger.png" width="45" height="28" /></a> </div> <div class="sidebar" id="sidebar"> <div class="sidebar-close-button"> <a href="#" id="hide-sidebar-button"><img src="/language/elementary-introduction/2nd-ed/img/x-icon.png" width="13" height="13" /></a> </div> <nav id="nav" class="pageNav"><ul> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/preface.html" id="EIWL-WEB-sidebar-preface">Preface</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/what-is-the-wolfram-language.html" id="EIWL-WEB-sidebar-what-is-the-wolfram-language">What Is the Wolfram Language?</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/practicalities-of-using-the-wolfram-language.html" id="EIWL-WEB-sidebar-practicalities-of-using-the-wolfram-language">Practicalities of Using the Wolfram Language</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/other-resources.html" id="EIWL-WEB-sidebar-other-resources">Other Resources</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/01-starting-out-elementary-arithmetic.html" id="EIWL-WEB-sidebar-01-starting-out-elementary-arithmetic"><span class="tocSectionNumber">1</span>Starting Out: Elementary Arithmetic</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/02-introducing-functions.html" id="EIWL-WEB-sidebar-02-introducing-functions"><span class="tocSectionNumber">2</span>Introducing Functions</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/03-first-look-at-lists.html" id="EIWL-WEB-sidebar-03-first-look-at-lists"><span class="tocSectionNumber">3</span>First Look at Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/04-displaying-lists.html" id="EIWL-WEB-sidebar-04-displaying-lists"><span class="tocSectionNumber">4</span>Displaying Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/05-operations-on-lists.html" id="EIWL-WEB-sidebar-05-operations-on-lists"><span class="tocSectionNumber">5</span>Operations on Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/06-making-tables.html" id="EIWL-WEB-sidebar-06-making-tables"><span class="tocSectionNumber">6</span>Making Tables</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/07-colors-and-styles.html" id="EIWL-WEB-sidebar-07-colors-and-styles"><span class="tocSectionNumber">7</span>Colors and Styles</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/08-basic-graphics-objects.html" id="EIWL-WEB-sidebar-08-basic-graphics-objects"><span class="tocSectionNumber">8</span>Basic Graphics Objects</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/09-interactive-manipulation.html" id="EIWL-WEB-sidebar-09-interactive-manipulation"><span class="tocSectionNumber">9</span>Interactive Manipulation</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/10-images.html" id="EIWL-WEB-sidebar-10-images"><span class="tocSectionNumber">10</span>Images</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/11-strings-and-text.html" id="EIWL-WEB-sidebar-11-strings-and-text"><span class="tocSectionNumber">11</span>Strings and Text</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/12-sound.html" id="EIWL-WEB-sidebar-12-sound"><span class="tocSectionNumber">12</span>Sound</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/13-arrays-or-lists-of-lists.html" id="EIWL-WEB-sidebar-13-arrays-or-lists-of-lists"><span class="tocSectionNumber">13</span>Arrays, or Lists of Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/14-coordinates-and-graphics.html" id="EIWL-WEB-sidebar-14-coordinates-and-graphics"><span class="tocSectionNumber">14</span>Coordinates and Graphics</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/15-the-scope-of-the-wolfram-language.html" id="EIWL-WEB-sidebar-15-the-scope-of-the-wolfram-language"><span class="tocSectionNumber">15</span>Scope of the Wolfram Language</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/16-real-world-data.html" id="EIWL-WEB-sidebar-16-real-world-data"><span class="tocSectionNumber">16</span>Real‐World Data</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/17-units.html" id="EIWL-WEB-sidebar-17-units"><span class="tocSectionNumber">17</span>Units</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/18-geocomputation.html" id="EIWL-WEB-sidebar-18-geocomputation"><span class="tocSectionNumber">18</span>Geocomputation</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/19-dates-and-times.html" id="EIWL-WEB-sidebar-19-dates-and-times"><span class="tocSectionNumber">19</span>Dates and Times</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/20-options.html" id="EIWL-WEB-sidebar-20-options"><span class="tocSectionNumber">20</span>Options</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/21-graphs-and-networks.html" id="EIWL-WEB-sidebar-21-graphs-and-networks"><span class="tocSectionNumber">21</span>Graphs and Networks</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/22-machine-learning.html" id="EIWL-WEB-sidebar-22-machine-learning"><span class="tocSectionNumber">22</span>Machine Learning</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/23-more-about-numbers.html" id="EIWL-WEB-sidebar-23-more-about-numbers"><span class="tocSectionNumber">23</span>More about Numbers</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/24-more-forms-of-visualization.html" id="EIWL-WEB-sidebar-24-more-forms-of-visualization"><span class="tocSectionNumber">24</span>More Forms of Visualization</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/25-ways-to-apply-functions.html" id="EIWL-WEB-sidebar-25-ways-to-apply-functions"><span class="tocSectionNumber">25</span>Ways to Apply Functions</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/26-pure-anonymous-functions.html" id="EIWL-WEB-sidebar-26-pure-anonymous-functions"><span class="tocSectionNumber">26</span>Pure Anonymous Functions</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/27-applying-functions-repeatedly.html" id="EIWL-WEB-sidebar-27-applying-functions-repeatedly"><span class="tocSectionNumber">27</span>Applying Functions Repeatedly</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/28-tests-and-conditionals.html" id="EIWL-WEB-sidebar-28-tests-and-conditionals"><span class="tocSectionNumber">28</span>Tests and Conditionals</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/29-more-about-pure-functions.html" id="EIWL-WEB-sidebar-29-more-about-pure-functions"><span class="tocSectionNumber">29</span>More about Pure Functions</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/30-rearranging-lists.html" id="EIWL-WEB-sidebar-30-rearranging-lists"><span class="tocSectionNumber">30</span>Rearranging Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/31-parts-of-lists.html" id="EIWL-WEB-sidebar-31-parts-of-lists"><span class="tocSectionNumber">31</span>Parts of Lists</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/32-patterns.html" id="EIWL-WEB-sidebar-32-patterns"><span class="tocSectionNumber">32</span>Patterns</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/33-expressions-and-their-structure.html" id="EIWL-WEB-sidebar-33-expressions-and-their-structure"><span class="tocSectionNumber">33</span>Expressions and Their Structure</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/34-associations.html" id="EIWL-WEB-sidebar-34-associations"><span class="tocSectionNumber">34</span>Associations</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/35-natural-language-understanding.html" id="EIWL-WEB-sidebar-35-natural-language-understanding"><span class="tocSectionNumber">35</span>Natural Language Understanding</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/36-creating-websites-and-apps.html" id="EIWL-WEB-sidebar-36-creating-websites-and-apps"><span class="tocSectionNumber">36</span>Creating Websites and Apps</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/37-layout-and-display.html" id="EIWL-WEB-sidebar-37-layout-and-display"><span class="tocSectionNumber">37</span>Layout and Display</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/38-assigning-names-to-things.html" id="EIWL-WEB-sidebar-38-assigning-names-to-things"><span class="tocSectionNumber">38</span>Assigning Names to Things</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/39-immediate-and-delayed-values.html" id="EIWL-WEB-sidebar-39-immediate-and-delayed-values"><span class="tocSectionNumber">39</span>Immediate and Delayed Values</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/40-defining-your-own-functions.html" id="EIWL-WEB-sidebar-40-defining-your-own-functions"><span class="tocSectionNumber">40</span>Defining Your Own Functions</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/41-more-about-patterns.html" id="EIWL-WEB-sidebar-41-more-about-patterns"><span class="tocSectionNumber">41</span>More about Patterns</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/42-string-patterns-and-templates.html" id="EIWL-WEB-sidebar-42-string-patterns-and-templates"><span class="tocSectionNumber">42</span>String Patterns and Templates </a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/43-storing-things.html" id="EIWL-WEB-sidebar-43-storing-things"><span class="tocSectionNumber">43</span>Storing Things</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/44-importing-and-exporting.html" id="EIWL-WEB-sidebar-44-importing-and-exporting"><span class="tocSectionNumber">44</span>Importing and Exporting</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/45-datasets.html" id="EIWL-WEB-sidebar-45-datasets"><span class="tocSectionNumber">45</span>Datasets</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/46-writing-good-code.html" id="EIWL-WEB-sidebar-46-writing-good-code"><span class="tocSectionNumber">46</span>Writing Good Code</a> </li> <li> <a class="km-track-click-no-url tocChapterLink" href="/language/elementary-introduction/2nd-ed/47-debugging-your-code.html" id="EIWL-WEB-sidebar-47-debugging-your-code"><span class="tocSectionNumber">47</span>Debugging Your Code</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/what-we-havent-discussed.html" id="EIWL-WEB-sidebar-what-we-havent-discussed">What We Haven’t Discussed</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/being-a-programmer.html" id="EIWL-WEB-sidebar-being-a-programmer">Afterword: Being a Programmer</a> </li> <li> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/answers-to-exercises.html" id="EIWL-WEB-sidebar-answers-to-exercises">Answers to Exercises</a> </li> <li id="book-index"> <a class="km-track-click-no-url tocFrontmatterLink" href="/language/elementary-introduction/2nd-ed/book-index.html" id="EIWL-WEB-sidebar-book-index">Index</a> </li> <li class="goToPageClass"> <form action="javascript:pageURL();" autocomplete="off"><span class="goToPageText">Jump to Book Page:</span><input id="goToPageInput" type="text" size="6" onkeypress="handle(event)" /></form> </li> </ul></nav> </div> </div> <section> <div class="section-inner"> <div class="wrapper mainOuter"> <div class="mainContent"> <div> <a id="p-129" /> <table class="SectionTitleTable"> <tr><td id="SectionNumber"><span class="SectionNumber">23</span></td><td id="Section"><span class="Section">More about Numbers</span></td></tr> </table> <div class="bodytext"><a id="i-1" />When you do a computation with whole numbers, the Wolfram Language gives you an exact answer. It does the same with exact fractions.</div> <div class="CodeCaption">Adding 1/2+1/3 gives an exact answer as a fraction:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[1]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_1-i.png.en" height="20" width="60" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_1-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_1_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[1]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-1-o.png.en" width="12" height="35" id="23-more-about-numbers-io-1-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="N" /><a id="i-2" />Often you<span class="special-character CloseCurlyQuote">’</span>ll just want a numerical or decimal approximation. You can get that using the function <a href="http://reference.wolfram.com/language/ref/N.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a> (for <span class="special-character OpenCurlyDoubleQuote">“</span>numerical<span class="special-character CloseCurlyDoubleQuote">”</span>).</div> <div class="CodeCaption">Get an approximate numerical answer:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[2]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_2-i.png.en" height="20" width="79" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_2-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_2_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[2]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-2-o.png.en" width="56" height="19" id="23-more-about-numbers-io-2-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext">If there<span class="special-character CloseCurlyQuote">’</span>s any decimal number in your input, the Wolfram Language will automatically give you an approximate answer.</div> <div class="CodeCaption">The presence of a decimal number makes the result be approximate:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[3]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_3-i.png.en" height="20" width="72" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_3-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_3_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[3]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-3-o.png.en" width="49" height="19" id="23-more-about-numbers-io-3-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption"><a id="i-3" />It<span class="special-character CloseCurlyQuote">’</span>s enough just to have a decimal point at the end of a number:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[4]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_4-i.png.en" height="20" width="64" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_4-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_4_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[4]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-4-o.png.en" width="56" height="19" id="23-more-about-numbers-io-4-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-4" />The Wolfram Language can handle numbers of any size, at least so long as they fit in your computer<span class="special-character CloseCurlyQuote">’</span>s memory. </div> <div class="CodeCaption">Here<span class="special-character CloseCurlyQuote">’</span>s 2 raised to the power 1000:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[5]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_5-i.png.en" height="20" width="49" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_5-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_5_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[5]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-5-o.png.en" width="583" height="116" id="23-more-about-numbers-io-5-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">Get a numerical approximation:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[6]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_6-i.png.en" height="20" width="68" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_6-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_6_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[6]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-6-o.png.en" width="92" height="19" id="23-more-about-numbers-io-6-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="p-130" /><a id="i-5" />This approximate form is given in <em>scientific notation</em>. If you need to enter scientific notation, you can do it with *^.</div> <div class="CodeCaption">Enter a number in scientific notation:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[7]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_7-i.png.en" height="20" width="43" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_7-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_7_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[7]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-7-o.png.en" width="52" height="19" id="23-more-about-numbers-io-7-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-6" />Commonly used numbers like <span class="special-character Pi">π</span> (pi) are built into the Wolfram Language.</div> <div class="CodeCaption">Get a numerical approximation to <span class="special-character Pi">π</span>:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[8]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_8-i.png.en" height="20" width="33" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_8-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_8_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[8]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-8-o.png.en" width="49" height="19" id="23-more-about-numbers-io-8-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-7" />The Wolfram Language can compute to <em>arbitrary precision</em>, so for example it can find millions of digits of <span class="special-character Pi">π</span> if you want them.</div> <div class="CodeCaption">Compute 250 digits of <span class="special-character Pi">π</span>: </div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[9]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_9-i.png.en" height="20" width="63" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_9-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_9_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[9]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-9-o.png.en" width="589" height="92" id="23-more-about-numbers-io-9-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-8" />There are many functions in the Wolfram Language that handle <em>integers</em> (whole numbers). There are also many functions that handle <em>real numbers</em><span class="special-character LongDash">—</span>approximate numbers with decimals. An example is <a href="http://reference.wolfram.com/language/ref/RandomReal.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RandomReal</a>, which gives random real numbers.</div> <div class="CodeCaption">Generate a random real number in the range 0 to 10:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[10]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_10-i.png.en" height="20" width="108" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_10-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_10_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[10]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-10-o.png.en" width="49" height="19" id="23-more-about-numbers-io-10-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">Generate 5 random real numbers:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[11]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_11-i.png.en" height="20" width="168" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_11-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_11_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[11]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-11-o.png.en" width="280" height="19" id="23-more-about-numbers-io-11-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">An alternative way to ask for 5 random real numbers:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[12]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_12-i.png.en" height="20" width="123" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_12-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_12_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[12]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-12-o.png.en" width="280" height="19" id="23-more-about-numbers-io-12-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption"><a id="p-131" /><a id="i-9" />Random real numbers in the range 20 to 30:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[13]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_13-i.png.en" height="20" width="157" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_13-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_13_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[13]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-13-o.png.en" width="272" height="19" id="23-more-about-numbers-io-13-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext">The Wolfram Language has a huge range of mathematical functions built in, from basic to very sophisticated. </div> <div class="CodeCaption"><a id="i-10" />Find the 100th prime number:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[14]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_14-i.png.en" height="20" width="71" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_14-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_14_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[14]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-14-o.png.en" width="23" height="19" id="23-more-about-numbers-io-14-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">Find the millionth prime number:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[15]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_15-i.png.en" height="20" width="106" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_15-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_15_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[15]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-15-o.png.en" width="64" height="19" id="23-more-about-numbers-io-15-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">Plot the first 50 primes:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[16]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_16-i.png.en" height="20" width="211" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_16-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_16_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[16]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-16-o.png.en" width="205" height="130" id="23-more-about-numbers-io-16-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-11" />Three functions common in many practical situations are <a href="http://reference.wolfram.com/language/ref/Sqrt.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Sqrt</a> (square root), <a href="http://reference.wolfram.com/language/ref/Log10.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Log10</a> (logarithm to base 10) and <a href="http://reference.wolfram.com/language/ref/Log.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Log</a> (natural logarithm).</div> <div class="CodeCaption">The square root of 16 is 4:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[17]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_17-i.png.en" height="20" width="53" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_17-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_17_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[17]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-17-o.png.en" width="8" height="19" id="23-more-about-numbers-io-17-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption">If you don<span class="special-character CloseCurlyQuote">’</span>t ask for a numerical approximation, you<span class="special-character CloseCurlyQuote">’</span>ll get an exact formula:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[18]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_18-i.png.en" height="20" width="60" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_18-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_18_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[18]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-18-o.png.en" width="41" height="20" id="23-more-about-numbers-io-18-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption"><a href="http://reference.wolfram.com/language/ref/N.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a> gives a numerical approximation:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[19]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_19-i.png.en" height="20" width="79" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_19-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_19_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[19]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-19-o.png.en" width="49" height="19" id="23-more-about-numbers-io-19-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="p-132" /><a id="i-12" />Logarithms are often useful when you<span class="special-character CloseCurlyQuote">’</span>re dealing with numbers that have a wide range of sizes. Let<span class="special-character CloseCurlyQuote">’</span>s plot the masses of the planets. With <a href="http://reference.wolfram.com/language/ref/ListPlot.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ListPlot</a> one can<span class="special-character CloseCurlyQuote">’</span>t tell anything about the planets before Jupiter. But <a href="http://reference.wolfram.com/language/ref/ListLogPlot.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ListLogPlot</a> shows the relative sizes much more clearly.</div> <div class="CodeCaption">Make an ordinary <a href="http://reference.wolfram.com/language/ref/ListPlot.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ListPlot</a> of the masses of the planets:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[20]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_20-i.png.en" height="26" width="256" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_20-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_20_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[20]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-20-o.png.en" width="194" height="112" id="23-more-about-numbers-io-20-o" alt="" /> </div></td></tr> </table> </div> <div class="CodeCaption"><a id="i-13" />Make a log plot:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[21]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_21-i.png.en" height="26" width="279" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_21-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_21_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[21]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-21-o.png.en" width="195" height="123" id="23-more-about-numbers-io-21-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-14" />There are a few more functions that show up frequently in general programming. First, there<span class="special-character CloseCurlyQuote">’</span>s the almost trivial function <a href="http://reference.wolfram.com/language/ref/Abs.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Abs</a>, that finds the absolute value, or positive part, of a number.</div> <div class="CodeCaption"><a href="http://reference.wolfram.com/language/ref/Abs.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Abs</a> effectively just drops minus signs:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[22]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_22-i.png.en" height="20" width="108" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_22-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_22_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[22]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-22-o.png.en" width="31" height="19" id="23-more-about-numbers-io-22-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="i-15" />Next there<span class="special-character CloseCurlyQuote">’</span>s <a href="http://reference.wolfram.com/language/ref/Round.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Round</a>, which rounds to the nearest whole number.</div> <div class="CodeCaption"><a href="http://reference.wolfram.com/language/ref/Round.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Round</a> rounds to the nearest whole number:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[23]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_23-i.png.en" height="20" width="318" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_23-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_23_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[23]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-23-o.png.en" width="60" height="19" id="23-more-about-numbers-io-23-o" alt="" /> </div></td></tr> </table> </div> <div class="bodytext"><a id="p-133" /><a id="i-16" />Another function that<span class="special-character CloseCurlyQuote">’</span>s very useful is <a href="http://reference.wolfram.com/language/ref/Mod.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>. Let<span class="special-character CloseCurlyQuote">’</span>s say you<span class="special-character CloseCurlyQuote">’</span>re counting up minutes in an hour. When you reach 60, you<span class="special-character CloseCurlyQuote">’</span>ll want to start again from 0. That<span class="special-character CloseCurlyQuote">’</span>s what <a href="http://reference.wolfram.com/language/ref/Mod.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a> lets you do. </div> <div class="CodeCaption">Compute a sequence of numbers mod 60:</div> <div class="IO"> <table class="InCell"> <tr><td class="lab">In[24]:=</td><td class="Input"><div class="copyable-input"> <img src="Files/23-more-about-numbers-io_24-i.png.en" height="20" width="419" alt="Click for copyable input" id="EIWL-WEB-2nd-ed-show-copy-input-io_24-23-more-about-numbers" class="km-track-click-no-url" /> </div><div id="io_24_out" class="IFL"></div></td></tr> </table> <table class="OCell"> <tr><td class="lab">Out[24]=</td><td class="Output"><div class="wideimage"> <img src="Files/23-more-about-numbers-io-24-o.png.en" width="97" height="19" id="23-more-about-numbers-io-24-o" alt="" /> </div></td></tr> </table> </div> <div class="VocabularySection"><a id="Vocabulary" />Vocabulary</div> <div class="VocabularyTable"> <table class="nogridboxdividers"> <col /> <col /> <col /> <tr class="lineAbove" style=""><td><a href="http://reference.wolfram.com/language/ref/N.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>[<span class="CodeVariableLrg">expr</span>]</td><td> </td><td><span class="VocabularyText">numerical approximation </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Pi.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Pi</a></td><td> </td><td><span class="VocabularyText">the number <span class="special-character Pi">π</span> (pi)<span class="special-character TildeEqual">≃</span>3.14 </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Sqrt.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Sqrt</a>[<span class="CodeVariableLrg">x</span>]</td><td> </td><td><span class="VocabularyText">square root </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Log10.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Log10</a>[<span class="CodeVariableLrg">x</span>]</td><td> </td><td><span class="VocabularyText">logarithm to base 10 </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Log.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Log</a>[<span class="CodeVariableLrg">x</span>]</td><td> </td><td><span class="VocabularyText">natural logarithm (ln) </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Abs.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Abs</a>[<span class="CodeVariableLrg">x</span>]</td><td> </td><td><span class="VocabularyText">absolute value (drop minus signs) </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Round.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Round</a>[<span class="CodeVariableLrg">x</span>]</td><td> </td><td><span class="VocabularyText">round to nearest integer </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Prime.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Prime</a>[<span class="CodeVariableLrg">n</span>]</td><td> </td><td><span class="VocabularyText"><span class="InlineCode"><span class="CodeVariable">n</span></span>th prime number</span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/Mod.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>[<span class="CodeVariableLrg">x</span>,<span class="CodeVariableLrg">n</span>]</td><td> </td><td><span class="VocabularyText">modulo (<span class="special-character OpenCurlyDoubleQuote">“</span>clock arithmetic<span class="special-character CloseCurlyDoubleQuote">”</span>) </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/RandomReal.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RandomReal</a>[<span class="CodeVariableLrg">max</span>]</td><td> </td><td><span class="VocabularyText">random real number between 0 and <span class="InlineCode"><span class="CodeVariable">max</span></span> </span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/RandomReal.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RandomReal</a>[<span class="CodeVariableLrg">max</span>,<span class="CodeVariableLrg">n</span>]</td><td> </td><td><span class="VocabularyText">list of <span class="InlineCode"><span class="CodeVariable">n</span></span> random real numbers</span></td></tr> <tr class="" style=""><td><a href="http://reference.wolfram.com/language/ref/ListLogPlot.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ListLogPlot</a>[<span class="CodeVariableLrg">data</span>]</td><td> </td><td><span class="VocabularyText">plot on a logarithmic scale </span></td></tr> </table> </div> <div class="ExerciseSection" id="ExerciseSection"><a id="Exercises" />Exercises<div class="NewCheckYourAnswers"> <a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-new-check-your-exercises-in-cloud-23-more-about-numbers">Check your answers in the Wolfram Cloud</a> </div></div> <div class="Exercise" id="23.1"><span class="ExerciseNumber">23.1</span>Find <img src="Files/23-more-about-numbers-box-1.png.en" height="20" width="22" alt="" /> to 500-digit precision. <a href="javascript:OpenCloseExercises('23.1');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.1-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.1');" id="EIWL-WEB-2nd-ed-close-exercise-23.1-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.1-out.png" class="ExerciseBoxOutputImage" width="599" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.1-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.2"><span class="ExerciseNumber">23.2</span>Generate 10 random real numbers between 0 and 1. <a href="javascript:OpenCloseExercises('23.2');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.2-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.2');" id="EIWL-WEB-2nd-ed-close-exercise-23.2-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Sample expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.2-out.png" class="ExerciseBoxOutputImage" width="373" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.2-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.3"><span class="ExerciseNumber">23.3</span>Make a plot of 200 points with random real <em>x</em> and <em>y</em> coordinates between 0 and 1. <a href="javascript:OpenCloseExercises('23.3');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.3-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.3');" id="EIWL-WEB-2nd-ed-close-exercise-23.3-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Sample expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.3-out.png" class="ExerciseBoxOutputImage" width="344" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.3-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.4"><span class="ExerciseNumber">23.4</span>Create a random walk using <a href="http://reference.wolfram.com/language/ref/AnglePath.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">AnglePath</a> and 1000 random real numbers between 0 and 2<span class="special-character Pi">π</span>. <a href="javascript:OpenCloseExercises('23.4');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.4-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.4');" id="EIWL-WEB-2nd-ed-close-exercise-23.4-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Sample expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.4-out.png" class="ExerciseBoxOutputImage" width="337" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.4-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.5"><span class="ExerciseNumber">23.5</span>Make a table of <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/Mod.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>[n^2, 10]</span> for <span class="InlineCode">n</span> from 0 to 30. <a href="javascript:OpenCloseExercises('23.5');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.5-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.5');" id="EIWL-WEB-2nd-ed-close-exercise-23.5-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.5-out.png" class="ExerciseBoxOutputImage" width="405" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.5-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.6"><span class="ExerciseNumber">23.6</span>Make a line plot of <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/Mod.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>[n^n, 10]</span> for <span class="InlineCode">n</span> from 1 to 100. <a href="javascript:OpenCloseExercises('23.6');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.6-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.6');" id="EIWL-WEB-2nd-ed-close-exercise-23.6-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.6-out.png" class="ExerciseBoxOutputImage" width="240" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.6-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.7"><span class="ExerciseNumber">23.7</span>Make a table of the first 10 powers of <span class="special-character Pi">π</span>, rounded to integers. <a href="javascript:OpenCloseExercises('23.7');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.7-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.7');" id="EIWL-WEB-2nd-ed-close-exercise-23.7-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.7-out.png" class="ExerciseBoxOutputImage" width="281" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.7-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.8"><span class="ExerciseNumber">23.8</span>Make a graph by connecting <span class="InlineCode">n</span> with <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/Mod.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>[n^2, 100]</span> for <span class="InlineCode">n</span> from 0 to 99. <a href="javascript:OpenCloseExercises('23.8');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.8-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.8');" id="EIWL-WEB-2nd-ed-close-exercise-23.8-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.8-out.png" class="ExerciseBoxOutputImage" width="240" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.8-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <a id="LastCellOfAPage" /> <div class="Exercise" id="23.9"><span class="ExerciseNumber">23.9</span>Generate graphics of 50 circles with random real coordinates 0 to 10, random real radii from 0 to 2, and random colors. <a href="javascript:OpenCloseExercises('23.9');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.9-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.9');" id="EIWL-WEB-2nd-ed-close-exercise-23.9-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Sample expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.9-out.png" class="ExerciseBoxOutputImage" width="240" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.9-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <a id="p-134" /> <div class="Exercise" id="23.10"><span class="ExerciseNumber">23.10</span> Make a plot of the <span class="InlineCode">n</span>th prime divided by <span class="InlineCode">n*log(n)</span>, for <span class="InlineCode">n</span> from 2 to 1000. <a href="javascript:OpenCloseExercises('23.10');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.10-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.10');" id="EIWL-WEB-2nd-ed-close-exercise-23.10-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.10-out.png" class="ExerciseBoxOutputImage" width="312" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.10-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.11"><span class="ExerciseNumber">23.11</span>Make a line plot of the differences between successive primes up to 100. <a href="javascript:OpenCloseExercises('23.11');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.11-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.11');" id="EIWL-WEB-2nd-ed-close-exercise-23.11-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.11-out.png" class="ExerciseBoxOutputImage" width="304" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.11-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.12"><span class="ExerciseNumber">23.12</span>Generate a sequence of 20 middle C notes with random durations between 0 and 0.5 seconds. <a href="javascript:OpenCloseExercises('23.12');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.12-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.12');" id="EIWL-WEB-2nd-ed-close-exercise-23.12-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Sample expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.12-out.png" class="ExerciseBoxOutputImage" width="250" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.12-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.13"><span class="ExerciseNumber">23.13</span>Make an array plot of <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/Mod.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Mod</a>[i, j]</span> for <span class="InlineCode">i</span> and <span class="InlineCode">j</span> up to 50. <a href="javascript:OpenCloseExercises('23.13');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.13-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.13');" id="EIWL-WEB-2nd-ed-close-exercise-23.13-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.13-out.png" class="ExerciseBoxOutputImage" width="240" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.13-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="23.14"><span class="ExerciseNumber">23.14</span>Make a list for <span class="InlineCode">n</span> from 2 to 10 of array plots for <span class="InlineCode">x</span> and <span class="InlineCode">y</span> up to 50 of <span class="InlineCode">x^y mod n</span>. <a href="javascript:OpenCloseExercises('23.14');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-23.14-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('23.14');" id="EIWL-WEB-2nd-ed-close-exercise-23.14-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-23.14-out.png" class="ExerciseBoxOutputImage" width="506" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-23.14-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="x23.1"><span class="ExerciseWebNumber">+23.1</span>Use <a href="http://reference.wolfram.com/language/ref/Round.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Round</a> to compute the fractional part of <span class="special-character Pi">π</span> to 50 digits. <a href="javascript:OpenCloseExercises('x23.1');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-x23.1-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('x23.1');" id="EIWL-WEB-2nd-ed-close-exercise-x23.1-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-x23.1-out.png" class="ExerciseBoxOutputImage" width="358" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-x23.1-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="x23.2"><span class="ExerciseWebNumber">+23.2</span>Find the sum of the first 1000 prime numbers. <a href="javascript:OpenCloseExercises('x23.2');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-x23.2-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('x23.2');" id="EIWL-WEB-2nd-ed-close-exercise-x23.2-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-x23.2-out.png" class="ExerciseBoxOutputImage" width="52" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-x23.2-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="x23.3"><span class="ExerciseWebNumber">+23.3</span>Make a list of the first 100 primes modulo 4. <a href="javascript:OpenCloseExercises('x23.3');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-x23.3-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('x23.3');" id="EIWL-WEB-2nd-ed-close-exercise-x23.3-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-x23.3-out.png" class="ExerciseBoxOutputImage" width="465" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-x23.3-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="Exercise" id="x23.4"><span class="ExerciseWebNumber">+23.4</span>Make a list of the first 10000 primes modulo 4, multiply them by 90<span class="special-character Degree">°</span> and create an angle path from them. <a href="javascript:OpenCloseExercises('x23.4');" class="km-track-click-no-url ExerciseOpenCloseButton" id="EIWL-WEB-2nd-ed-show-exercise-x23.4-23-more-about-numbers">»</a></div> <div class="ExerciseInputBox"> <div class="closePopup"> <a href="javascript:OpenCloseExercises('x23.4');" id="EIWL-WEB-2nd-ed-close-exercise-x23.4-23-more-about-numbers" class="km-track-click-no-url"><img src="img/x-static-icon.png" class="ExerciseBoxCloseImage" alt=" " /></a> </div> <div class="ExerciseInputBoxHeading"> <div class="ExerciseBoxExpectedOutput">Expected output:</div> <table class="ExerciseExpectedOutputTable"> <tr><td class="ExerciseExpectedOutputCellLabel">Out[]=</td><td><div class="ExerciseBoxExpectedOutputImg"> <img src="Files/answers-to-exercises-x23.4-out.png" class="ExerciseBoxOutputImage" width="240" alt=" " /> </div></td></tr> </table> <div class="ExerciseGoToWolframCloud" id="ExerciseGoToWolframCloud"> <img src="img/open-exercise-in-cloud.png" class="ExerciseGoToWolframCloudImage" alt=" " /> <span class="ExerciseGoToWolframCloudSpan"><a href="https://lab.wolframcloud.com/app/view/openEIWL?parentFilePath=elementary-introduction/23-more-about-numbers-exercises.nb#sidebar=eiwl/23-more-about-numbers" class="km-track-click-no-url ExerciseCloudLink" target="_blank" id="EIWL-WEB-2nd-ed-goto-cloud-link-in-exercise-x23.4-23-more-about-numbers">Answer & check your solution</a></span> </div> </div> </div> <div class="QASection"><a id="QAndA" />Q&A</div> <div class="Question"><a id="i-17" />What are examples of mathematical functions in the Wolfram Language?</div> <div class="Answer"><a id="i-18" />From standard school math, ones like <a href="http://reference.wolfram.com/language/ref/Sin.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Sin</a>, <a href="http://reference.wolfram.com/language/ref/Cos.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Cos</a>, <a href="http://reference.wolfram.com/language/ref/ArcTan.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ArcTan</a>, <a href="http://reference.wolfram.com/language/ref/Exp.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Exp</a>, as well as <a href="http://reference.wolfram.com/language/ref/GCD.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">GCD</a>, <a href="http://reference.wolfram.com/language/ref/Factorial.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Factorial</a>, <a href="http://reference.wolfram.com/language/ref/Fibonacci.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Fibonacci</a>. From physics and engineering and higher math, ones like <a href="http://reference.wolfram.com/language/ref/Gamma.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Gamma</a> (<span class="special-character OpenCurlyDoubleQuote">“</span>gamma function<span class="special-character CloseCurlyDoubleQuote">”</span>), <a href="http://reference.wolfram.com/language/ref/BesselJ.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">BesselJ</a> (<span class="special-character OpenCurlyDoubleQuote">“</span>Bessel function<span class="special-character CloseCurlyDoubleQuote">”</span>), <a href="http://reference.wolfram.com/language/ref/EllipticK.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">EllipticK</a> (<span class="special-character OpenCurlyDoubleQuote">“</span>elliptic integral<span class="special-character CloseCurlyDoubleQuote">”</span>), <a href="http://reference.wolfram.com/language/ref/Zeta.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Zeta</a> (<span class="special-character OpenCurlyDoubleQuote">“</span>Riemann zeta function<span class="special-character CloseCurlyDoubleQuote">”</span>), <a href="http://reference.wolfram.com/language/ref/PrimePi.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">PrimePi</a>, <a href="http://reference.wolfram.com/language/ref/EulerPhi.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">EulerPhi</a>. From statistics, ones like <a href="http://reference.wolfram.com/language/ref/Erf.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Erf</a>, <a href="http://reference.wolfram.com/language/ref/NormalDistribution.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">NormalDistribution</a>, <a href="http://reference.wolfram.com/language/ref/ChiSquareDistribution.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">ChiSquareDistribution</a>. Hundreds of functions altogether.</div> <div class="Question"><a id="i-19" />What is the precision of a number?</div> <div class="Answer">It<span class="special-character CloseCurlyQuote">’</span>s the total number of decimal digits quoted in the number. <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/N.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>[100/3, 5]</span> gives <span class="InlineCode">33.333</span>, which has 5 digits of precision. The number <span class="InlineCode">100/3</span> is exact; <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/N.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>[100/3, 5]</span> approximates it to 5-digit precision.</div> <div class="Question"><a id="i-20" />What does the <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/character/Continuation.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank"><span class="special-character Continuation"></span></a></span> at the end of each line in a long number mean?</div> <div class="Answer">It<span class="special-character CloseCurlyQuote">’</span>s there to show that the number continues onto the next line<span class="special-character LongDash">—</span>like a hyphen in text.</div> <div class="Question"><a id="i-21" />Can I work with numbers in bases other than 10?</div> <div class="Answer">Yes. Enter a number in base 16 as <span class="InlineCode">16^^ffa5</span>. Find digits using <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/IntegerDigits.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">IntegerDigits</a>[655, 16]</span>.</div> <div class="Question"><a id="i-22" />Can the Wolfram Language handle complex numbers?</div> <div class="Answer">Of course. The symbol <a href="http://reference.wolfram.com/language/ref/I.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">I</a> (capital <span class="special-character OpenCurlyDoubleQuote">“</span>i<span class="special-character CloseCurlyDoubleQuote">”</span>) represents the square root of <span class="special-character Minus">−</span>1.</div> <div class="Question">Why does <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/N.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>[1.5/7, 100]</span> not give me a 100-digit result?</div> <div class="Answer">Because <span class="InlineCode">1.5</span> is an approximate number with much less than 100-digit precision. <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/N.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>[15/70, 100]</span> will for example give a 100-digit-precision number.</div> <div class="TechNoteGroup"> <div class="TechNoteSection"><a id="TechNotes" />Tech Notes</div> <ul class="TechNoteList"> <li class="TechNote">The Wolfram Language does <span class="special-character OpenCurlyDoubleQuote">“</span>arbitrary-precision computation<span class="special-character CloseCurlyDoubleQuote">”</span>, meaning that it can keep as many digits in a number as you want.</li> <li class="TechNote"><a id="i-23" />When you generate a number with a certain precision using <a href="http://reference.wolfram.com/language/ref/N.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>, the Wolfram Language will automatically keep track of how that precision is affected by computations<span class="special-character LongDash">—</span>so you don<span class="special-character CloseCurlyQuote">’</span>t have to do your own numerical analysis of roundoff errors.</li> <li class="TechNote"><a id="i-24" />If you type a number like 1.5, it<span class="special-character CloseCurlyQuote">’</span>s assumed to be at the native <span class="special-character OpenCurlyDoubleQuote">“</span>machine precision<span class="special-character CloseCurlyDoubleQuote">”</span> of numbers on your computer (usually about 16 digits, though only 6 are usually displayed). Use <span class="InlineCode">1.5<span class="special-character InvisibleSpace"> </span>`100</span> to specify 100-digit precision.</li> <li class="TechNote">With exact input (like 4 or 2/3 or <a href="http://reference.wolfram.com/language/ref/Pi.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Pi</a>), the Wolfram Language always tries to give exact output. But if the input contains an approximate number (like 2.3), or if you use <a href="http://reference.wolfram.com/language/ref/N.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">N</a>, it<span class="special-character CloseCurlyQuote">’</span>ll use numerical approximation.</li> <li class="TechNote"><a id="i-25" />Numerical approximation is often crucial in making large-scale computations feasible.</li> <li class="TechNote"><a id="LastCellOfAPage" /><a id="i-26" /><a href="http://reference.wolfram.com/language/ref/PrimeQ.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">PrimeQ</a> tests if a number is prime (see <a href="/language/elementary-introduction/2nd-ed/28-tests-and-conditionals.html#PrimeQ" class="hyperlink km-track-click-no-url" id="EIWL-WEB-2nd-ed-external-link-23-more-about-numbers" target="_blank">Section 28</a>). <a href="http://reference.wolfram.com/language/ref/FactorInteger.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">FactorInteger</a> finds the factors of an integer.</li> <li class="TechNote"><a id="p-135" /><a id="i-27" /><a href="http://reference.wolfram.com/language/ref/RandomReal.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RandomReal</a> can give numbers that aren<span class="special-character CloseCurlyQuote">’</span>t just uniformly distributed. For example, <span class="InlineCode"><a href="http://reference.wolfram.com/language/ref/RandomReal.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RandomReal</a>[<a href="http://reference.wolfram.com/language/ref/NormalDistribution.html" class="codelink km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">NormalDistribution</a>[ ]]</span> gives normally distributed numbers.</li> <li class="TechNote"><a id="i-28" /><a href="http://reference.wolfram.com/language/ref/Round.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Round</a> rounds to the nearest integer (up or down); <a href="http://reference.wolfram.com/language/ref/Floor.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Floor</a> always rounds down; <a href="http://reference.wolfram.com/language/ref/Ceiling.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">Ceiling</a> always rounds up.</li> <li class="TechNote"><a id="i-29" /><a href="http://reference.wolfram.com/language/ref/RealDigits.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">RealDigits</a> is the analog of <a href="http://reference.wolfram.com/language/ref/IntegerDigits.html" class="link km-track-click-no-url" id="EIWL-WEB-2nd-ed-function-link-23-more-about-numbers" target="_blank">IntegerDigits</a> for real numbers.</li> </ul> </div> <div class="MoreExploreGroup"> <div class="MoreExploreSection"><a id="MoreToExplore" />More to Explore</div> <div class="MoreExploreList"> <div class="MoreExplore"> <a href="http://reference.wolfram.com/language/guide/NumericalEvaluationAndPrecision.html" class="hyperlink km-track-click-no-url" id="EIWL-WEB-2nd-ed-external-link-23-more-about-numbers" target="_blank">Guide to Numbers in the Wolfram Language<span class="special-character NonBreakingSpace"> </span><span class="special-character RightGuillemet">»</span></a> </div> <div class="MoreExplore"> <a id="LastCellOfAPage" /> <a href="http://reference.wolfram.com/language/guide/MathematicalFunctions.html" class="hyperlink km-track-click-no-url" id="EIWL-WEB-2nd-ed-external-link-23-more-about-numbers" target="_blank">Guide to Mathematical Functions in the Wolfram Language<span class="special-character NonBreakingSpace"> </span><span class="special-character RightGuillemet">»</span></a> </div> </div> </div> </div> </div> <div class="bottomSpacerCell"> </div> </div> </div> </section> <div class="GoToCloudVersion" id="GoToCloudVersion"><a href="23-more-about-numbers-cloud.html" class="km-track-click-no-url" id="EIWL-WEB-2nd-ed-switch-to-cloud-embed-23-more-about-numbers"><img src="img/switch-to-cloud.png" alt="" ></a></div> <div class="GoToHTMLVersion" id="GoToHTMLVersion"><a href="23-more-about-numbers.html" class="km-track-click-no-url" id="EIWL-WEB-2nd-ed-switch-to-html-23-more-about-numbers"><img src="img/switch-to-html.png" alt="" ></a></div> <a href="javascript:nbdownload('EIWL2-23-more-about-numbers.nb');" class="km-track-click-no-url" id="EIWL-WEB-2nd-ed-download-notebook-23-more-about-numbers"><div class="DownloadNotebook" id="DownloadNotebook"><span class='DownloadNotebookText'>Download Notebook Version</span></div></a> <a href="22-machine-learning.html" id="EIWL-WEB-2nd-ed-prev-section-footer-23-more-about-numbers" class="km-track-click-no-url"><div class="previousFooter"></div></a> <a href="24-more-forms-of-visualization.html" id="EIWL-WEB-2nd-ed-next-section-footer-23-more-about-numbers" class="km-track-click-no-url"><div class="nextFooter"></div></a> <!-- gl-footer-includes.en.html --> </div><!--/#gl-inner-wrapper --> </div><!--/#gl-outer-wrapper --> <span id="gl-footer-lang-message"><i class="gl-icon gl-r7-c2"></i></span> <span id="gl-footer-lang"></span><span id="gl-footer-lang-links"><a href="/language/elementary-introduction/2nd-ed/23-more-about-numbers.html.es?footer=lang"><img src="/common/images/gl-lang-es.png" alt="es"></a> </span> <script src="/common/javascript/gl-footer-scripts.en.js"></script> <div id ="IPstripe-wrap"></div> <script src="/common/stripe/stripe.en.js"></script> <!--/gl-footer-includes.en.html --> <script src="/common/javascript/kissmetrics.js"></script> <script src="/language/elementary-introduction/2nd-ed/js/chapter-cookie.js.en"></script> <script src="https://www.wolframcdn.com/notebook-embedder/0.1/wolfram-notebook-embedder.js"></script> </body> </html>