473,581 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PsotgreSQL Mathematics Extension Enquiry

11 New Member
I have been trying to find active interest in a free for all use PostgreSQL extension, complete and available, on the public internet, that will support the following:

High Precision Numeric and Elementary Functions Support
In PostgreSQL v13 and beyond.
HPPM: High Precision PostgreSQL Mathematics.

-Integer Z, or Rational Mixed Decimal Q, numbers support in 64 bit PostgreSQL. Via HPZ, and HPQ, original types. In this specification, they are collectively referred to as HPX types.

There should be no range or multi range types or their supporting functions or special operators included for HPX types, at this point.

-The extension could be based on a library like GMP, written in C, being an appropriate basis to use, for all OS platforms involved. The point being, that there is already some support for this extension, in terms of its logic, publicly available in C that can be apprehended for this extension and its platforms.

-Real numbers are the values of Integer, non-recurring Rational Numbers and recurring, Irrational Numbers.
Recurring numbers can be appropriately truncated, via a finite Natural precision value, always at least 1, to obtain an approximating value. The approximating value can really be seen as a finite Rational value, possibly with integer or decimal parts, or both together. These numbers may be positive or negative, or zero, scalar values, may be integers, decimals or mixed numbers, and always do exist on the one dimensional number line.

-A defaulting number of significant figures (precision), stored inside each HPX data or type instance. This gets specified within each type variable before its use, or on data at type casting. Or a default precision is submitted instead. Precision can be accessed and changed later via precision functions.

Precision is set at data casting, type declaration, or from the default, and may be altered again later. Precision is always apprehended before external or internal evaluation begins. Precision is used to control numbers, and operations involving them, and the number output, when numeric manipulation happens.

If an HPX value is data on its own, without a variable or a coded expression, it takes the total default precision, if simply specified alone. If it is inserted into a table column with a different precision, then that precision is applied then. When an HPX calculated value is assigned into an HPX variable, it will try to skip ahead to the assignment variable, and take its precision from the result variable, which can be set up beforehand. If however, an HPX value, in a PostgreSQL code expression is sent straight into a RETURN statement or later, a SELECT statement, for example, then that datum will contain the highest precision value out of any of the previous values in the PostgreSQL expression which lead to it. But before anything is set or specified, a total default precision value of 20 is the beginning point.

precision(HPZ input, BIGINT input) returns HPZ;
precision(HPQ input, BIGINT input) returns HPQ;
precision(HPZ input) returns BIGINT;
precision(HPQ input) returns BIGINT;
expression(HPZ input) returns TEXT;
expression(HPQ input) returns TEXT;


-HPX values, as PostgreSQL data, can be displayed, but they sit on top of a few other phenomena. Forward and inverse accuracy, withstanding truncation, can be achieved by storing, encapsulating and operating with and normalising the mathematical expression (or just one value, via assignment). The expression has one or more links, from value(s) to variable(s) in the expression, via applying of precision adjustment at evaluation time, all internally. This system will uphold any precision, certainly ones within a very large range limit, controlled by the already available type, the BIGINT. It can enumerate digits of a frequency within the range of -9,223,372,036,8 54,775,808 to 9,223,372,036,8 54,775,807. Though naturally evaluation will slow down, or not conclude in useful time frames, before these limits. That phenomenon can be allowed, and left to the context of the programmer to deal with or avoid as they may. They may try to minimise the extent of one internal expression by using re-substitution in the body of originating, PostgreSQL, code.

--------------------------------------------------------------
--At the point of PostgreSQL code input and execution:

select pi(1001) as pi;

--Within a table creation command:

create table example_table
(
id BIGSERIAL PRIMARY KEY,
a HPZ,
b HPQ(50)
);


INSERT INTO example_table(a ,b) VALUES(0, 0.1);
INSERT INTO example_table(a ,b) VALUES(100,1.1) ;
INSERT INTO example_table(a ,b) VALUES(200,2.2) ;
INSERT INTO example_table(a ,b) VALUES(300,3.3) ;
INSERT INTO example_table(a ,b) VALUES(400,4.4) ;
INSERT INTO example_table(a ,b) VALUES(500,5.5) ;
INSERT INTO example_table(a ,b) VALUES(600,6.6) ;
INSERT INTO example_table(a ,b) VALUES(700,7.7) ;
INSERT INTO example_table(a ,b) VALUES(800,8.8) ;
INSERT INTO example_table(a ,b) VALUES(900,9.9) ;

--Or as variables, in some function:

create or replace function example_functio n()
returns void
language plpgsql
as
$$

declare
a HPQ;
b HPQ;
c HPQ;

begin

BIGINT p=30;
precision(a,p);
precision(b,p);
a = 0.1;
b = 0.1;
precision(c,3);
c=a*b;
precision(c,p^2 );
return void
end;
$$

--------------------------------------------------------------

-Value assignment to a typed variable by =.

-Operators. Base 10 Arithmetic and comparisons support on Base 10 HPZ and HPQ, with casting:

+,-,*,/,%,^,=,!=,<>,>, <,>=,<=, ::

These include full division and integer only division (from type inference), with no remainder, and a remainder calculating operator. There should be a defaulting ability of values not within these two types to automatically be cast up to HPZ or HPQ, where specified and appropriate in PostgreSQL expressions.

-Reified support with broader syntax and operations within PostgreSQL. Tables and related phenomena, Array types, Indexing, Variables and related phenomena,the Record type,
direct compatability with Aggregate and Window functions, and Partitions are all parts of a larger subset that should re-interact with HPZ or HPQ successfully.

-Ease of installation support. Particularly for Windows and Linux. *.exe, *.msi or *.rpm, *.deb, *.bin installers.
Upon a PostgreSQL standard installation. Installation and Activation instructions included, if unavoidable. The extension should literally just install and be applicable, with no loading command necessary, inside PostgreSQL. Every time the database process runs, by default.

-Mathematical and Operational functions support:

cast(HPZ as HPQ) returns HPQ;
cast(HPQ as HPZ) returns HPZ;
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 SMALLINT) returns SMALLINT;
cast(SMALLINT as HPZ) returns HPZ;
cast(HPZ as INTEGER) returns INTEGER;
cast(INTEGER as HPZ) returns HPZ;
cast(HPZ as BIGINT) returns BIGINT;
cast(BIGINT as HPZ) returns HPZ;
cast(HPQ as REAL) returns REAL;
cast(REAL as HPQ) returns HPQ;
cast(DOUBLE PRECISION as HPQ) returns HPQ;
cast(HPQ as DOUBLE PRECISION) returns DOUBLE PRECISION;
cast(HPQ as DECIMAL) returns DECIMAL;
cast(DECIMAL as HPQ) returns HPQ;
cast(HPQ as NUMERIC) returns NUMERIC;
cast(NUMERIC as HPQ) returns HPQ;

sign(HPQ input) returns HPZ;
abs(HPQ input) returns HPQ;
ceil(HPQ input) returns HPZ;
floor(HPQ input) returns HPZ;
round(HPQ input) returns HPZ;
recip(HPQ input) returns HPQ;
pi(BIGINT precision) returns HPQ;
e(BIGINT precision) 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;
ln(HPQ input) returns HPQ;
log2(HPQ input) returns HPQ;
factorial(HPZ input) returns HPZ;
nCr(HPZ objects, HPZ selectionSize) returns HPZ;
nPr(HPZ objects, HPZ selectionSize) 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:

Comparison Operators: https://en.wikipedia.or g/wiki/Relational_oper ator
Floor and Ceiling Functions: https://en.wikipedia.or g/wiki/Floor_and_ceili ng_functions
Arithmetic Operations: https://en.wikipedia.or g/wiki/Arithmetic
Integer Division: https://en.wikipedia.or g/wiki/Division_(mathe matics)#Of_inte gers
Modulus Operation: https://en.wikipedia.or g/wiki/Modulo_operatio n
Rounding (Commercial Rounding): https://en.wikipedia.or g/wiki/Rounding
Factorial Operation: https://en.wikipedia.or g/wiki/Factorial
Degrees: https://en.wikipedia.or g/wiki/Degree_(angle)
Radians: https://en.wikipedia.or g/wiki/Radian
Elementary Functions: https://en.wikipedia.or g/wiki/Elementary_func tion

The following chart could be used to help test trigonometry outputs, under
Further Condsideration of the Unit Circle:
https://courses.lumenle arning.com/boundless-algebra/chapter/trigonometric-functions-and-the-unit-circle/

The End.
Sep 28 '21 #1
0 4020

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1199
by: Steven T. Hatton | last post by:
If you are into 3d programming, you may be interested in this book: _Essential Mathematics for Games and Interactive Applications_ http://tinyurl.com/4wrl6 I just bought it on a lark. After looking it over, I have to say it looks to be well written. The reason I'm mentioning it here is because it comes with what looks to be a pretty nice...
10
1818
by: Hermit Dave | last post by:
Hi, Depending upon their security settings some users can not login due to their machine's Privacy Settings some how blocking the cookie (no privacy policy available)... which is encrypted... what i would like is someone to tell me how to set privacy policy for the cookie.. i know its probably not related to asp.net but googling didnt help...
1
1481
by: John | last post by:
Hi I have an enquiry web form with several fields to which I also need to link a grid. As it is an enquiry form I don't necessarily want to bind the grid to a db. Ideally I want to allow user to fill the form fields and the gird, in possibly unbound mode, read the values (fields and grid) off the form and insert the values into a db. All...
1
1729
by: Juan R. | last post by:
The initial CanonMath program presented here http://canonicalscience.blogspot.com/2006/02/choosing-notationsyntax-for-canonmath.html] was discussed with several specialists, including father of XML-MAIDEN project (which provided many interesting ideas over original desing). The initial CanonMath program (was abandoned) was presented at the...
21
3018
by: arnuld | last post by:
I want to learn algorithms & data-structures. search told me nothing beats KNUTH, the DON. since my Maths is weak, i purchased prerequisite to his AoCP i.e. "Concrete Mathematics" . it's very complicated & confusing for the time being i am unable to make any sense out of it but i am persisting because i think sooner or later it will make sense...
0
1420
by: Juan R. | last post by:
Since the idea of encoding mathematics using MathML is being very far from popular due to a number of factors -expensive tools, bad accesibility of generated code, unusual verbosity, lack of adequate support, special fonts, namespaces, special plugins, backward incompatiblity of MathML with other internet technologies, duplication of code,...
2
4439
by: punitshrivastava | last post by:
Hi to All. I am Punit Shrivastava.I am working in Asp.As i am new in this technology please help me. I want to create enquiry form in Asp. For this i code like this: <form name="enquiry" method="post" action="enquiry.php"> <table width="494" border="0" cellspacing="0" cellpadding="2" height="511"> <tr> <td colspan="2"...
19
157
by: Terry Reedy | last post by:
"Luis Zarrabeitia" <kyrie@uh.cuwrote in message news:200805081914.06459.kyrie@uh.cu... | Btw, there seems to be a math problem in python with exponentiation... | >>0**0 | 1 | That 0^0 should be a nan or exception, I guess, but not 1. a**b is 1 multiplied by a, b times. 1 multiplied by 0 no times is 1. But there are unenlighted people who...
0
8144
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8301
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8169
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6551
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3803
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3820
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1400
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.