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

Classical Mathematics Support #22

Closed
PowerUser1234 opened this issue Aug 21, 2021 · 5 comments
Closed

Classical Mathematics Support #22

PowerUser1234 opened this issue Aug 21, 2021 · 5 comments

Comments

@PowerUser1234
Copy link

PowerUser1234 commented Aug 21, 2021

-Integer (HPZ) Z, or Rational Decimal Q (HPQ) numbers support.

The fact is that recurring Rational Numbers and recurring Irrational Numbers can be appropriately
truncated, by a precision value, to obtain an approximating value, a finite Rational
value, with integer and decimal parts at the same time.

-A defaulting number of significant figures (precision), say, 100, and a constructor for otherwise.
HPZ(1000) or HPQ(1000), or HPZ, HPQ just on their own, with no more specified.

-Value assignment by =. The ability to specify type without any text data in a constructor.

-Base 10 Arithmetic and comparisons support on Base 10 Integer and Rational Decimal numbers.
+,-,*,/,%,^,=,!=,<>,>,<,>=,<=, ::
These include full finite division and integer only division, with no remainder.

-When operating on two multiprecision numbers, you take the largest precision of the two,
by default, for the precision of the result. If this precision is not large enough for the
meaningful result, in terms of all integer places and at least one decimal place, there should be
a precision exception. Because of this, you need the option to learn of and enlarge the larger
of the two precisions, and to try again. And of course an exception catching block.

setPrecision(HPQ value1, INTEGER getPrecision(HPQ value1) + 1);
setPrecision(HPZ value2, INTEGER getPrecision(HPZ value2) + 1);

-Mathematical and Operational functions support:

cast(TEXT as HPZ) returns HPZ;
cast(TEXT as HPQ) returns HPQ;
cast(HPQ as text) returns TEXT;
cast(HPZ as text) returns TEXT;
cast(HPZ as HPQ) returns HPQ;
cast(HPQ as HPZ) returns HPZ;

getPrecision(HPZ input) returns INTEGER output;
getPrecision(HPQ input) returns INTEGER output;
setPrecision(HPZ value, INTEGER precision);
setPrecision(HPQ value, INTEGER precision);

sign(HPQ input) returns HPQ;
abs(HPQ input) returns HPQ;
ceil(HPQ input) returns HPQ;
floor(HPQ input) returns HPQ;
round(HPQ input) returns HPZ;
pi(INTEGER places) returns HPQ;
e(INTEGER places) returns HPQ;
power(HPQ base, HPQ exponent) returns HPQ;
sqrt(HPQ input) returns HPQ
nroot(HPZ theroot, HPQ input) returns HPQ;
log10(HPQ input) returns HPQ;
loge(HPQ input) returns HPQ;
log2(HPQ input) returns HPQ;
factorial(HPZ input) returns HPZ;

degrees(HPQ input) returns HPQ;
radians(HPQ input) returns HPQ;
sind(HPQ input) returns HPQ;
cosd(HPQ input) returns HPQ;
tand(HPQ input) returns HPQ;
asind(HPQ input) returns HPQ;
acosd(HPQ input) returns HPQ;
atand(HPQ input) returns HPQ;
sinr(HPQ input) returns HPQ;
cosr(HPQ input) returns HPQ;
tanr(HPQ input) returns HPQ;
asinr(HPQ input) returns HPQ;
acosr(HPQ input) returns HPQ;
atanr(HPQ input) returns HPQ;

-Informative articles on all these things exist at:
Arithmetic Operations: https://en.wikipedia.org/wiki/Arithmetic
Integer Division: https://en.wikipedia.org/wiki/Division_(mathematics)#Of_integers
Modulus Operation: https://en.wikipedia.org/wiki/Modulo_operation
Factorial Operation: https://en.wikipedia.org/wiki/Factorial
Comparison Operators: https://en.wikipedia.org/wiki/Relational_operator
Degrees: https://en.wikipedia.org/wiki/Degree_(angle)
Radians: https://en.wikipedia.org/wiki/Radian
Elementary Functions: https://en.wikipedia.org/wiki/Elementary_function

-Ease of installation support. Particularly for Windows and Linux. *.exe, *.msi or *.rpm, *.deb, *.bin installers.
With a PostgreSQL standard installation.

The following chart could be used to help test trigonometry outputs:
https://www.livingston.org/cms/lib9/NJ01000562/Centricity/Domain/742/calc/Trig%20functions%20chart%20-%20answers.pdf

@dvarrazzo
Copy link
Owner

What would be sqrt(2) as an mpq?

@PowerUser1234
Copy link
Author

PowerUser1234 commented Aug 22, 2021 via email

@PowerUser1234
Copy link
Author

PowerUser1234 commented Aug 22, 2021 via email

@dvarrazzo
Copy link
Owner

mpq represent rational numbers, not transcendent numbers or their approximations.

What you have in mind is probably closer to providing approximate floating point numbers and functional such as wrapping the mpfr library. This is not a minor task and will not happen unless the project is sponsored.

@PowerUser1234
Copy link
Author

PowerUser1234 commented Aug 23, 2021

What I am after is arithmetic and functions support via two number types: Integers and limited precision Rational
numbers, as a limited representation of Real numbers. Floating Point numbers, or operations, are in fact what
I am trying to avoid and circumvent. Truncated values of Real and Irrational numbers can be included in the set of
Rational number values. I hope to access this as an Extension with two new types for PostgreSQL.

Okay. From there I have two questions.

1) In terms of what I have specified at the top of this discussion, how much time would it take
for you and other pgmp contrubutors to develop and sufficiently test and debug such an
extension, with distributed standalone installers?

2) How much sponsership per month should I specify to GitHub sponser you via the pgmp project,
to convince you and your group, in sufficient terms?

3) If this is not possible, could you put me on to another individual and their email address
who is able to help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants