Skip to content

DjoCoding/py-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PyMath

A math interpreter that is able to parse, evaluate and draw mathematical expressions and functions.

Pre-Requesites

  • Python3
  • matplotlib package pip install matplotlib

Try PyMath

To play with the interpreter, copy and paste the following:

git clone https://github.com/DjoCoding/mather.git
./run.sh

Features

mather features multiple things:

Evaluate arithmetic expressions

It will evaluate any arithmetic expression for you:

>  1 + 1
2
>  (1 / 2) + 1
1.5

Define functions

It follows a Python-Like syntax for defining functions using the def keyword.

Syntax

Here's the syntax for defining functions:

> def <name>([var,+]|var) = <expression>

Examples

> def f(x) = 1 + x
f([x])
> def g(x) = cos(x) + sin(x)
g([x])

Evaluate functions

> f(2)
3
> g(0)
1

Draw One-Dimensional functions

This is possible using the draw keyword that will draw the specified function for you

Note

  • draw uses the matplotlib package underneath the hood, make sure to install it first.
  • draw is only able to draw one-dimensional functions (functions with a single variable).

Syntax

Here's the syntax for draw functions:

> draw(<name>, <lower_bound>, <upper_bound>, <step>)

Examples

> draw(g, 0, 10, 0.001)

image

About

Small mathematics interpreter able to evaluate and draw complex functions written in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors