A simple library of mathematical objects for CREXX.
This project demonstrates how to implement mathematical objects using object-oriented programming in CREXX, a member of the family of Rexx programming languages.
It is intended both as a collection of educational examples and as a reusable library.
- Complex numbers
- Fractions
- Vector2D
- ArithmeticSequence
- GeometricSequence
- Object-oriented API
- Immutable objects
- Basic arithmetic operations
- String formatting methods
- Example programs
z1 = .Complex(3, 4)
z2 = .Complex(1, -2)
say 'z₁ =' z1.string()
say 'z₂ =' z2.string()
say 'z₁ + z₂ =' z1.add(z2).toBinomial()
say 'z₁ · z₂ =' z1.multiply(z2).toCartesian()f1 = .Fraction(3, 4)
f2 = .Fraction(1, -2)
say 'f₁ =' f1.string()
say 'f₂ =' f2.string()
say 'f₁ + f₂ =' f1.add(f2).string()
say 'f₁ · f₂ =' f1.multiply(f2).string()Compile and run the demonstration programs:
crexx -i ./src ./src/Complex.crexx ./examples/demoComplex.crexx
crexx -i ./src ./src/Fraction.crexx ./examples/demoFraction.crexx├── README.md
├── LICENSE
├── src/
│ ├── Complex.crexx
│ └── Fraction.crexx
└── examples/
├── demoComplex.crexx
└── demoFraction.crexx
| File | Description |
|---|---|
README.md |
Project overview and usage information. |
LICENSE |
Project license. |
src/Complex.crexx |
Complex number class. |
examples/demoComplex.crexx |
Demonstration program for the Complex class. |
src/Fraction.crexx |
Class for Fractions. |
examples/demoFraction.crexx |
Demonstration program for the Fraction class. |
Special thanks to René Jansen and Adrian Sutherland for their valuable explanations during the development of this project.
This project is distributed under the terms described in the LICENSE file.
Salvador Parra Camacho
GitHub: https://github.com/sparrac