Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Cake

An object orientated math library, Built with power and simplicity!

Cake is an object orientated math library based off Sympy and aims to be simple and easy to use. Its main advantages are easy of use, chaining and provides shortcuts to lengthy methods.

License: MIT License (see the LICENSE file for details) covers all files in the cake repository unless stated otherwise.

Features

  • Generally is fast and provides simple solutions for complex problems
  • Simple to use and learn
  • Provides support for algebra and equation substitution

Installation

This library is currently in very early works! It does not have much to offer as of now, but we have a vision to make it full of features!

Stable

# Windows
pip install MathCake

# Linux/MacOS
pip3 install MathCake

Development

git clone https://github.com/Mecha-Karen/Cake
cd Cake
pip install .

Documentation

To compile the documentation, click me for more information

If you wish to view the live version, click me.

Quick Example

Quadratic Formula

Note: This is currently just a concept!
from cake import Expression

expr = Expression("-b (+|-) sqrt((b ** 2) - 4(a)(c))")
# Top layer of the formula

# (+|-) will return 2 solutions as stated in the documentation
# Its one of the many ways of implements plus or minus

expr.wrap_all("/", "2(a)")
# Puts the entire current formula into brackets and divides by 2a

print(expr.substitute(a=10, b=-20, c=5))

# Results: (1.70711, 0.292893)

Solving Simultaneous Equations

from cake import Expression
from cake.simultaneous import Circle

# Since `=` will raise a syntax error and will mess with the python syntax
# We settled on using the `==` operator
# What this is saying `Expression == something`, which returns an Eqaution instead of bool
# This is unpythonic but it still makes sense with what it does
# You should never do `if Expr == ...`. This will always be True
# Instead try `if (Expr == ...).solve(*args, **kwargs) == ...`

circle = Expression("x ** 2 + y ** 2") == 16
line = Expression("x + y") == 4

eq = Circle(circle, line)
eq.solve_by_sub()
# Result: ((4, 0), (0, 4))

Matrix Operations

from cake import Matrix
# We define the matrix structure using standard 2D array syntax
y = Matrix([10, 10, 10], [10, 10, 10])
x = Matrix([1, 2, 3], [4, 5, 6])

# As we have modified the addition method for the Matrix object
# we can simply add the two matrices together
print(x + y)
# Result = ([11, 12, 13], [14, 15, 16])

# The same logic applies to subtraction operations
print(y - x)
# Result = ([9, 8, 7], [6, 5, 4])

Links

Metadata

Release files for MathCake 0.0.1a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MathCake 0.0.1a3
File Size Uploaded
MathCake-0.0.1a3.tar.gz 27.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MathCake 0.0.1a3
File Interpreter ABI Platform
MathCake-0.0.1a3-py3-none-any.whl Python 3 none any Details

Total release size: 63.2 kB

Release files / MathCake-0.0.1a3.tar.gz

Download URL MathCake-0.0.1a3.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5ba46ee3a21333c03d482e4f81eb900dd07eb6d81aad64659b002b727756d22c
BLAKE2b-256 checksum
How to use checksums
7ba6b146a230f434043c536e795eca9fe258184695b891cfafc3c48500af6d0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release files / MathCake-0.0.1a3-py3-none-any.whl

Download URL MathCake-0.0.1a3-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ba0636d7cf85f16f0bfb8ef7898647728fe2cb99835941c71bfba76e92aa060
BLAKE2b-256 checksum
How to use checksums
a48540b1c97af4daf036da2d1c38e10e54f363de5196396994e1a9d21bfce0e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.1a3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page