Skip to content

utkarsh-naman/utnamtte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

utnamTTE (Text To Expression)

utnamtte This is a convertor that takes normal mathematical text expressions as String inputs (eg. "2+ln2√π) and return the expression as it would be written in python (2+(math.log(2))*(math.sqrt(math.pi))

Installation

pip install utnamtte

Ways to import

Method 1

import utnamtte
print(utnamtte.tte("2+ln2"))

Method 2

from utnamtte import tte
print(tte("2+ln2"))

Method 3

from utnamtte import tte as xy
print(xy("2+ln2"))

Symbols

You can use π or pi (case insensitive) or math.pi
You can use e (case insensitive) or math.e
You can use { or ( and } or )
You can use × or * and ÷ or /

Auto-complete brackets

#utnamtte auto-completes incomplete brackets
a = tte("2*7/(3+1")
print(a)
print(eval(a))
Output: 2*7/(3+1)
        3.5

Division

a = tte("7/3π")
print(a)
print(eval(a))
Output: 7/(3)*math.pi
        7.330...

Square root

print(tte("2√π11+3"))
Output: 2*(math.sqrt(math.pi))*11+3
# you can also use sqrt and √ under √ without brackets
print(tte("2√√sqrtπ11+3"))
Output: 2*(math.sqrt(math.sqrt(math.sqrt(math.pi))))*11+3

Mod or Absoulute

print(tte("2|3-6|7+3"))
Output: 2*(abs(3-6))*7+3

Log

print(tte("4ln11e"))
Output: 4*(math.log(11))*math.e
# you can also use log and ln of ln without brackets
print(tte("4lnlnlog1331π+3"))
Output: 4*(math.log(math.log(math.log(1331))))*math.pi+3
# use log to the desired base as follow
print(tte(f"log({number}, {base})"))

Antilog

print(tte(f"antilog({base}, {power})"))

Application of this library MATEX is an application to input text mathematical expression and convert into python readable mathematical expression and output the result. Also it can convert such mathematical expressions into Python and Java expressions.

This application was built using Python and kivymd 0.104.2.

🔗 Download the apk file from here

▶️ App tutorial here

About

MATEX is an application to input text mathematical expression and convert into python readable mathematical expression and output the result

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages