Project Description
Release History
## Release History

Download Files
## Download Files

This module provides classes that can be used to evaluate math expression contained in string. Most common class is Ncalc. It allows you evaluate expression contains variables ‘x’, ‘y’ and most common functions such as sin, cos, tg, log2, log10, exp, mod, exp and factorial. Furthermore you can build your own ‘calculator’ with your own operator precedences (don’t know why it can be need), functions and variables. To build The Calculator see at Ncalc definition and do it like it: 1. Define new class inherited from Matheval:

class Ncalc(Matheval):

- Using __init__ set up given math expression and context namely dictionary of variables and functions:

def __init__(self, mexp): super().__init__(mexp, { ‘x’: 1, ‘y’: 1, ‘factorial’: Ncalc.__factorial, })

- Wrap functions as ‘staticmethod’ or functions of module:

@staticmethod def __log10(a): return math.log10(a)

- That’s it. :)

Using: >>> from ncalc.eval import Ncalc >>> e = Ncalc(‘2*factorial(5)’) >>> e.eval() 240 >>> e.expression = ‘1+mod(5, 2)+sin(0)’ >>> e.eval() 2.0

P.S. This version can work wrong cause I didn’t test it as it’s necessary.

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help | Version | File Type | Upload Date |
---|---|---|---|

ncalc-1.0-py3.4.egg (8.3 kB) Copy SHA256 Checksum SHA256 | 3.4 | Egg | Jan 31, 2016 |

ncalc-1.0.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 | – | Source | Jan 31, 2016 |