I need advice. I'm writing a calculator; I've got the basic functionality of it down, and have finally moved to having it process functions. In this regard, I find the standard library of mathematical functions provided by Python unsatisfactory. While the more commonly used functions are defined, some of the more obscure functions lack proper mention. Examples of this include the arc hyperbolic cotangent, arc hyperbolic cosecant, hyperbolic cosecant, secant, etc. While some of these are just manipulations of the functions provided, it seems the better alternative would be to provide our definitions and refer the program to those when it encounters them. This is where my question lies. Should I just define these functions in the main script, or should I use a separate file? If I the latter, how do I make reference to the separate file? I am relatively new to Python, so if I'm missing a common technique or something, please do let me know. Thanks in advance.
Jump to Post
You could first install the numpy and scipy modules which contain many special functions.
To answer tour second question, you want to write a separate module containing your own special functions. For example write a mymathfuncs.py file containing
# mymathfuncs.py import numpy def arccoth(z): …
All 4 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.