NeturalMath Quick Start Guide

Part 3: Advanced Arithmetic Operations

This document is not complete, and my represent features which are not yet implemented in the current version of NeturalMath.

This section of the Quick Start Guide is intended to teach you how to use MathConsole to perform more advanced arithmetic calculations using powers, roots and remainders.

Computing Powers in NeturalMath

The carot (^) operator is used in the NeturalMath language to represent an exponential operation. The first term will be raised to the power of the second term. This has the same net effect as multiplying a value by itself the same number of times as the second term. For example:
2 ^ 2
3 ^ 2 
4 ^ 6

Fractional and negative values may be used as well, as shown in the examples below:
2 ^ 2.5
27 ^ (1/3)
4 ^ -5

Using NeturalMath to find Roots

Because a standard keyboard has no simple character with which to represent a root operation (a fractional power), the combination of the carot (^) and the division operator (/) are used instead to create a compound symbol like this: ^/. This symbol actual makes sense for several reasons. First, because mathematically, performing a root operation is the same as performing a fractional power operation, the combination of the power and division symbols are appropriate. Second, this compound symbol looks a little like the root sign that it represents, and can be though of as a shorthand version of such (see the image below).
RootSign.gif
If the root operator is used by itself, it will return the square root of the number it is being performed on. This is the same result as finding the 1/2 power of the number or quantifying the root with a two. By providing a given root value in front of the operator, the specific root will be found. Please note that in many cases, the exact value of a root is irrational. NeturalMath can only provide an approximation of an irrational number.
^/4
^/9
2 ^/ 16
3 ^/ 27
4 ^/ 10000

Division and Remainders

It is common in many mathematical and programming operations to need to find the remainder that is left over after division has taken place. In computer science, this is also known as the modulus. The remainder or modulus operator in NeturalMath is represented by the percent sign (%). If this is confusing to you, you can think of it as a specialized version of the standard division operator that returns the "left over" numbers from the division operation rather than the division result. Remember when you were learning to perform long division by hand in school, an often the two numbers would not divide evenly and a little bit was left over? This function is designed to return that "little bit" that is left.
10 % 3
12 % 5
365 % 7


Please see the Next Section for more information about using variables in NeturalMath.

Last edited Dec 13, 2010 at 7:27 PM by zanethorn, version 7

Comments

No comments yet.