General mathematical toolbox routines
The routines that follow are part of my general mathematical “toolbox”. Some of them are taken (with reference) from book(s) but most, I have developed on my own. They are modular in construction so that they may be improved, as needed.
request a double from the command line
Parameters: |
|
---|---|
Returns: | final answer |
Return type: | double |
request an integer from the command line
Parameters: |
|
---|---|
Returns: | final answer |
Return type: | int |
request a string, float, or int from the command line
Parameters: |
|
---|---|
Returns: | final answer |
Return type: | str | float | int |
request a string from the command line
Parameters: |
|
---|---|
Returns: | final answer |
Return type: | str |
one of two choices seems simple
Parameters: |
|
---|---|
Returns: | y | n |
Return type: | str |
read three-column data from a wss (white-space-separated) file
Data appear as Q I dI with one data point per line. A “#” may be used to comment out any line.
Parameters: | infile (string) – name of input data file |
---|---|
Returns: | x, y, dy |
Return type: | (numpy.ndarray, numpy.ndarray, numpy.ndarray) |
save three column ASCII data in tab-separated file
Parameters: |
|
---|
Spins a stick to indicate program is still working. Call this routine frequently during long operations to show progress.
Parameters: |
|
---|
find i such that x[i] >= target and x[i-1] < target
Parameters: |
|
---|---|
Returns: | index of array x or None |
Return type: | int |