This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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):

  1. 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, })

  1. Wrap functions as ‘staticmethod’ or functions of module:

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

  1. 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.

Release History

Release History


This version

History Node

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.

Show More

Download Files

Download Files

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

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting