Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crexx-mathobjects

A simple library of mathematical objects for CREXX.

Description

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.

Status

Currently available

  • Complex numbers
  • Fractions

Planned

  • Vector2D
  • ArithmeticSequence
  • GeometricSequence

Features

  • Object-oriented API
  • Immutable objects
  • Basic arithmetic operations
  • String formatting methods
  • Example programs

Example

Complex

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()

Fraction

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()

Building and running

Compile and run the demonstration programs:

crexx -i ./src ./src/Complex.crexx ./examples/demoComplex.crexx
crexx -i ./src ./src/Fraction.crexx ./examples/demoFraction.crexx

Project structure

├── README.md
├── LICENSE
├── src/
│   ├── Complex.crexx
│   └── Fraction.crexx
└── examples/
    ├── demoComplex.crexx
    └── demoFraction.crexx

Files

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.

Acknowledgements

Special thanks to René Jansen and Adrian Sutherland for their valuable explanations during the development of this project.

License

This project is distributed under the terms described in the LICENSE file.

Author

Salvador Parra Camacho

GitHub: https://github.com/sparrac

About

This project demonstrates how to implement mathematical objects using object-oriented programming in CREXX (a Rexx implementation). It is intended both as a collection of educational examples and as a reusable library.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages