Skip to main content

Python package that solves mathematical equations

Project description

https://img.shields.io/pypi/v/rejgoo.svg Documentation Status

Rejgoo is a Python package that solves mathematical equations! The main aim of rejgoo is too be the fastest and simplest way to solve system of mathematical equations. You can solve any number of equation with just one line of code!

HOW TO USE:

At first the eqs class needs to be imported. This class handle the process of slving equations.

Then an instance of eqs class is created with text file that contains equations as parameter.

A simple code sample is shown below:

from rejgoo.rejgoo import eqs

text = """
    x**2 + x  = 2
    3*a + 2*b = 16
    -5*a + 5 = -b
    sin(3*b*a) + cos(60) = d
    """

equations = eqs(x)

After running the code, The results will be printed automatically:

Total number of equations: 4
Total number of variables: 4
Number of isolated systems of equations: 2

system number: _1_
number of equations in this system: 3

solve
order     residual       equations
--------------------------------------------------------------------
1       0.00000       3*a+2*b=16
1       0.00000       -5*a+5=-b
2       0.00000       sin(3*b*a)+cos(60)=d
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

system number: _2_
number of equations in this system: 1

solve
order     residual       equations
--------------------------------------------------------------------
1       0.00000       x**2+x=2
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

Values of variables:

a:    2.0
b:    5.0
d:    1.0
x:    1.0

The results can be accesed by solved_vars attribute as an dictionary: equations.solved_vars

Keyword arguments:

You can also provode folowing kwargs to eqs calls:

  • verbose:

verbose is a boolean, By default verbose is set to True. If you don’t like the results to be printed, just set verbose = False

eqs(text, verbose=False)

  • init_vals:

init_vals is a dictionary that contains initial guess for variables.

eqs(text, init_vals={'x':3})

  • max_iter

max_iter is an integer that shows number of iteration that newton raphson will do. By default it is 100.

eqs(text, max_iter=200)

  • learning_rate

learning rate is a float number that is multiplied to newton raphson step sizes. learning_rate by default is 1, which means that steps are not changed! By using smaler numbers, we can prevent over shooting!

eqs(text, learning_rate=0.8)

  • random_state:

random_state is an integer that can be set and be used to set initial values for variable.

eqs(text, random_state=42)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rejgoo-0.0.3.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rejgoo-0.0.3-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file rejgoo-0.0.3.tar.gz.

File metadata

  • Download URL: rejgoo-0.0.3.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for rejgoo-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fe92953cf7135829a49638786788e32747836230728fff0a3acad741a28c4121
MD5 bf5ce1a9c9b47fb70c828165cb45bd61
BLAKE2b-256 cfc335bb550be7c821aa7f2a37ddebc9482baed8ea45619cbc7e149c312be5d9

See more details on using hashes here.

File details

Details for the file rejgoo-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: rejgoo-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for rejgoo-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dff385b052fd2b16a308287d27413f3f90d0b0ab33f1b55090333392ffb9327f
MD5 caf05821ce118c4c38952817715264c1
BLAKE2b-256 a922c67fba3e589a0552578583766a5b3c85e210099f978b28c068bb00fac8bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page