Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] More arithmetic operations, constants and random numbers #15

Open
4 tasks
tommens opened this issue Dec 30, 2024 · 0 comments
Open
4 tasks

[FEATURE] More arithmetic operations, constants and random numbers #15

tommens opened this issue Dec 30, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tommens
Copy link
Collaborator

tommens commented Dec 30, 2024

Describe the new functionality you would like to see

  • The calculator only provides support for elementary arithmetic operations such as +, *, / and -. Many other types of operations are needed. This feature supposes that [FEATURE] Supporting rational, real and complex numbers #14 is already implemented. The types of operations to provide will depend on the number domains (e.g. integer, rational, real, complex numbers) supported by the calculator.
  • One needs to implement at least the following functions: the inverse 1/x, logarithm (log and ln), exponent, n-th root, and n-th power (x^^n), all trigonometric functions (sin, cos, tan; their inverses asin, acos, atan; their hyperbolic variants sinh, cosh, tanh)
  • Support for frequently used constants such as e and Pi, with the possibility to easily add other constants.
  • For all supported number domain, one needs to implement a pseudorandom generator. For testing purposes, it should be possible to give a random seed to the random generator can be tested deterministically. For the integer number domain, the random generator will provide a random integer between 0 and a given integer provided as input. For the rational number domain, the random generator will provide a random rational a/b with a and b random integer between 0 and a given integer provided as input (b cannot be 0). For the real number domain, the random generator will always provide a real value between 0 and 1. For the complex number domain, the random generator will provide a value a + i b where a and b are real values between 0 and 1.

Illustration
To get inspiration for other types of operations one can also look at what typical scientific calculator machines provide (see figure below for an example).
scientific

Implementation recommendations
One could for example rely on java.lang.Math to implement other basic numeric operations, such as the power function, exponential, logarithm, square root, the trigonometric functions and more.

@tommens tommens added the enhancement New feature or request label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant