Classes | Math

# Number : Magnitude : Object

Mathematical quantity
Source: Number.sc
Subclasses: Complex, Polar, SimpleNumber

## Description

Number represents a mathematical quantity.

## Instance Methods

Subtraction.

Multiplication.

Division.

### .div(aNumber)

Integer division.

### %(that)

From superclass: Object

Modulo.

### **(that)

From superclass: Object

Exponentiation.

### .theta

Answer the polar angle of the number.

### .real

Answer the real part of the number.

### .imag

Answer the imaginary part of the number.

### @(aNumber)

Create a new Point whose x coordinate is the receiver and whose y coordinate is aNumber.

### .complex(imaginaryPart)

Create a new Complex number whose real part is the receiver with the given imaginary part.

### .polar(angle)

Create a new Polar number whose radius is the receiver with the given angle.

### .for(endValue, function)

Calls function for numbers from this up to endval, inclusive, stepping each time by 1.

#### Arguments:

 endValue a Number. function a Function which is passed two arguments, the first which is an number from this to (endval, and the second which is a number from zero to the number of iterations minus one.)

### .forBy(endValue, stepValue, function)

Calls function for numbers from this up to endval stepping each time by step.

#### Arguments:

 endValue a Number. stepValue a Number. function a Function which is passed two arguments, the first which is an number from this to endval, and the second which is a number from zero to the number of iterations minus one.

### .forSeries(second, last, function)

Calls function for numbers from this up to endval stepping each time by a step specified by second.

#### Arguments:

 second a Number. last a Number. function a Function which is passed two arguments, the first which is an number from this to endval, and the second which is a number from zero to the number of iterations minus one.