knwachuk / math-lib

Mathematics Library
MIT License
0 stars 3 forks source link

Mathematics Library Functionality #9

Open knwachuk opened 1 year ago

knwachuk commented 1 year ago

Mathematics Library

Home-made Mathematics library using the Python programming language. It will emulate the math - Mathematical functions library in Python, although it will be a much less complete version.

The math library will be rudimentary but fully functional, including all elementary arithmetic operations (i.e., addition, subtraction, multiplication, and division) and some more advanced topics (i.e., exponents and logarithms) and two special functions (absolute value and division and modulus operation).

LIMITATION

The only limitation is that only the Python + and - operators are allowed to be utilized. Every other function MUST use these. That is, no operational code is allowed to use 3rd party libraries or the operators exceptions + and -.

For example

$$3 3 = 3 + 3 + 3$$ $$-3 3 = -3 + -3 + -3 = -3 - 3 - 3$$

The mult function uses the fact that multiplication is a series of additions or subtractions to compute the multiplication of two numbers. So 3 * 2 is

sum = 0
for _ in range(2):
    sum = sum + 3
Operation Python Code
$$3 * 2$$ sum = 0; for _ in range(2): sum = sum + 3
$$-3 * 2$$ sum = 0; for _ in range(2): sum = sum - 3

Once created, the math_lib will have the ability do multiplications.

def mult(a, b):
    sum = 0
    for _ in range(b):
        sum = sum + a

mult(3, 2)

Function Completion Matrix

math_lib Function Completion PR Creator
add #3 @Arianna1o
sub #4 @codenamejupiterx
mult #6 @knwachuk
exp WIP @dsilva743
divmod WIP @HoldW

Completion State

Elementary Operations

Advanced Functions

Special Functions

dsilva743 commented 1 year ago

I want to work on this! Do I need to be assigned to this issue to commit my code?

knwachuk commented 1 year ago

No @dsilva743 , you can make a fork and a pull request! We are glad to have you participate! If you have a function you want to work on, we can convert that task into an issue so that everyone knows someone is already working on that function.

Contribution

Please note that we don't have a CONTRIBUTION.md file, but I can list the restrictions on code here:

  1. Use black for code formatting
  2. The docstring style is Google Style Python Docstring
  3. Use GitHub Flow for our workflow meaning that every change should be encapsulated in a branch before it is merged into main (and this includes me)
  4. Use Flake8 for style guide enforcement (this should really be automated)
  5. All feature implementation should have an accompanying test (see image below)

Test Driven Development PM

dsilva743 commented 1 year ago

@knwachuk Perfect! I would like to work on the exp function.

knwachuk commented 1 year ago

@knwachuk Perfect! I would like to work on the exp function.

Understood! #10 has been opened to track your request. It will be closed when a pull request that meets the specification is merged.

Arianna1o commented 1 year ago

This is confirmation that I have received this email.

Thank you,

Alanna Combs


From: Kelechi Nwachukwu @.> Sent: Thursday, March 2, 2023 8:06 PM To: knwachuk/math-lib @.> Cc: alanna.combs-W211738705 @.>; Mention @.> Subject: [knwachuk/math-lib] Mathematics Library Functionality (Issue #9)

Mathematics Library

Home-made Mathematics library using the Python programming language. It will emulate the math - Mathematical functionshttps://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwj738W6iLv9AhX6kokEHejhDfcQFnoECAkQAQ&url=https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fmath.html&usg=AOvVaw26GwSqIFLX1e1HscI8nzVo library in Python, although it will be a much less complete version.

The math library will be rudimentary but fully functional, including all elementary arithmetic operations (i.e., addition, subtraction, multiplication, and division) and some more advanced topics (i.e., exponents and logarithms) and two special functions (absolute value and division and modulus operation).

LIMITATION

The only limitation is that only the Python + and - operators are allowed to be utilized. Every other function MUST use these. That is, no operational code is allowed to use 3rd party libraries or the operators exceptions + and -.

$$3 3 = 3 + 3 + 3$$ $$-3 3 = -3 + -3 + -3 = -3 - 3 - 3$$

For example

The mult function uses the fact that multiplication is a series of additions or subtractions to compute the multiplication of two numbers. So 3 * 2 is

sum = 0 for _ in range(2): sum = sum + 3

Operation Python Code $$3 2$$ sum = 0; for _ in range(2): sum = sum + 3 $$-3 2$$ sum = 0; for _ in range(2): sum = sum - 3

Once created, the math_lib will have the ability do multiplications.

mult(3, 2)

Function Completion Matrix math_lib Function Completion PR Creator add #3https://github.com/knwachuk/math-lib/pull/3 @Arianna1ohttps://github.com/Arianna1o sub #4https://github.com/knwachuk/math-lib/pull/4 @codenamejupiterxhttps://github.com/codenamejupiterx mult #6https://github.com/knwachuk/math-lib/pull/6 @knwachukhttps://github.com/knwachuk Completion State Elementary Operations

Advanced Functions

Special Functions

— Reply to this email directly, view it on GitHubhttps://github.com/knwachuk/math-lib/issues/9, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZYMCLWQLZLDIGZRY62RSPLW2FG2TANCNFSM6AAAAAAVOBKMLA. You are receiving this because you were mentioned.Message ID: @.***>

HoldW commented 1 year ago

is the exp function still not written yet

knwachuk commented 1 year ago

is the exp function still not written yet

No. Even though #10 followed the limitation of the repository, it did not follow the contribution guide (#12).

HoldW commented 1 year ago

i have written mod operator function , i dont know how what to do next, im new to open source

knwachuk commented 1 year ago

i have written mod operator function , i dont know how what to do next, im new to open source

Congratulations and welcome! This is an excellent place to start as the purpose is to introduce newer people to the ideas, concept, and workflows associated with open source!

13 has been opened to track your request. It will be closed when a pull request meets that meets the specification is merged.

Let's use that to further our conversation so we do not "pollute" the main introduction Issue!

A-arti commented 1 year ago

I am a little confused here. What I concluded is that this python library has only two operators (+,-) and we need to create more mathematical functions using the two operators. Am I right ?

knwachuk commented 1 year ago

I am a little confused here. What I concluded is that this python library has only two operators (+,-) and we need to create more mathematical functions using the two operators. Am I right ?

This is correct. You can also use previously created functions as well. Since they themselves, were created using + and - only. The exercise is a simple introducing to Open Source contribution. See #12 if you are interested.