Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mathematical Expression Processor

I didn't find a module that did this in my 10-second Google search, so I built this.

Update: I did a 30-second Google search, found Sympy and now use that instead. Sorry, Expression-Processor.

This project converts a given expression from infix to outfix (Reverse Polish Notation), and then calculates the result.

Examples:

rpn.calculateInfix("(2sin(pi/2))^-1") --> 0.5

rpn.infixToRPN("(2sin(pi/2))^-1") --> ['2', 't', '2', '/', 'a', '*', '-1', '^']

# Note that "t" represents pi, and "a" represents sin() within the program.

rpn.py contains a little library and some tools for solving infix and outfix-notation expressions.

It accepts expressions, not equations, meaning there should be no "=" equals sign.

# Please note that this repository cannot yet handle imaginary values.

About

Calculates value from a given mathematical expression. Utilizes outfix, AKA reverse polish notation, converted with the Dijkstra Shunting-Yard Algorithm.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages